+ Start a Discussion
antony fernando 17antony fernando 17 

Analytic graph with user filters

I have below requirement in analytics graph. i want the user to pass the filters to the graph in VF page. cusyear and cusmonth are the filters used in report graph currently set to blank
    User-added image

I have tried below
VF code
<apex:page controller="Dashboard" sidebar="false" >
<apex:form ID="Search" >  <apex:pageBlock >   <apex:pageBlockButtons >
   <apex:commandButton value="Submit" action="{!Search}" reRender="showpartner" />
      </apex:pageBlockButtons>  <apex:outputLabel value="Name:" />  <apex:inputText value="{!Name}"/>
   <apex:pageBlockTable value="{!tenpartners }" var="partnervalue" id="showpartner" >  <apex:column value="{!partnervalue.syear__c}"/><apex:column ><analytics:reportChart cacheAge="10" cacheResults="false" reportid="00O280000035HWm" size="large" filter="{column:'SYEAR', operator:'equals', value:'{!JSENCODE(partnervalue.Name)}'}">
</analytics:reportChart></apex:column>   </apex:pageblockTable>    </apex:pageBlock>  </apex:form></apex:page>

Controller
public class Dashboard{
Public List<opportunity> tenpartners{get;set;}
public string Name{get;set;}
public Boolean rend { get; set; }
public pagereference search(){
tenpartners = new List<opportunity>();
tenpartners = database.query('SELECT ID,cusmonth__c,syear__c,Name FROM opportunity where syear__c=:Name');
return null;}}

I am gettnig below error when executed
 [For the filter 1: Specify a valid filterable column because SYEAR is invalid.]

is thre any other way to achieve it? Please help
RajaMohanRajaMohan
Hi Antony,

​Your report's filter column is not valid. You can get the filter column by,

​To find the column value do the following:
  • Open salesforce Workbench at : https://workbench.developerforce.com/restExplorer.php
  • Log into your salesforce or (test, production,….)
  • Select ‘Utilities’ from the top menu
  • Select REST Explorer
  • Give /services/data/v29.0/analytics/reports/{YOUR_REPORT_ID}/describe in the text box.
  • Click the Execute button
  • Drill down to the ‘reportMetadata | detailColumns
The column value will be the name associated with the position (left to right) where the index starts at ‘0.’

User-added image

hope this helps.

Thanks,
Raja