Applied Users Forums

General Topics => Helpline => Topic started by: JohnGage on July 14, 2010, 02:44:00 PM

Title: TAM formletters and math functions
Post by: JohnGage on July 14, 2010, 02:44:00 PM
I recall there being a way to perform simple computations in Word to make form letters somewhat dynamic.  In a letter I would like to insert the term previous to what appears on the bill screen.  Anyone suggestions on where to get started?

Ex. Year (eff date)-1 "-" Year(exp date)-1
Title: Re: TAM formletters and math functions
Post by: Andrew Carrick on July 19, 2010, 06:59:22 AM
I think you can only do calculations within a table in Word (I guess it's a sort of mini-Excel worksheet), which is Ok since you can hide the gridlines. Not sure how to code the action you need though, sorry.
Title: Re: TAM formletters and math functions
Post by: Lance Bateman on July 19, 2010, 01:25:03 PM
Quote from: JohnGage on July 14, 2010, 02:44:00 PM
I recall there being a way to perform simple computations in Word to make form letters somewhat dynamic.  In a letter I would like to insert the term previous to what appears on the bill screen.  Anyone suggestions on where to get started?

Ex. Year (eff date)-1 "-" Year(exp date)-1
Have to remember that Applied has dates as non-numeric (string) fields.  So before you could do math, you need to convert the date to a number, then work with it - or strip out the year (don't use the "year(date)" coding, use the substring function), then convert that to a number - before you could do math on it.
Title: Re: TAM formletters and math functions
Post by: JohnGage on July 19, 2010, 01:41:04 PM
Below is a response I received on the other forum.  Out of the box it isn't working but I haven't taken much time to figure out why.


First assign the value of the expiration date to a variable named TARGET (you can use any name you like for this):

{ SET TARGET <EXPDATE> }

Next pull the year out of TARGET and increase it by 1, and assign the new value to a variable named YEAR:

{SET YEAR { = {REF TARGET \@ yyyy } + 1 } }
Note that we are using the date formatting options to get the year.

Since the day and the month aren't changing, assign the current values to variables named DAY and MONTH:
{SET DAY { = {REF TARGET \@ d } } }
{SET MONTH { = {REF TARGET \@ MMMM } } }

Now build the new date using the field QUOTE, the variables DAY, MONTH and YEAR, and the date formatting option wanted:
{QUOTE "{REF MONTH} {REF DAY}, {REF YEAR}" \@ "MMMM d, yyyy" }