Overview
This ‘How To’ will show you how to use the function ‘dblGetSubjectStoreRow’ that allows you to pull a row from a subject store. The example pulls a book name from a book subject store in your survey.
Note: the dblGetSubjectStoreRow function uses internally the "getTableFromStore" function.
Online Guide
Direct Youtube link (for full screen): https://youtu.be/7-Dx877vs50
Steps
Steps for using ‘dblGetSubjectStoreRow’ in your survey
Step 1: Adding the Excel file as a subject store and attach the subject store to the survey
Step 2: Use ‘dblGetSubjectStoreRow’ function to pull the book name from a book subject store
Step 3: Pipe the book name to a certain question
Step 1: Adding the Excel file as a subject store and attaching it to the survey
- Upload the Excel and add it as a subject store. Attach it to the survey (as described here): How-to-use-an-excel-file-as-a-data-list-in-a-survey).
Step 2: Use ‘dblGetSubjectStoreRow’ function to pull the book name from a book subject store
- After loading the Excel to the system and adding it to the survey subject stores, you can use the dblGetSubjectStoreRow function to retrieve a row from the excel using a master key.
- For example, if your store name is "Books" and you want to pull the book author of a certain book by the value in the BookID column, you can write the following script:
var row = dblGetSubjectStoreRow("Books","ID",Answer(QRef(1)));
if (row != null) {
SetTextFormat(CurrQues,row["author"]);
}
- This will try to pull a book by the ID of the book chosen in question 1. You’ll receive a "row" back that allows you to access the columns as shown in the “author” variable.
Step 3: Pipe the book name to a certain question
- Here is a link to our How to pipe text in your survey: How-to-pipe-text-objects-in-you-survey.
How to use this example
- Import the attached Survey. This is how you import a survey: How-to-import-a-survey
- Define the attached Excel file as a subject store. Call it Books. See above how this is done.
- Once you added the new store navigate to Q1 and choose the store in the Answers tab
- Run it to experience the example
That’s it!
Comments
I looked for an equivalent function in order to change a value in the Subject Store, based on an answer given in an active survey. Is this possible?
Regards
Please sign in to leave a comment.