sqlnode.jsvql

How to select id's of multiple products using VQL?


I currently have the following query to select the id of a single product, like so:

client.post(`https://merck-nextgen.veevavault.com/api/v18.3/query?q=SELECT id FROM product__v WHERE name__v = '${VOLT_CREDENTIALS.get('cred').productName }'` , args , function( data , res) {
            //console.log( 'PRODUCT ID IS ' + data.data[0].id);
            productID = data.data[0].id;
            resolve("Product ID retrieved ...");
});

But what if I have multiple products, i.e. maybe more than one, how do I go ahead and select the id's of multiple products using the same query as above?

I am using nodejs and VQL.

Right now the value of VOLT_CREDENTIALS.get('cred').productName is just "demoproduct". So how do I go about selecting the id's of multiple products?


Solution

  • Instead of the filtering condition:

    WHERE name__v = '${VOLT_CREDENTIALS.get('cred').productName }'
    

    you can use:

    WHERE name__v = '${VOLT_CREDENTIALS.get('cred').productName1 }'
       OR name__v = '${VOLT_CREDENTIALS.get('cred').productName2 }'
       OR name__v = '${VOLT_CREDENTIALS.get('cred').productName3 }'
    

    You get the idea.