Data Processing

Here is place that will be updated with Data processing scripts and tips.

IF statement
The if statement can be used in data processing rules.

If you are writing a script for a DP Rule you only need to declare the variable if you are “getting” the contents and then doing something with it. Use the variable direct if you are “setting” it.
var now : DateTime = DateTime.Now;
if (Test_start<=now){
Mainstatus = '4';
}
Mainstatus & Test_Start are both in the “Available Variables” list on the right handside.

Add days to a date and out in format DD-MONTH-YEAR

This code will add X days to a date and output as DD-MONTH-YEAR format

Var1 and Var2 need to be defined on the righthand side of the rule

var originalDate = GetValue('VAR1');
var newDT = originalDate.AddDays(133);
Var2 = newDT;
var monthnum= newDT.Month;
var monthTxt = ['January', 'February', 'March', 'April', 'May','June', 'July', 'August', 'September','October','November','December'];
var monthName = monthTxt[monthnum-1];
Var2 = newDT.Day +' '+ monthName+ ' '+ newDT.Year;

Checking if date is greater than another.

var derD: DateTime = DER_DOLC;
var dDate : DateTime = new DateTime(“2019”, “06”, “01”);
if(derD >= dDate)
{

}