Parameterized scripts assist with the re-use of XpressDox code
Here are some examples of Scripts which may be useful:
Write out a full name from individual data elements:
«Script(FullName,FirstName,MiddleName,LastName)»
«concat(SuffixWith(&FirstName&,’ ‘),SuffixWith(&MiddleName&,' '),&LastName&)»
«ScriptEnd()»
The SuffixWith() functions will ensure that the names are suffixed with spaces only if those data elements are given values. If left blank, no spaces will be added.
Use the full name in another fillpoint:
Here we will use the FullName script to gather information about the Plaintiff, and then display the full name of the Plaintiff on the interview in some Footing text.
«FullName(Plaintiff_First,Plaintiff_Middle,Plaintiff_Last)»
«Footing(Plaintiff_Last,@Blue/Microsoft Sans Serif/12@ )»«Comment(this defines the style of the footing)»
«Footing(Plaintiff_Last,Enter the address details for <FullName(Plaintiff_First,Plaintiff_Middle,Plaintiff_Last)||[Plaintiff]> below)»
Giving us something that looks like this in the interview screen:
Now add the address:
In a single line:
«Script(SingleLineAdd,Add1,Add2,City,State,Zip)»
«SuffixWith(&Add1&,’, ‘)»«SuffixWith(&Add2&,’, ‘)»«&City&», «&State&» «&Zip&»
«ScriptEnd()»
Over multiple lines:
«Script(MultiLineAdd,Add1,Add2,City,State,Zip)»
«&Add1&»
«ShowIfHasValue(&Add2&)»
«&City&», «&State&» «&Zip&»
«ScriptEnd()»
Now call the address scripts:
«MultiLineAdd(Plaintiff_Line1,Plaintiff_Line2,Plaintiff_City,Plaintiff_State,Plaintiff_Zip)»
«SingleLineAdd(Plaintiff_Line1,Plaintiff_Line2,Plaintiff_City,Plaintiff_State,Plaintiff_Zip)»
And because they are the same data elements, they will only appear once on the interview, but will appear in different ways on the resultant document.
Use the same scripts multiple times in the template:
Because the scripts are parameterized, it means they can be used multiple times for different parties.
«FullName(Plaintiff_First,Plaintiff_Middle,Plaintiff_Last)»
«FullName(Defendant_First,Defendant_Middle,Defendant_Last)»
«FullName(Attorney_First,Attorney_Middle,Attorney_Last)»
Here the same script (FullName) has been used but for 3 different parties; the Plaintiff, the Defendant and the Attorney.
And with just a few tweaks to the interview e.g. Tabs / Headings / Captions, the user experience can be improved.
You could even choose to do some of that in scripts as well.
«Script(AddHeadingText,First,Text)»
«Heading(&First&,^b^&Text&)»
«Heading(&First&, )»«Comment(Insert a blank space on the interview)»
«ScriptEnd()»
«AddHeadingText(Plaintiff_First,PLAINTIFF DETAILS)»
«AddHeadingText(Defendant_First,DEFENDANT DETAILS)»
«AddHeadingText(Attorney_First,ATTORNEY DETAILS)»
When coding like this, in reusable scripts, should something need to change e.g. the style of the heading, it is easy to make the change only once in the script definition. The change is then applied to all the places where the script is called.