ChronoEngine.com homepage

Forums

Please write a review for the extension you are using on the Joomla extensions directory before posting a new question as we are being spammed by many negative reviews.

Thank you for your support!

DB read: Filter settings - Where

NickOg 11 Dec, 2018
Really struggling witth uisn g IN:\ in where conditions. I hav tried all I can think of
What is the correct syntax?
mdlMembers.cb_memberstatus/IN: '"Active","Life","Honorary"'
or
mdlMembers.cb_memberstatus/IN: "'Active','Life','Honorary'"
I have tried all of the variants I can think of including setting the string in {data:memberSelector}

Stuck!
healyhatman 12 Dec, 2018
model.field/in: ["one", "two", "three"]

What you've done is just asked it to look in a string.
NickOg 12 Dec, 2018
Thanks - makes sense but
mdlMembers.cb_memberstatus/in: ["one", "two", "three"]
leads to
1064 - You have an error in your SQL syntax; 
check the manual that corresponds to your MySQL server version for the 
right syntax to use near '' [\"one\", \"two\", \"three\"]'' at line 1
I tried escaping the " (\") and changed to ' but same effect.
healyhatman 12 Dec, 2018
Sorry needs to be an array. So you could use a custom code block before it with
["one", "two", "three"]
And then using
model.field/in:{var.jsonde:custom_code_name}
Passing it an array from PHP will work too without needing it to be jsondecoded first, or an array from your form data so field/in:{data:selected} if you had for example a checkboxes group called 'selected'.
NickOg 12 Dec, 2018
Will try again tomorrow. I really must learn json but I think I understand the PHP approach.
Thanks again
healyhatman 12 Dec, 2018
UPDATE: You can create an array with a shortcode (if you really need to) and get it done like this

model.field/in:{value:["one", "two", "three"]}
NickOg 12 Dec, 2018
Answer
Morning

That latter fixed it but worth noting that the syntax is EXACTLY as you proposed. It fails if you use ' rather than " or omit the trailing space after each comma.

Many thanks.
Nick
This topic is locked and no more replies can be posted.

2Checkout.com

2CheckOut.com Inc. (Ohio, USA) is an authorized retailer for goods and services provided by ChronoEngine.com