# 98. Amicus Attorney Custom Fields

# Description

How to convert an Amicus Attorney custom date, number, or true/false field into one usable by HotDocs.

# Code

Custom Date Field:

IF ANSWERED( FileCustomField1 )

DATE OF(

INTEGER( FIRST( FileCustomField1, 2 )),

INTEGER( MID( FileCustomField1, 4, 2 )),

INTEGER( LAST( FileCustomField1, 4 ))

)

END IF

Custom Number Field:

IF ANSWERED( FileCustomField1 )

INTEGER( FileCustomField1 )

SET Temp-n TO POSITION( FileCustomField1, "." )

IF Temp-n > 0

SET Temp-t TO LAST( FileCustomField1, LENGTH( FileCustomField1 ) - Temp-n )

RESULT + INTEGER( Temp-t ) / POWER( 10, LENGTH( Temp-t ) )

END IF

END IF

Custom True/False Field:

IF FileCustomField1 = "TRUE"

TRUE

ELSE

FALSE

END IF

# Explanation

Custom fields in Amicus Attorney present a problem when exported to HotDocs: All of the custom fields are text values, even date, number, and true/false fields. The Amicus date, number, and true/false options only affect the way the data is formatted/displayed in Amicus. They do not create true date, number, or true/false values. This means that custom Amicus fields cannot be mapped directly to HotDocs date, number, or true/false variables. They must first be converted to HotDocs date, number, or true/false values.

NOTE: This applies only to custom fields in Amicus. All predefined Amicus fields export properly as true text, date, number, and true/false values.

Date Fields. Amicus exports custom date fields as DD MM YYYY. For example, the Fourth of July, 2001 would be exported as 04 07 2001. This makes conversion easy. We can extract the first two characters as the day, characters 4 & 5 as the month, and the last four characters as the year. Because these are still text values (even though they are digits), we must use the INTEGER model to convert them to integers. We can then plug these three integer values into the DATE OF( day, month, year ) model to obtain a valid HotDocs date value. The computation will return this date value, or you can SET a date variable to this value.

Number Fields. Amicus exports custom number fields as a string of digits without any separating punctuation except for a decimal point. So 3,000 would be exported as 3000, and 2,500.75 as 2500.75. Using the INTEGER model we can easily obtain an integer value of everything up to the decimal place. But if there is a decimal value, it will need to be extracted manually and added on.

Extracting the decimal value requires two temporary variables, Temp-n, a number variable, and Temp-t, a text variable (be sure to set their Advanced options to "Don't warn if unanswered," "Ask only in dialog," and "Don't save in answer file").

To extract the decimal value, we first look to see what the string position of the decimal is with the POSITION model, and SET this value in Temp-n. Next we take all of the characters in the Amicus custom field from this character position forward with the LAST model, and SET Temp-t to this string. We then need to convert this string to an integer value with the INTEGER model. At this point we have a non-decimal integer. For example, if the decimal value was .25, we now have an integer value of 25. To convert this to a decimal value, we must divide by some power of 10: 10 for a decimal value one digit long, 100 for a decimal value two digits long, etc. We can do this by using the POWER model to obtain a value of 10 to the power of X, where X is the character length of the decimal string. We divide our integer by this value to make it a decimal, and add the resulting decimal value to our RESULT.

A HotDocs number value is returned. You can also SET a number variable to this value if you wish.

True/False Fields. Amicus exports custom true/false fields as simply "TRUE" or "FALSE" (text values). This makes it easy to convert the custom field to a HotDocs True/False value. The example above shows how it is done. The computation will return either TRUE or FALSE. It can also be made to SET a True/False variable to TRUE or FALSE.