1

I am new to salesforce apex and getting the error below. I have a request object and passings its id and the request object query and fetching filters. The fetched filters are then used to fetch records from listings object .

Error: Compile Error: Invalid type: SoqlBuilder at line 7 column 26

Controller

public class searchcontroller {

    public List<Listing__c> getListings() {
       String qid = ApexPages.currentPage().getParameters().get('id');  
       List<Request__c> rq = [select baths__c,beds__c,max_price__c,min_price__c,Contact__c from request__c where id =: qid];
       String qr = '';
       String soql = new SoqlBuilder().selectx(new Set<Object>{'id','name'}).fromx('listing__c').wherex(new AndCondition());
       if(rq['baths__c']){
           soql.add(new FieldCondition().field('baths__c').equals(rq['baths__c']));
       }
       if(rq['beds__c']){
           soql.add(new FieldCondition().field('beds__c').equals(rq['beds__c']));
       }
       if(rq['min_price__c']){
          soql.add(new FieldCondition().field('min_price__c').greaterThan(rq['min_price__c']));
       }
       if(rq['max_price__c']){
          soql.add(new FieldCondition().field('max_price__c').greaterThan(rq['max_price__c']));
       }
       soql.toSoql(new soql.SoqlOptions().wildcardStringsInLikeOperators());
       System.debug(soql);

    } 

}

Please help. Thanks in advance.

  • What are your requirement, can you share them briefly in bullet point by Edit your question? – Mahmood Dec 10 '14 at 7:42
  • I have edited my question. apex-commons.github.io/query/soql-builder This is where I am using soqlbuilder . I have searched all over how to use the elaborated class "soqlbuilder" but could not find any help. Please help me. Thanks – user3361920 Dec 10 '14 at 7:50
0

It seems that you don't have the utility open source classes. You can download the source (if you are only interested in using specific classes) or the manage/unmanage package from below link and it should work:

https://code.google.com/p/apex-lang/

|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.