You need to sign in to do that
Don't have an account?
VN
PageReference
Hi,
We have a requirement where we need to fetch the filter criteria entered by user in the visualforce page and display the report. I have created 3 picklist field for this and when i click on generate report the report is not accurate.
Could anyone please help me with where iam going wrong.
The code for is
Code:
... <apex:pageBlock title="Enter Filter Criteria"> <apex:form > <b>Marketing Domain</b> <apex:selectList id="domain" size="1" > <apex:selectOptions value="{!items}"/> </apex:selectList> .... <apex:commandButton value="Generate Report" action="{!reset}"> </apex:commandButton> .....
The code for controller class is
Code:
.... public Account[] getAccount() { accounts = [Select Name,Customer_Rating1__c,Target_Visit__c,salesdistrict__c,Achieved__c,To_Be_Achieved__c from Account where Marketing_Domain__c=:ApexPages.currentPage().getParameters().get('domain')]; return accounts; } .... public PageReference reset() { PageReference newpage = new PageReference(System.currentPageReference().getURL()); newpage.setRedirect(true); return newpage; } ...
Please Help.
Thanks in advance
Priya Nair
Also you are doing way too much work in your reset method. For one, if you want to get the PageReference of a Visualforce page in your org, you just use PageReference p = Page.myPageName. And you're setting a redirect which means you're going to lose all of your viewstate, which means you're going to run your query but then redirect to your page, discarding your query result. All you should have to do is return null, which will cause your page to refresh.
All Answers
Also you are doing way too much work in your reset method. For one, if you want to get the PageReference of a Visualforce page in your org, you just use PageReference p = Page.myPageName. And you're setting a redirect which means you're going to lose all of your viewstate, which means you're going to run your query but then redirect to your page, discarding your query result. All you should have to do is return null, which will cause your page to refresh.
Hi,
can u provide modified code which u did.
Thanks,
Mahendiran.