• Resolved benspr

    (@benspr)


    Hi,

    I’m making a calculator form that relies on several columns of data stored in a csv. The data relates to states in the USA, and I’ve set up a dropdown using the names of the states to begin the process. How do I then fill other fields with data for the selected state, in order to perform the calculations?

    Here’s what I’d like to do:

    1. User selects their state
    2. Several hidden fields load data like electricity price, avg kWh usage per month, etc.
    3. User enters their monthly electricity bill and I can tell them whether it’s higher or lower than the average.

    That’s just one example. I can do the math, but I need to know how to populate the fields.

    Here’s what I’ve tried so far:

    1. Imported a CSV for use as recordset with columns named “state” and “elec_price” (fieldname5)
    2. Set up a dropdown DS field using the recordset, with state populated as values and texts (fieldname 4)
    3. Tried to set up a “Line Text DS” field to be populated with the elec_price record for the selected state. I input “elec_price” into the “Property for Values” field, and “record[‘state’]==<%fieldname4%>” into the “Condition field. Please tell me what I’m doing wrong.

    Just being able to learn how to do this correctly for this one field will allow me to continue to work on getting the math right. Thanks!

    Image shows setup of the Line Text DS field:

    • This topic was modified 7 years, 10 months ago by benspr.
Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author codepeople

    (@codepeople)

    Hello,

    If the values in the ‘state’ column are texts the correct would be:

    record['state']=='<%fieldname4%>'

    Could you send me the URL to the webpage with the form inserted for checking it, please?

    Best regards.

    Thread Starter benspr

    (@benspr)

    Hey-

    That worked great. Thanks! The documentation for CFF doesn’t include any information about how to specifically include the output of a field as a condition. Might be nice to add.

    Thanks for being so responsive with the plugin support. So far it’s looking like our $150 was worth it!

    Plugin Author codepeople

    (@codepeople)

    Hello,

    Thank you very much, I’ll include the information in the plugin’s documentation, however there is part of this information in the following link:

    https://cff.dwbooster.com/documentation#datasource-fields-settings

    Best regards.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Using recordset to fill a field based on dropdown’ is closed to new replies.