Sample Exercise: Using Functions in an A2J Guided Interview

Sample Exercise: Using Functions in an A2J Guided Interview

 

This exercise will teach you how to use functions in an A2J Guided Interview. This exercise creates an A2J Guided Interview only and does not contain an A2J Template or HotDocs Template. The skills learned in this Sample Exercise will be useful in creating an expert system inside your own A2J Guided Interviews.

 

The functions that we will practice using in this interview are:

  • HASANSWERED

  • AGE

  • TODAY

  • DATE

  • CONTAINS

  • ORDINAL

  • DOLLAR

  • SUM

  • ROUND

 

The final A2J Guided Interview will look like this:

 

 

This Sample Exercise should be used by authors who have completed a basic A2J Author training. Training videos can be found on our A2J Author YouTube Channel (www.youtube.com/a2jauthor)

 

  1. Log into your www.a2jauthor.org account. If you aren’t sure how to create an account, check out this resource.

  2. Once logged in, go to the “Author” tab and click it.  

  3. Then click “Run A2J Author”.

  4. A2J Author will open on the “Interviews” Tab. Under “Create a new interview” double click on “Blank Interview”. This will open up a blank A2J Guided Interview.

  5. Go to the “About” Tab and rename the title of the interview to Sample Exercise: Functions

  6. You will need to create several variables to be used in the A2J Guided Interview. Go to the Variables Tab and create the following variables. The variable type will be next to the variable name in parenthesis.

    1. AssetCount (number)

    2. Client asset name TE (text)

      1. This variable is going to be used in a repeat loop, so it needs to store multiple values. Check the box next to “Check if multiple values”

    3. Client asset number NU (number)

    4. Client asset value NU (number)

      1. This variable is going to be used in a repeat loop, so it needs to store multiple values. Check the box next to “Check if multiple values”

    5. Client DOB DA (date)

    6. Client expense name TE (text)

      1. This variable is going to be used in a repeat loop, so it needs to store multiple values. Check the box next to “Check if multiple values”

    7. Client expense number NU (number)

    8. Client expense value NU (number)

      1. This variable is going to be used in a repeat loop, so it needs to store multiple values. Check the box next to “Check if multiple values”

    9. Client full name TE (text)

    10. Client total asset value NU (number)

    11. Client total expense value NU (number)

    12. ExpenseCount (number)

    13. Incident date DA (date)

    14. Legal problem TE (text)

    15. Notice date DA (date)

    16. Number of days NU (number)

  7. Go to the “Steps” tab. By default a blank A2J Guided Interview comes with 4 steps. Rename them as follows:

    1. Step 0: Welcome

    2. Step 1: Your Information

    3. Step 2: Do You Qualify

    4. Step 3: Exit

  8. Now let’s start creating the questions we’ll build our interview out of. Go to the “Pages” Tab. By default, an A2J Guided Interview comes pre-populated with 4 questions - 3 in Step 0 and 1 in Step 1. Also, Steps only appear on the Pages Tab when they have questions inside them. So when you first go to the Pages Tab, all you’ll see is Step 0 and Step 1. As we add questions to the other Step, it’ll appear. We will need a total of 18 questions for this Sample Exercise.

    1. Create 14 new questions by clicking the “New Page” icon 14 times. All the new questions should appear in Step 0.

  9. Double click on 1-Introduction and rename it 1-Welcome.

    1. Question text: Welcome to the A2J Guided Interview for the Sample Exercise on Functions! To get started, click “Continue”.

    2. We’ll connect all the questions at the end of this Sample Exercise, so you can ignore the buttons and the Destination for now, unless noted otherwise.

  10. Double click on 2-Name. Move it to Step 1 and rename it 1-(HASANSWERED) Name

    1. Question text: Please enter your name and select your avatar.

    2. Create 4 fields.

      1. Field 1- Type: Text; Label: First; Variable: Client first name TE

      2. Field 2 - Type: Text; Label: Middle; Variable: Client middle name TE

      3. Field 3 - Type: Text; Label: Last; Variable: Client last name TE

      4. Field 4- Type: Gender; Label: Select your avatar; Variable: User Gender

    3. Scroll down to the Advanced Logic section. We’re going to script a logic statement that sets [Client name full TE] to the first, middle, and last name if middle name is entered. Otherwise, it sets that variable to first and last name. Type the condition in the AFTER logic as it appears below.

 

  1. Double click on 3-Gender. Move it to Step 1 and rename it 2-(AGE) DOB.

    1. Question text: What is your date of birth?

    2. Change the field type to Date MM/DD/YYYY; delete the label because the question is sufficiently clear without it; Variable: Client DOB DA; Check the “required” box; Min value: 01/01/1920; Max value: TODAY

    3. Setting the min and max values limits the calendar range shown to the end user. The above restrictions means that the calendar will only show and the field will only allow to be entered dates that fall between 01/01/1920 and the date the end user accesses the interview.

  2. We’re going to script a logic statement that tests if the user’s age is less than 18 years old in the above question. If so, we’re going to branch them to a “Sorry, you don’t qualify” question. First we need to make that question.

    1. Double click on 1-Question 1 in Step 1. Move it to Step 3. Rename it 0-Do Not Qualify and Exit

    2. Question text: Sorry, but you do not qualify to use this program. Please hit the “Exit” button to close this program.

    3. Scroll down to the Buttons section. Click the “Set Destination” button. Select [Exit - User does not qualify]. This will exit the end user out of the interview if they don’t qualify.

  3. Go back to 2-(AGE) DOB. Double click to open it. Scroll down to the Advanced Logic section. Type the following condition in:

 

 

  1. Double click on any newly created page. Move it to Step 1. Rename it 3-(TODAY) Incident date.

    1. Question text: When did the incident of discrimination occur?

    2. Create 1 field.

      1. Type: Date MM/DD?YYYY; delete the label; Variable: Incident date DA; min value: 01/01/2000; max value: TODAY

    3. Scroll down to the Advanced Logic section. Script a condition that’s identical to the one below.

  1. Double click on any new page. Move it to Step 1. Rename it 4-Notice Date

    1. Question text: On what date did you receive notice?

    2. Create 1 field.

      1. Type: Date MM/DD/YYYY; delete the label; Variable: Notice date DA; min value: 01/01/2000; max value: TODAY

    3. Scroll down to the Advanced Logic section. We’re going to set a new variable to be used in a Variable macro on the next question. Script the condition as shown below:

 

  1. Double click on any new page. Move it to Step 1. Rename it 5-(DATE) Response deadline

    1. Question text: You must file a response with the court by: %%DATE([Notice date DA] + 30%%. It has been %%[Number of days NU]%% days since you received the notice.

    2. Close the question.

  2. Double click on any new page. Move it to Step 1. Rename it 6-(CONTAINS) Legal Problem

    1. Question text: What is your legal problem?

    2. Create 1 field.

      1. Type: Text (long); delete the label; Variable: Legal problem TE

    3. AFTER LOGIC (that will test if the user’s answer contains the word violence. If it does, then ask the end user a follow up question.)

  1. Double click on any new page. Move it to Step 1. Rename it 7-(CONTAINS) Legal Problem 2

    1. Question text: Your legal issue may be related to domestic violence. We suggest you come into our office as soon as possible.

  2. Double click on any new page. Move it to Step 2. Rename it 1-Number of Assets

    1. Question text: %%[Client first name TE]%%, how many assets do you have?

    2. Create 1 field.

      1. Type: Number (Pick from list); no label; Variable: Client asset number NU; min value: 1; max value: 10

    3. Button label: Continue; Repeat options: Set Counting Variable to 1; Counting Variable: AssetCount

    4. This is the “jumping off” question for a repeat loop asking about the user’s assets. We’ll use the user’s answer in a later logic statement to evaluate if they’ve gone through the repeat loop enough times.

  3. Double click on any new page. Move it to Step 2. Rename it 2-(ORDINAL) Name of Assets

    1. Question text: What is your %%ORDINAL(AssetCount)%% asset?

    2. In the Counting Variable field (in the question text section, right above the Fields section), add the variable: AssetCount

      1. This tells A2J Author that this question is part of the repeat loop.

  1. Create 1 field

    1. Type: Text; no label; Variable: Client asset name TE

  2. Double click on any new page. Move it to Step 2. Rename it 3-Value of Assets

    1. Question text: How much is your %%ORDINAL(AssetCount) asset worth?

    2. Add AssetCount to the Counting Variable field under the question text section.

    3. Create 1 field.

      1. Type: Number Dollar; no label; Variable: Client asset value NU

    4. Under the Continue button, Repeat Options select: Increment Counting Variable. Under Counting Variable, select: AssetCount. This tells A2J Author the user has completed 1 iteration of the loop.

  1. Scroll down to the Advanced Logic section. We’re going to create a condition that tests if the end user has gone through the Asset loop the number of times that they said they needed to go through the loop. Type the logic statement exactly like this in the AFTER box: (We will create the 4-(DOLLAR & SUM) Total value of assets question in the next step)

  1. Double click on any new page. Move it to Step 2. Rename it 4-(Dollar and Sun) Total value of assets

    1. Question text: The total value of your assets is $%%DOLLAR([Client total asset value NU])%%. Is this correct?

    2. Create two buttons. One labeled Yes and one labeled NO

    3. Advanced Logic in the BEFORE box that will set the total value variable to the sum of all the values held by [Client asset value NU] (We create this condition in the BEFORE logic box because we want it to be tested by A2J Author before the end user sees this question. We are using it in the variable macro in the question text itself.)

  2. Double click on any new page. Move it to Step 2. Rename it 5-Number of monthly expenses

    1. Question text: %%[Client first name TE]%%, how many monthly expenses do you have?

    2. Create 1 field.

      1. Type: Number (Pick from list); no label; Variable: Client expense number NU; min value: 1; max value: 10

      2. Note this limit is arbitrary, but does limit the scope of the interview because an end user can’t have more than 10 monthly expenses for the purposes of the repeat loop.

    3. Under the buttons section, go to the Repeat Options pick “Set Counting Variable to 1”; under the Counting Variable, insert ExpenseCount

  3. Double click on any new page. Move it to Step 2. Rename it 6-Name of monthly assets

    1. Question text: What is your %%ORDINAL(ExpenseCount)%% monthly expense?

    2. Add ExpenseCount to the Counting Variable field in the question text section.

    3. Create 1 field.

      1. Type: Text; no label; Variable: Client expense name TE

  4. Double click on any new page. Move it to Step 2. Rename it 7-Value of monthly expenses

    1. Question text: What is the amount of your %%ORDINAL(ExpenseCount)%% monthly expense?

    2. Add ExpenseCount to the Counting Variable field under the question text section

    3. Create 1 field.

      1. Type: Number Dollar; no label; Variable: Client expense value NU

    4. Under the Continue button, Repeat Options select: Increment Counting Variable. Under Counting Variable, select: ExpensetCount. This tells A2J Author the user has completed 1 iteration of the loop.

  1. Scroll down to the Advanced Logic section. We’re going to create a condition that tests if the end user has gone through the Expense loop the number of times that they said they needed to go through the loop. Type the logic statement exactly like this in the AFTER box: (We will create the 8-(ROUND) Total of monthly expenses question in the next step)

  1. Double click on any new page. Move it to Step 2. Rename it 8-(ROUND) Total of monthly expenses

    1. Question text: The total of your monthly expenses is $%%ROUND([Client total expense value NU])%%. Is that correct?

    2. Create two buttons. Button 1, label: Yes; Button 2, label: No

    3. Advanced Logic in the BEFORE box that will set the total value variable to the sum of all the values held by [Client expense value NU] (We create this condition in the BEFORE logic box because we want it to be tested by A2J Author before the end user sees this question. We are using it in the variable macro in the question text itself.)

  1. Double click on the last new page. Move it to Step 3. Rename it 1-Complete.

    1. Question text: Thank you %%[Client first name TE]%% for completing this A2J Guided Interview!

  2. To complete this Sample A2J Guided Interview, we need to connect all the questions now. To connect questions, you set the Destination on each question to the next one in the line. Double click on each question in the following list and make sure it’s connected to the next question listed as follows:

    1. 1-Welcome to 1-(HASANSWERED) Name

    2. 1-(HASANSWERED) Name to 2-(AGE) DOB

    3. 2- (AGE) DOB to 3-(TODAY) Incident Date

    4. 3-(TODAY) Incident Date to 4-Notice Date

    5. 4-Notice Date to 5-(DATE) Response deadline

    6. 5-(DATE) Response deadline to 6-(CONTAINS) Legal Problem

    7. 6-(CONTAINS) Legal Problem to 7-(CONTAINS) Legal Problem 2

    8. 7-(CONTAINS) Legal Problem 2 to 1-Number of Assets

    9. 1-Number of Assets to 2-(ORDINAL) Name of Assets

    10. 2-(ORDINAL) Name of Assets to 3-Value of Assets

    11. 3-Value of Assets to 4-(DOLLAR& SUM) Total value of assets

    12. 4-(DOLLAR & SUM) Total value of assets to 5-Number of monthly expenses

    13. 5-Number of monthly expenses to 6-Name of monthly expenses

    14. 6-Name of monthly expenses to 7-Value of monthly expenses

    15. 7-Value of monthly expenses to 8-(ROUND) Total of monthly expenses

    16. 8-(ROUND) Total of monthly expenses to 1-Complete.

  3. Now it’s time to test your interview to ensure it flows as it is supposed to. Either click the Preview Tab or open 1-Welcome and then click the Preview button within that question. It’s best to preview your interview with the Variables/Script window open. To open it, when in Preview mode, click the “Variables/Script” button in the bottom left hand corner of the interview. This will open a panel where you can see the values that are being assigned to different variables, the path the interview is following, and the logic statements being evaluated real time. You can re-enter editing mode by clicking “Edit this” to edit the question you are currently viewing or “Resume Edit” to edit the question you entered Preview mode from.

 

Congratulations! You’ve completed this Sample Exercise. If you have any questions or feedback, feel free to email Jessica Frank, our A2J Author Project Manager, at Jessica@cali.org.

 

Be sure to check out our other Sample Exercises to further develop your authoring skills with A2J Author!