• Guillaume Mendlevitch
  • NEWBIE
  • 0 Points
  • Member since 2019

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 0
    Replies
Hello,

Here is a simple query in Apex:
 
public class edf {

    public list <Asset__c> accaccount {get;set;}
    public String researchKey {get;set;}
 
    public edf( ) {
    }
    
    public void research(){

        researchKey='a1H200000006MCoEAM';
        String searchqueryaccount;
        String Idie='00120000013UXzOAAW';
        
        searchqueryaccount='SELECT Id, Account__r.Name FROM Asset__c WHERE (Asset__c.Product_Strategy__r.Product_ID_18__c LIKE \'%'+researchKey+'%\' AND Account__r.Account_ID_18__c LIKE \'%'+Idie+'%\')';
        
        accaccount= Database.query(searchqueryaccount);
        
    }
    }



And here is the VisualForce code:
 
<apex:page Controller="edf" action="{!research}"> 
    
    <apex:form >

        <apex:pageBlock title="Assets">
            
            <apex:repeat value="{!accaccount}" var="a">
                
                {!a.Id}

            </apex:repeat>
            
        </apex:pageBlock>
     
    </apex:form>
    </apex:page>



It is supposed to simply return Asset IDs for a certain Product ID and a certain Account ID.

The problem is: it does return 10 results whereas I get 32 results with the same SOQL query in Workbench Salesforce.

Could you please help me understand what is wrong with my code? It should be returning 32 results as well.