[SOLVED] parent_item_id in Entity drop-down list (ajax) resolves to 0

Post Reply
thielem
Posts: 22
Joined: 12 Mar 2023, 22:30
Name: Moritz Thiele
Location: Germany, Berlin

[SOLVED] parent_item_id in Entity drop-down list (ajax) resolves to 0

Post by thielem »

I am trying to filter a "Entity drop-down list (ajax)" item by a value in the parent entity.

I am using this code in the condition field:

Code: Select all

e.id in (select field_272 from app_entity_26 as f where f.id = [parent_item_id])
However, I can observe in the debugging console, that the query resolves to

Code: Select all

select  e.*  from app_entity_31 e  where e.id>0  and (e.id in (select field_272 from app_entity_26 as f where f.id = 0)) order by e.id limit 0, 30
As you can see, [parent_item_id] resolves to 0. It works fine with the correct parent_item_id in phpMyAdmin.

My general use case is that entity_26 needs to have appointments (entity_29) of specific kinds (entity_31). The filter ajax list is supposed to show only the values of entity_31 that are requested in the parent entity 26 but are not already processed in related appointments (entity 29). For simplification, I have left out the latter part in this demonstration but the issue is the same.

I reproduced the issue in entity 29 / field 273 at this demo: https://pdemo.rukovoditel.pro/3.3/index ... mo_id=1985
Last edited by thielem on 14 Mar 2023, 21:16, edited 1 time in total.
User avatar
support
Site Admin
Posts: 6231
Joined: 19 Oct 2014, 18:22
Name: Sergey Kharchishin
Location: Russia, Evpatoriya

Re: parent_item_id in Entity drop-down list (ajax) resolves to 0

Post by support »

[parent_item_id] was not supported in this query. Added it.
File from archive replace to includes\classes\fieldstypes\
Let me know if it works ok now.
Attachments
fieldtype_entity_ajax.zip
(5.97 KiB) Downloaded 37 times
thielem
Posts: 22
Joined: 12 Mar 2023, 22:30
Name: Moritz Thiele
Location: Germany, Berlin

Re: parent_item_id in Entity drop-down list (ajax) resolves to 0

Post by thielem »

Works perfectly, thanks!
Post Reply