DMXzone Server Connect Support Product Page

Answered

Can't get filter option IN working

Asked 17 Jun 2017 12:00:31
1
has this question
17 Jun 2017 12:00:31 Hans Haverlach posted:
Hi,
I created a server action file with a simple select from a table.(ID,NAME,PUBLISH)
In the filter tab I chose the ID column and as comparison I used: IN.
As a value (just for test purpose) I entered 2,3,4

I created a server action executor.
Then place a repeat region on my page and placed {{NAME}} in it.
So as a result I expect a list of names from the record 2,3 and 4.
But it only shows the first record: 2.
If I remove the filter options, it show all records as it should.

So somehow I can't get the filter IN working.
Is this a bug (I use the latest version of the extensions and updated the dmxConnectLib.)?
Or am I missing something?
Greetings,
Hans

Replies

Replied 20 Jun 2017 22:04:33
20 Jun 2017 22:04:33 Hans Haverlach replied:
Anyone??
Replied 21 Jun 2017 14:30:17
21 Jun 2017 14:30:17 Tom Dupre replied:
Hi Hans,

I'm afraid I don't have a solution, but I can confirm the problem. I explained the problem in an email to support over a month ago. I received an initial reply but have not heard anything since.

The SQL generated by the extension, using your example, is:
IN ('2,3,4')
.. which will return just the first result. The single quotes are the problem. This wouldn't work for text values either.

Hopefully there is some way to prevent this (I've experimented with various Server Data Formatter options) - but I think this is a bug. It would be great at least to get a reply - I would have thought it was an easy issue to replicate.
Replied 21 Jun 2017 14:40:14
21 Jun 2017 14:40:14 Hans Haverlach replied:
Thank you for letting me know, I'm not alone in this.
Hopefully, DMX support will monitor all the postings.
I'll see, if I can modify some stuff.
Replied 21 Jun 2017 14:56:31
21 Jun 2017 14:56:31 Tom Dupre replied:
I tried without success to modify dmxConnectLib\lib\db\SqlBuilder.php. The compileWhereIn function at line 338 looked like a good place to start - I tried editing this but couldn't get it to work. I hope you have more success.
Replied 22 Jun 2017 08:31:51
22 Jun 2017 08:31:51 Patrick Woldberg replied:
The IN filter requires an array of values as input, seems that it puts the value you inserted as a single string value. Not sure how to make an array with the UI, but you could edit the action file code directly. I will check on how the value could be set from the extension.
Replied 22 Jun 2017 12:24:10
22 Jun 2017 12:24:10 Teodor Kuduschiev replied:
Hi Tom, Hans,
You can just use split filter in the UI, so with static values it should be:

{{'A,B,C'.split(",")}}


which will return an array with the values.
Replied 23 Jun 2017 08:35:48
23 Jun 2017 08:35:48 Hans Haverlach replied:
I can confirm that. this:

{{'19,20,21'.split(",")}}


is working.
Thank you Teodor!

Reply to this topic