TAM formletters and math functions

Started by JohnGage, July 14, 2010, 02:44:00 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

JohnGage

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
John Gage
Systems Admin
Knight Crockett Miller Insurance Group - Toledo, OH
4 locations in Ohio and Indiana

53 users TAM Online

Andrew Carrick

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.
Jelf Insurance Partnership
Hull, East Yorkshire, UK
Me and TAM used to have a thing but we've split amicably. She got the kids, I got the Camaro and the maid.

Lance Bateman

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.

JohnGage

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" }
John Gage
Systems Admin
Knight Crockett Miller Insurance Group - Toledo, OH
4 locations in Ohio and Indiana

53 users TAM Online