JoomlaAddict
Member
Hey everyone,
I have set up a form that uses 1 DB Join element and 2 Cascading Dropdowns. This is intended to work as a vehicle selector, so a user can select Year Make Model using these three dropdowns.
I have it working using a source data table that contains the vehicle records (Year Make Model), but I want to constrain the Model selection (the 3rd dropdown) so it only displays options for vehicle records that match Year AND Make. Currently, it is only constrained by Make, so a user is able to select 2016 Ford Model-T. Ford hasn't made a Model-T since 1931, so Model-T shouldn't show in this example.
Here is what the data structure looks like on the source table:
{index} - {vehicle_year_id} - {vehicle_make_name} - {vehicle_model_name}
I added the following statement the WHERE query in Fabrik:
The token {element___vehicle_year} references the DB Join, which is the first element in the series. Adding this WHERE statement causes the following error:
From what I can tell, all of this looks correct. Can anybody tell me if they see something wrong with the syntax?
Thanks in advance!
I have set up a form that uses 1 DB Join element and 2 Cascading Dropdowns. This is intended to work as a vehicle selector, so a user can select Year Make Model using these three dropdowns.
I have it working using a source data table that contains the vehicle records (Year Make Model), but I want to constrain the Model selection (the 3rd dropdown) so it only displays options for vehicle records that match Year AND Make. Currently, it is only constrained by Make, so a user is able to select 2016 Ford Model-T. Ford hasn't made a Model-T since 1931, so Model-T shouldn't show in this example.
Here is what the data structure looks like on the source table:
{index} - {vehicle_year_id} - {vehicle_make_name} - {vehicle_model_name}
I added the following statement the WHERE query in Fabrik:
{element___vehicle_year} = {thistable}.vehicle_year_id
The token {element___vehicle_year} references the DB Join, which is the first element in the series. Adding this WHERE statement causes the following error:
You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '} = `vehicle_ymm_1`.vehicle_year_id ORDER BY text ASC' at line 3
SQL=
SELECT DISTINCT(`vehicle_ymm_1`.`vehicle_model_name`) AS value, `vehicle_ymm_1`.`vehicle_model_name`AS text
FROM `vehicle_ymm` AS `vehicle_ymm_1`
WHERE 4 = -4 AND {element___vehicle_year} = `vehicle_ymm_1`.vehicle_year_id
ORDER BY text ASC
SQL=
SELECT DISTINCT(`vehicle_ymm_1`.`vehicle_model_name`) AS value, `vehicle_ymm_1`.`vehicle_model_name`AS text
FROM `vehicle_ymm` AS `vehicle_ymm_1`
WHERE 4 = -4 AND {element___vehicle_year} = `vehicle_ymm_1`.vehicle_year_id
ORDER BY text ASC
From what I can tell, all of this looks correct. Can anybody tell me if they see something wrong with the syntax?
Thanks in advance!