Hello,
This message: “Your Query includes variables, so it cannot be tested from the form’s edition.” is not an error, if you are using variables in your query, it cannot be tested from the forms builder, because in this section the variable has no value assigned (even it does not exists), you should check the query at runtime:
from the public form.
Please, indicate the structures of the query and database, furthermore, send me the link to the webpage where the form is inserted for checking it in action.
Best regards.
Thread Starter
benspr
(@benspr)
Thank you. We’ve tried a couple ways and can’t get it to work. Here’s a message from my co-worker:
Database table:
ZIP_CODES
Columns:
zip, state, city, state_abbrev
A test form is here:
https://solarpowerrocks.com/texas-solar-programs/
First page of the form is a single line text – fieldname3
Then a page break
Then two Line Text DS fields
Both with datasource Database
Both with working connections
queries
SELECT state FROM ZIP_CODES WHERE zip = <%fieldname3%>
SELECT city FROM ZIP_CODES WHERE zip = <%fieldname3%>
(yes, I know I can use a RecordSet DS to make it a single query, but I want to know how to make it work this way first)
Expected behavior is filling out zip, then clicking to next page, both fields should be populated by the database queries. Not working.
Hello @benspr,
The issue is simple, please, check the plugin’s documentation visiting the following link:
https://cff.dwbooster.com/documentation#datasource-fields-settings
You need to say the plugin the column to use for field’s values using an alias in the query (AS value) for example:
SELECT state AS value FROM ZIP_CODES WHERE zip = <%fieldname3%>
or
SELECT city AS value FROM ZIP_CODES WHERE zip = <%fieldname3%>
For fields like: “DropDown DS”, “Radio Button DS” or “Checkbox DS”, whose options require a value and text, you should use an alias to indicate the column to use as value, and an alias to indicate the column to use as text, for example:
SELECT state AS value, city AS text FROM ZIP_CODES WHERE zip = <%fieldname3%>
Best regards.
Thread Starter
benspr
(@benspr)
Thanks! That got it sorted.