[Solved] Is this a proper where clause?

Is this a valid where clause?

products.data.products[0].listPrices.data.where(\'recurring.interval\', \'==\', \'month\')

I’m trying to get the plan that has a recurring.interval of “month”.

No sure we can use a nested element like recurring.interval.

Interesting. Haven’t tried this before. Did it work?

Not as-is…looking to hear if it is possible.

It works…should be:

where('recurring.interval', 'month', '==')

Had to build it by hand and had botched the attempt! I really wish the where clause in SC matched the where clause in AC!

3 Likes

For anyone who sees this who wants a summary of SC/AC differences…

Where() parameters are different client-side to server-side.

Client-side is:
.where('propertyname',lookupvalue,'operator')
e.g. .where('membername', serverconnect.data.query.fname, '==')

On server-side the lookupvalue and operator are switched around:
.where('propertyname','operator',lookupvalue)
e.g. .where('membername', '==' , query.fname)

Catches me out all the time!

3 Likes

I have also noticed the single quotes are another weird difference.
It sometimes uses regular single quotes ( ’ ), and other times the apostrophe ( ` ) style quote.

Yes… are either valid?

I usually use ampersand-quot; on the client side… (can’t do back quotes on my mobile!)

I just have a snippets file with an example of each and cut and paste as needed.

Then… well don’t even get into the syntax of a .where() in a flow… :boom: