You need to sign in to do that
Don't have an account?
Cynthia Capobianco 163
Fetch Opportunity records filtered by FromAmount and Toamount
Hi all, I'm new to SF. I'm trying to fetch Opportunity records in a VF page using FromAmount and Toamount, dymically using database.query.
Any help on this would be very useful Your help much appreciated. Thanks.
Any help on this would be very useful Your help much appreciated. Thanks.
public with sharing class OppCOntrolerAmount {
public Decimal FromAMount{get;set;}
public List<Opportunity> oplist {set;get;}
public Decimal ToAMount{get;set;}
public Void search(){
if(FromAMount!=null && ToAmount!=null )
{
oplist = Database.query('select Id,Name,StageName,Amount from opportunity where Amount>=:FromAMount AND Amount<=:ToAMount');
}
else If(ToAmount!= null)
{
oplist = Database.query('select Id,Name,StageName,Amount from opportunity where Amount<=:ToAMount ');
}
else If(FromAmount!= null)
{
oplist = Database.query('select Id,Name,StageName,Amount from opportunity where Amount>=:FromAMount ');
}}
19:44:15.0 (21229637)|USER_DEBUG|[17]|DEBUG|From AMount is____99
19:44:15.0 (21307897)|USER_DEBUG|[18]|DEBUG|To AMount is____0
Hope this can fix it.