LET Command

LET — Assign a value to a data reference.

Synopsis

LET dest_data_ref = src_data_ref [src_data_ref...]

LET dest_data_ref = num_data_ref [calculation-operator/function num_data_ref...]

LET dest_data_ref = CALL logic_name [logic_argument...]

LET dest_data_ref = CALCDATE src_data_date_ref1 DIFF src_data_date_ref2

LET dest_data_date_ref = CALCDATE src_data_date_ref { + | - } { DAYS | WEEKS | MONTHS } num_data_ref

LET dest_data_ref = CALCDATE src_data_date_ref { DOW | WEEKNUM }

Introduction

The LET command assigns a value to a data reference. This can be a simple copy, the result of a (date) calculation, a concatenation or the return value from a called logic block.

Date calculations can be initiated by using the CALCDATE argument. The following calculations are possible:

  • DIFF: This gives the number of days between 2 dates. 0 means the dates are the same, < 0 means the left date is earlier than the right date and > 0 means the left date is later than the right date.

  • +/- DAYS/WEEKS/MONTHS: add/subtract n number of DAYS/WEEKS/MONTHS from the given date and return the result as a date.

  • DOW: Returns the Day Of Week (0=Sunday, 6=Saturday).

  • WEEKNUM: Returns the number of the week of the year of the date given.

Arguments

dest_data_ref

Data item which will get a value assigned to. This can either be a simple copy from another data reference, or this can be the result of a calculation. The data item has to be an existing data item and can not be a read-only item like a string for instance.

dest_data_date_ref

Data item which will get a date value assigned to. This will be the result of a date calculation. The data item has to be an existing data item and can not be a read-only item like a string for instance.

src_data_ref

Data item where the value will be copied from. The data item can either be an existing data item, a string or a numeric value.

src_data_date_ref

Data item being a valid date in a date format where the value will be copied from. The data item can either be an existing data item, a string or a numeric value.

num_data_ref

Numeric data item where the value will be used in a (date) calculation. The data item can either be an existing data item or a numeric value.

logic_name

Name or single data reference holding a name of a logic block to be called. The returned value of this logic block will be moved into the dest_data_ref.

logic_argument

Optional argument(s) of the called logic block.

calculation operator

++ -- ! ~ unary + -
**
* / %
+ -
<< >> >>>
< <= > >=
== !=
&
^
|
= += -= *= /= %= <<= >>= >>>= &= |= ^= **=

calculation function

absacosasinatanatan2cos
coshexpintfloatloglog10
primesinhsqrttantanh 

Note

calculation functions values need to be surrounded by round brackets. ie: sin(1234)

Example

. . .
. . .
LET L-String = "Hello " V-Name "."
. . .
LET L-Counter = 10
. . .
LET L-Total = L-SubTotal + L-Tax
. . .
LET L-OrderNumber = CALL GetOrderNumber
. . .
LET L-RenewalDate = CALCDATE L-ExpiryDate + MONTHS 1
. . .
LET L-WeekNumber = CALCDATE L-CurrentDate WEEKNUM
. . .
. . .

Related Commands

CALL