• Resolved benspr

    (@benspr)


    Hi,

    I’m trying to query a local database for a hidden DS field, but I’m getting an error that seems wrong. We’ve paid for the Platinum edition of CFF, but it’s not allowing me to insert variables in the Condition field. When I try, I get an error that says “Your Query includes variables, so it cannot be tested from the form’s edition.”

    And when I try to test it live, nothing is filled in the value for the hidden input.

    Please advise.

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author codepeople

    (@codepeople)

    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.

    Plugin Author codepeople

    (@codepeople)

    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.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Database query error with Platinum edition’ is closed to new replies.