Results 1 to 4 of 4

Thread: Graphs's filter not working

  1. #1
    ianmaciel is offline Member
    Join Date
    Aug 2010
    Posts
    14

    Thumbs down Graphs's filter not working

    Chart's filter not working correctly.

    When I try to add a new dashlet I set up my filter to show my pipeline of 2010, and another for 2011.
    What I can observe is the data showed on theses graphs are not correctly. It's not filtering like I selected it still showing opportunities from years ago (also with the Close Date before 2010).

    How can I fix that or make new filters selecting the exactly fields I want to filter?

  2. #2
    ianmaciel is offline Member
    Join Date
    Aug 2010
    Posts
    14

    Unhappy Re: Graphs's filter not working

    I've already tried this solutin: http://www.sugarcrm.com/forums/showthread.php?t=32695

    but it didn't work. This is for Sugar 5, nd we are on SugarPRO 6.0.

    Anyway, I couldn't understand how does the chart's filter works.

    Any help?

  3. #3
    ianmaciel is offline Member
    Join Date
    Aug 2010
    Posts
    14

    Default Re: Graphs's filter not working

    I just found the file "modules/Charts/code/Chart_pipeline_by_sales_stage.hp" but it looks ok.
    I can't find any error here.

    I tried to print out my name and check where the php goes and stop, but I couldn't see it printed anywhere.
    I tried it inside the php code and outside on the html code, but I got nothing.

    Any help?

    Code:
    <?php
    if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
    require_once("include/charts/Charts.php");
    require_once("modules/Charts/code/Chart_pipeline_by_sales_stage.php");
     ...
    
    ...
    
    <?php
    echo get_validate_chart_js();
    
    
    	function gen_xml_pipeline_by_sales_stage($datax=array('foo','bar'), $date_start='2071-10-15', $date_end='2071-10-15', $user_id=array('1'), $cache_file_name='a_file', $refresh=false,$chart_size='hBarF',$current_module_strings) {
    		global $app_strings, $charset, $lang, $barChartColors, $current_user;
    		
    		$kDelim = $current_user->getPreference('num_grp_sep');
    		global $timedate;
    
    		if (!file_exists($cache_file_name) || $refresh == true) {
    
    			$GLOBALS['log']->debug("starting pipeline chart");
    			$GLOBALS['log']->debug("datax is:");
    			$GLOBALS['log']->debug($datax);
    			$GLOBALS['log']->debug("user_id is: ");
    			$GLOBALS['log']->debug($user_id);
    			$GLOBALS['log']->debug("cache_file_name is: $cache_file_name");
    			$opp = new Opportunity;
    			$where="";
    			//build the where clause for the query that matches $user
    			$count = count($user_id);
    			$id = array();
    			$user_list = get_user_array(false);
    			foreach ($user_id as $key) {
    				$new_ids[$key] = $user_list[$key];
    			}
    			if ($count>0) {
    				foreach ($new_ids as $the_id=>$the_name) {
    					$id[] = "'".$the_id."'";
    				}
    				$ids = join(",",$id);
    				$where .= "opportunities.assigned_user_id IN ($ids) ";
    
    			}
    			//build the where clause for the query that matches $datax
    			$count = count($datax);
    			$dataxArr = array();
    			if ($count>0) {
    
    				foreach ($datax as $key=>$value) {
    					$dataxArr[] = "'".$key."'";
    				}
    				$dataxArr = join(",",$dataxArr);
    				$where .= "AND opportunities.sales_stage IN	($dataxArr) ";
    			}
    
    			//build the where clause for the query that matches $date_start and $date_end
    			$where .= "	AND opportunities.date_closed >= ". db_convert("'".$date_start."'",'date'). " 
    						AND opportunities.date_closed <= ".db_convert("'".$date_end."'",'date') ;
    						echo db_convert("'".$date_start."'",'date');
    			$where .= "	AND opportunities.assigned_user_id = users.id  AND opportunities.deleted=0 ";
    
    			//Now do the db queries
    			//query for opportunity data that matches $datax and $user
    			$query = "	SELECT opportunities.sales_stage,
    							users.user_name,
    							opportunities.assigned_user_id,
    							count( * ) AS opp_count,
    							sum(amount_usdollar/1000) AS total
    						FROM users,opportunities  ";
    			$opp->add_team_security_where_clause($query);
    			$query .= "WHERE " .$where;
    			$query .= " GROUP BY opportunities.sales_stage,users.user_name,opportunities.assigned_user_id";
    			
    			$result = $opp->db->query($query)
    			or sugar_die("Error selecting sugarbean: ".mysql_error());
    
    ?>

  4. #4
    ianmaciel is offline Member
    Join Date
    Aug 2010
    Posts
    14

    Exclamation Solved: Charts's filter not working

    Solved!

    I just found the error.

    It was a combined error: typing and sugar errors.

    Typing error:
    The amount error was a wrong entry with 3 extras zeros, for example a number supposed to be "XX million dollars be XX billion dollars".

    Sugar error:
    When I click over a "sales stage" on pipeline chart, it shows me "more details" option. If I click on this, I'll be redirect to opportunities search but on this search the sugar filter different than the pipeline: it doesn't filter by date here - actually the advanced search doesn't have the option to filter an interval between dates, and it would be impossible. But clicking over the chart make you induces you to think you will see a detail about those entries - Doesn't make any sense to click on the chart and see another information.

    I fixed the typing error, and created a new Report making the same thing that the pipeline was doing.

    Now if I click on the setting icon, I'll be redirected to the report, and there the user will the the correct information.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Filter/Search not working for imported records
    By criticalmath in forum Developer Help
    Replies: 0
    Last Post: 2010-04-28, 03:06 PM
  2. Replies: 23
    Last Post: 2006-08-30, 05:32 PM
  3. Replies: 3
    Last Post: 2006-08-10, 01:18 AM
  4. "Only my items" filter is not working
    By lorenzogrilli in forum Help
    Replies: 0
    Last Post: 2005-10-05, 10:15 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •