The HotDocs Computation Archive
Get Extra Help

0132 - Record Look-up

Description:

How to jump directly to a given record in a repeated dialog.


• Code •

(computation)

// Populate the multiple choice variable
CLEAR RecordList-m
ASK NONE
REPEAT Dialog
   ADD "«LastName-t», «FirstName-t»   («COUNTER:009»)" TO RecordList-m
END REPEAT
ASK DEFAULT

// Ask which record they want to edit
ASK RecordList-m

// Single out the record and ASK the dialog
IF ANSWERED( RecordList-m )
   SET RecordNumber-n TO INTEGER( LAST( RecordList-m, 4 ) )
   ASK Dialog
END IF

// Reset so the dialog won't be filtered hereafter
SET RecordNumber-n TO UNASNWERED
 
 
(dialog script)

// Only filter if a record has been chosen
IF ANSWERED( RecordNumber-n ) AND COUNTER != RecordNumber-n
   HIDE ALL
END IF

• Explanation •

The objective of this computation is to jump to a specific previously-answered iteration of a repeated dialog. Example: In a repeat dialog gathering info about shareholders, if the user wants to edit the information about shareholder number 16 in a list of, say, 20 shareholders, it is tedious to have to click through shareholders 1 to 15 in order to get to number 16.

The above computation answers this need by using a multiple choice variable as something of a "pick list." The user selects an entry to edit, clicks "Next," and that record is immediately presented. All other records in the dialog are hidden.

Required Elements: RecordList-m is a multiple choice variable. It should be set to "Select one only" and should NOT allow "Other." RecordNumber-n is a number variable to hold the repeat iteration value of the record to be edited. It is recommended that both of these variables have their Advanced options set to "Ask only in dialog," "Don't warn if unanswered," and "Don't save in answer file."

How It Works: The computation first clears and repopulates the multiple choice variable with all of the names (or whatnot) from the repeated dialog. The COUNTER number of each record is placed at the end of the multiple choice entry in the format 009. The multiple choice variable then ASKs the user which entry they want to edit. After they make their choice, the COUNTER number is extracted from the end of the choice using LAST and INTEGER, and that number is placed in the number variable RecordNumber-n.

The dialog is then ASKed. Using Bart Earle's record-hiding technique (see Computation #0131: Fast-tracking Repeated Dialogs), all entries but the one in RecordNumber-n are hidden. This has the effect of taking the user directly to the entry they selected.

Practical Example: For a practical example of how to implement this technique, see Robert Martin's Computation #0133: Asset Navigator.  

• Contributors •

LegalCS