DMXzone Database Custom Query Support Product Page
Custom Query 'In Select' now working with Arrays!
Reported 23 May 2020 23:28:50
1
has this problem
23 May 2020 23:28:50 Utku Selamoglu posted:
select SUM(table.item) as itemcount from table where table.ID IN (: p1): p1 -> $POST.Text1.join(",",null)->contains (1,2,3,4)
tested to save as text in another field, that it is being saved like this "1,2,3,4" which is very okey.
Custom Query only gets the first item inside the array always. It returns Sum of first ID as (5) instead of (5+7+10+2 = 24)
ID - ITEM
----------------------------------
1 - 5
2 - 7
3 - 10
4 - 2
-----------------------------------
Also "Database Custom Query" window there is a test value, it only gets 1 value at a time. I can not insert multiple values.
could you please confirm that is a bug or not as urgent.
Replies
Replied 25 May 2020 07:51:27
25 May 2020 07:51:27 Teodor Kuduschiev replied:
Hello
Can you please post a screenshot of your custom query?
Can you please post a screenshot of your custom query?
Replied 25 May 2020 08:36:28
25 May 2020 08:36:28 Utku Selamoglu replied:
Hello Teodor,
This is my custom query;
imgur.com/dlX5rYb
to : P1 I did lots of tricks but not worked.
İnput1 is textarray multiple contains checkboxez checked values..
1-{{$_POST.input1.join(",", null ) }}
2-{{$_POST.input1.join(",", null ).split("," )}}
3-{{$_POST.input1.split("," ) }}
4-{{$_POST.input1}}
5-{{$_POST.input1[2]}} this one works but only returns 1 item
After I can not get successful, I did make a normal single query with exactly the same query above and under conditions I put only this IN statement {{$_POST.input1}} and it works very well.
But with custom query not worked {{$_POST.input1}} with this. I need custom query too much..
I found this thread at the wappler community side and tried but no chance.
community.wappler.io/t/not-in-mysql-query-in-server-action/2452
This is my custom query;
imgur.com/dlX5rYb
to : P1 I did lots of tricks but not worked.
İnput1 is textarray multiple contains checkboxez checked values..
1-{{$_POST.input1.join(",", null ) }}
2-{{$_POST.input1.join(",", null ).split("," )}}
3-{{$_POST.input1.split("," ) }}
4-{{$_POST.input1}}
5-{{$_POST.input1[2]}} this one works but only returns 1 item
After I can not get successful, I did make a normal single query with exactly the same query above and under conditions I put only this IN statement {{$_POST.input1}} and it works very well.
But with custom query not worked {{$_POST.input1}} with this. I need custom query too much..
I found this thread at the wappler community side and tried but no chance.
community.wappler.io/t/not-in-mysql-query-in-server-action/2452
Replied 25 May 2020 08:56:49
25 May 2020 08:56:49 Teodor Kuduschiev replied:
Are you sure {{$_POST.input1}} returns an array? If it's an array you don't have to use split.
Your checkboxes need to have the same name ending with: [] like:
Your checkboxes need to have the same name ending with: [] like:
name="input1[]"
Replied 25 May 2020 08:59:57
25 May 2020 08:59:57 Utku Selamoglu replied:
Yes it returns an array.
When I use it in the custom query like this
{{$_POST.input1[0]}}
{{$_POST.input1[1]}}
{{$_POST.input1[2]}}
it works.
All checkboxes are name="input1[]"
Also under action stepping
GLOBALS->$_POST->INPUT1(type=text, linkedfiled=input1[],multiple(checked)).
When I use it in the custom query like this
{{$_POST.input1[0]}}
{{$_POST.input1[1]}}
{{$_POST.input1[2]}}
it works.
All checkboxes are name="input1[]"
Also under action stepping
GLOBALS->$_POST->INPUT1(type=text, linkedfiled=input1[],multiple(checked)).
Replied 28 May 2020 20:14:30
28 May 2020 20:14:30 Utku Selamoglu replied:
hi any news about this problem?
thank you.
thank you.