• Resolved davidslager

    (@davidslager)


    Hi,

    Okay, I’ve searched the forums for guidance on queries to CSV files, but I haven’t found the answer I need. It may be here and I’ve just missed it or don’t understand it – if so, I’m sorry.

    I’m trying to write a basic program to guide customers through their journey of making a table or table top. Based on their selections, the guide will give them specific instructions. These inputs will go to a calculated field form whereby each input will have a specific value (e.g., “small” and “circle” = 0 + 3 = 3); column 1 in the CSV file will have corresponding values with instructions associated to those selections. So in this case, 3 might have: “So, you want a small circular table top? Okay, let me help you with that.”

    I can create the CSV and populate all of the fields. I can do the math in a calculated fields form to identify which outputs should be made. What I can’t figure out is how to query the CSV and output the appropriate response from the CSV to the user. Some of the outputs will be entire paragraphs, or multiple paragraphs, of instruction. How do I output a bunch of text like that from a CSV? I assume I need to work with DS fields, but I’m not sure which ones I need or how to link them.

    I can figure out how to hide / show instruction text boxes based on inputs, but I would have to create a few hundred instruction text boxes and that seems too much.

    I think this is a pretty basic thing, but I’m not a programmer – so I do apologize. Thanks for any help you can provide!

    The page I need help with: [log in to see the link]

Viewing 1 replies (of 1 total)
  • Plugin Author codepeople

    (@codepeople)

    Hello @davidslager,

    The solution depends of the form’s fields and CSV file’s structure. I’ll try to explain the process with a hypothetical example:

    – Assuming your form includes two dropdown fields for the type and size (fieldname1, and fieldname2 respectively)

    For type: circle and square
    For size: small, medium, large

    – And you have the CSV file with the headline row: type,size,price (check it here: https://wordpress.dwbooster.com/customdownloads/2017/11/21/file.csv)

    First, insert a Recordset field (fieldname3) and configure it as follows:

    – Selects the CSV option for the “Datasource” option.
    – Ticks the “From URL” option.
    – Enters the URL to the CSV file (https://wordpress.dwbooster.com/customdownloads/2017/11/21/file.csv) through the input box.
    – Ticks the “Use headline” checkbox.
    – Ticks the “character” option, and enter the comma symbol (,)
    – Press the “Import CSV” button.
    – And very important, selects all options displayed in the “Select columns” list

    Second, insert a “Currency DS” field in the form, configured as follows:

    – Selects the “Recordset” option for the datasource.
    – Selects the recordset field inserted previously (in our ejemplo the fieldname3 field)
    – Enters the column’s name for using as the “Property for values”, in my case: price
    – Finally, enter the options for filtering through the “Condition” attribute, as follows:

    record['type']=='<%fieldname1%>' && record['size']=='<%fieldname2%>'

    and that’s all.
    Best regards.

Viewing 1 replies (of 1 total)

The topic ‘Querying CSV Files’ is closed to new replies.