Monthly Archives: November 2011

Tips & Tricks #11

Scripting Appends

When scripting appends, you can ensure that duplicate records will not occur even if the script is ran multiple times for the same period or other categorization.

For example, append the following fields to a yearly file in a script intended to be ran monthly:  Month, Location, Average_Lbs.

It would look similar to this:

EXTRACT Month Location Average_Lbs TO “A_Year_Avg_Per_Lb.fil” APPEND OPEN

If this is ran more than once in the same month, the monthly information would appear more than once. Add a summarization with no subtotals to all appends to eliminate this problem.

SUMMARIZE ON Month Location OTHER Average_Lbs TO “Final_A_Year_Avg_Per_Lb.fil” PRESORT

.

Tips & Tricks #10

Blank Lines in scripts?

Use a blank line under the define line to indicate a conditional computed field.

DEFINE FIELD TEST COMPUTED

(blank line)

“Yes” IF test1 = “A”

“No” IF test1 = “B”

“Bad”

Also use a blank line to end a multiline comment section.

COMMENT

Line 1

Line 2

Line 3

(blank line)

code