AnsweredAssumed Answered

Dates (as text). Data Viewer evaluates differently to Set Variable

Question asked by gergnnud on Nov 30, 2018
Latest reply on Dec 5, 2018 by comment

I have created a custom function that returns a list of three dates to establish a relationship key for gathering a subset of data from the related table.

 

custom Function: DatePrevCurNext

 

Let ([

theDate = "2018-01-29" ; //Substitute for function parameter to evaluate in the Data Viewer (ISO formatted)

d = Right ( theDate ; 2 );

m = Middle ( theDate ; 6 ; 2 );

y = Left ( theDate ; 4 );

dateCur = Date ( m ; 1 ; y );

datePrev = Date ( m - 1 ; 1 ; y );

dateNext = Date ( m + 1 ; 1 ; y )

];

datePrev

&¶& dateCur

&¶& dateNext

)

 

returns in the dataviewer correctly as:

 

1/12/2017

1/01/2018

1/02/2018

 

returns incorrectly when setting a variable or a field in a script:

 

Set variable $datePCN DatePrevCurNext ( $date ) where $date = “2018-01-29”

 

1/12/2017

1/1/2018

1/2/2018

 

This breaks the relationship key. I have tried GetAsText without success. Any thoughts?

Outcomes