Skip to main content
Topic: Multiple Lookup values in the same form (Read 2567 times) previous topic - next topic

Multiple Lookup values in the same form

I assume this can be done, as the Query Params can be separated by commas, but how do you associate the Query params with the '?' in the query builder? Is it just sequential ? 1st '?' corresponds to first Parameter in the Params box below?

To elaborate a bit more, what I would like to accomplish in this test is this:

Tables : [Country] [Company] [Brand] [Product] and a [Order] table where the selection is made

One Company has several brands that are present in several countries, but all products are not available in all countries, even they share the same company/brand.

US - Company A - Brand 1 - Product USA1
US - Company A - Brand 2 - Product USA2
UK - Company A - Brand 1 - Product UKA1
UK - Company A - Brand 3 - Product UKA3

So, with the current lookup form, I can just select one Dynamic Select Field to define the Where clause. In this case, the ideal would be to use all 3: country, company and brand .. to display only the products that match all 3 conditions.

With simple linear selections, can be done, but the problem comes when a product can be available in more than one country, but not all.. or when same brands are in different countries and have different products for each country.


Re: Multiple Lookup values in the same form

Reply #2
Thanks.

#2 about Gmail was probably for someone else.

I've tried multiple combinations with Query Params in the form of  $lookup_idSomethingHere  and with one param they work fine, but never with 2.

Just a quick example, assuming we're using the same DB and fields for this example. And 1 and 2 work fine, but 3, using the same data, doesn't.

Query box:
"SELECT DISTINCT id AS value,name AS label FROM brand WHERE idSomethingOne= ? "
Params box:
$lookup_idSomethingOne
This works

Query box:
"SELECT DISTINCT id AS value,name AS label FROM brand WHERE idSomethingTwo= ? "
Params box:
$lookup_idSomethingTwo
This works

Query box:
"SELECT DISTINCT id AS value,name AS label FROM brand WHERE idSomethingOne= ? AND idSomethingTwo= ?"
Params box:
$lookup_idSomethingOne, $lookup_idSomethingTwo
This does not work

Re: Multiple Lookup values in the same form

Reply #3
I have tested with multiple parameters, and it works sequentially when they are values, but for some reason the lookups don't work when having more than one in the parameter box.


 

Re: Multiple Lookup values in the same form

Reply #5
Related question.. where is the code that manages the $lookup_??? stored?


Re: Multiple Lookup values in the same form

Reply #7
Any $lookup_**** that is generated by the Field Datasource popup


Re: Multiple Lookup values in the same form

Reply #8
@ewwgee‍ check the app/controller/ for its controller code and app/view/partial/ folder for its view code, for the all static list generated, you can find its data in the Menu.php file in helper folder.