2

I need a way to find all articles that are related to a list of tags.

Assuming the Articles_c object has a column Tags_c that holds a comma separated list of all tags that are applied to the article. Something like this:

$articleTags == "php, newb, salesforce, soql"

Here is some semi-pseudo code that represents what I am trying to do:

$filter = array('%php%', '%soql%')
$query = "SELECT Id FROM Articles__c WHERE Tags__c LIKE $filter";
$result = $salesForceConnection->query($query);

Is this possible with the PHP API? If so, how do I need to format $filter for it to create a valid query to accomplish what I want?

3
  • 2
    I found a similar post that appears to be the functionality I need, I just need to find a way to do the same thing with the PHP API.
    – John Pope
    Commented Sep 12, 2013 at 2:53
  • You could iterate through the elements in your array and build the WHERE clause dynamically - WHERE Tags__c LIKE $filter[i] [when i == 0], and for the rest append - OR Tags__c LIKE $filter[i] [when i > 0] Commented Sep 12, 2013 at 3:03
  • That will work alright. I wonder if there is a way to filter with a single statement like the user in the post linked above did.
    – John Pope
    Commented Sep 12, 2013 at 4:05

0

You must log in to answer this question.

Browse other questions tagged .