DMXzone App Connect Data Traversal Support Product Page
  Answered 
 query filtered by query
 Asked  17 Jul 2018  18:20:17 
  1 
     has   this question  
  17 Jul 2018  18:20:17 andrea mac posted: 
 Hi, how is it possible to filter a query by a resaults of another query?Let me explain.
You have, for example, a simple database table that contains the name of animals (cat, dog, bird).
You use this table to populate a select field in an insert form.
Infact you have another database table, tbl_animals_details, that contains detailed information about the animals (cat, dog, bird).
The question is:
is it possible to populate the select field containig the animal list only with the animals not yet inserted in the bl_animals_details?
Thank you for your suggestion
Replies
 Replied 18 Jul 2018  06:48:07 
   18 Jul 2018  06:48:07 Teodor Kuduschiev replied: 
  Hi Andrea,
You can do this the following way:
1. Create your server action
2. Add a database connection
3. Add a query from the tbl_animals_details (nothing special no filters needed here - just regular query)
4. Add a query from the tbl_animals
4a. Add the columns you need in the list
4b. In the filters tab select the animal ID (or whatever column you use to store the animal details in the tbl_animals_details) and use the NOT IN conditon
4c. For the value select your query from the tbl_animals_details and apply to it first join filter and then split filter. The values should look like:
It looks like: prntscr.com/k7tlu4
 
  You can do this the following way:
1. Create your server action
2. Add a database connection
3. Add a query from the tbl_animals_details (nothing special no filters needed here - just regular query)
4. Add a query from the tbl_animals
4a. Add the columns you need in the list
4b. In the filters tab select the animal ID (or whatever column you use to store the animal details in the tbl_animals_details) and use the NOT IN conditon
4c. For the value select your query from the tbl_animals_details and apply to it first join filter and then split filter. The values should look like:
  {{query_details.join(",", "animal_id").split(",")}}It looks like: prntscr.com/k7tlu4
 Replied 18 Jul 2018  17:16:38 
   18 Jul 2018  17:16:38 andrea mac replied: 
  Thank you so much. It's perfect. Last question:
do I have to right the code or is it possible to do the same using a dmx tools (ex. formatter or something else)?
  do I have to right the code or is it possible to do the same using a dmx tools (ex. formatter or something else)?
 Replied 18 Jul 2018  18:45:50 
   18 Jul 2018  18:45:50 Teodor Kuduschiev replied: 
  Well, this is applied using the server data formatter. 
  