cascadingdropdown Where query question (problem?)

rhinoboy

New Member
I am having some issues building a "Where query" in a cascadingdropdown element.

I can get the following statement to work correctly:

`PerfModel`.`Sponsor_idSponsor` = 2​

But I need the "2" to be a field from the current form. The Where query" tooltip says that {tablename___elementname} placeholders may be used, but when I use a placeholder, throws a SQL syntax error which shows the placeholder (it's not replaced).

I've tried every variation I can think of and I can't figure out what to put in there to make it work.

I am running Joomla 3.6.5 on php 7.0.16 and I pulled the latest Fabrik build from GitHub just before posting this thread.
 
I just finished writing a "Data - where" clause in a databasejoin and it is substituting placeholders. I have a different issue there (the value is resolving to being empty, so that's a problem!) but this makes me think that the cascadingdropdown element isn't processing placeholders.
 
The CDD definitely does do placeholder replacement on the WHERE filter.

Remember that they won't have values for a new form.

-- hugh
 
Ah, yes. I got around lack of values (and that was the problem I was having in the databasejoin) by writing a WHERE clause using {$my->id} since that is always available.

I was thinking about the cascade all wrong. The Advanced - Where query is executed at load time; I was thinking it executed when the watched element changed. So that helped me.

But, there is a difference between the databasejoin element and the cascading element in how they handle placeholders. This is the test I did:
  • First, enter a placeholder in the Data-where tab of a databasejoin (and nothing else: this causes a SQL error so you can see the query)
  • On the front end, load the form containing the element
  • The SQL statement shows that the placeholder was replaced with an empty string
  • Second, enter a placeholder in the cascading element's Advanced - Where query field (and nothing else)
  • On the front end, load the form containing the element
  • The SQL statement shows the placeholder in the query string, not an empty string
Of course the element placeholder is empty in both scenarios, so I guess it doesn't matter. I did use {$my->id} in both with perfect success.

In case anyone is struggling with these WHERE clauses, I should mention that in the database join's "Data - where" tab, you can start the statement with WHERE (works with or without), but in the cascadingdropdown element's "Advanced" tab, the "Where query" field can't start with WHERE as it causes a syntax error because there is already a WHERE in the statement generated.
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top