0

I want to perform a search where the Name field contains the query value.

public static Map<Id,Postal__c> getRecordsMap(
    String query,PostalRequest.cls_address address,Integer offsetCount,Integer limitCount
){
        return New Map<Id,Postal__c>([SELECT Id,Name FROM Postal__c
                                            WHERE Name LIKE :query 
                                                AND City__r.Name =:address.city
                                                AND Provinance__r.Name =:address.state
                                                AND Country__r.Name =: address.country
                                                LIMIT : limitCount 
                                                OFFSET :offsetCount]);
    }

closed as unclear what you're asking by Himanshu, Adrian Larson, superfell, Mohith Shrivastava, Ratan Paul Feb 13 '16 at 3:28

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • 1
    If you don't know what's wrong with it, how are we supposed to figure it out? Are you getting any errors? Unexpected output? Please be more specific. – Adrian Larson Feb 12 '16 at 18:48
2

You are doing search in which you need to provide query string:

public static Map<Id,Postal__c> getRecordsMap(String query,PostalRequest.cls_address address,Integer offsetCount,Integer limitCount){
    query = '%' + query + '%';
    return New Map<Id,Postal__c>([SELECT Id,Name FROM Postal__c
                                        WHERE Name LIKE :query 
                                            AND City__r.Name =:address.city
                                            AND Provinance__r.Name =:address.state
                                            AND Country__r.Name =: address.country
                                            LIMIT : limitCount 
                                            OFFSET :offsetCount]);
}

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