Strategy automatically converts Date value to DateTime value
Pega Marketing 7.4 is installed on Pega 7.4.
A Strategy automatically converts a Date value to a DateTime value. On running a Campaign using this Strategy, the Date value persists to the BatchOut table as a truncated string with a plus symbol. This occurs post updating Pega 7.1.8 to Pega 7.4.
Consider a Strategy containing two Set Property components in Pega 7.4.
The first Set Property sets the value for a Date type property (For eg: DateProperty1 = '20190131').
The second Set Property component uses a function such as @weekday to which the Date type property (DateProperty1) is passed as input.
By default, the Strategy processes any Date value and converts it to DateTime. This Date value persists to the Batchout table as a truncated string appended with a plus symbol (that is, 2019013+).
In Pega 7.1.8, the Date value persists to the database correctly as a complete Date value without any plus character appended (for example, 20190131).
Steps to Reproduce
- Create a simple Strategy containing components as Proposition Data > Set Property > Set Property > Results.
- Set the Date property value in the first Set Property Component (for example, DatePropert1 as "20190222").
- Use the Date property as an input to a function such as @weekday (for example, Set .pyLabel as @weekday(.DateProperty1)).
- Run a Campaign using this Strategy. The value persists for the Date value in the BatchOut table.
An issue in the custom application code or rules.
According to the design, while processing the Date value, the Strategy converts it to a DateTime value. In the Batchout table, a Varchar(8) column is created which is based on the Date property type. However, when the converted DateTime string is persisted to the Date column with Varchar(8), the value is truncated and saved with a plus symbol appended to the Date value.
It is recommended to use the DateTime property instead of the Date property.
Perform either of the following local-changes:
- Map the Date property to a Strategy Result (SR) property to perform the calculations. Hence, the Date property does not change to DateTime and stays as a date.
- Recreate the Date property as a DateTime property instead of a Date property.
0% found this useful