I am using fn!cdtcomparison() function to find difference between two cdts. However, the result is converting date attribute to text with format 'yyyy-mm-dd hh:mm:aa'.
Can someone tell me how to detect and reformat it to datetime it in as it can be any attribute within the cdt.
Discussion posts and replies are publicly visible
Hello TJ ,
What exactly you want to achieve with that comparison results? isn't enough to know that something changed and pick the value from the source cdt?
or Maybe you are looking for the function datetext( "2011-03-23 07:00:02", "yyyy-mm-dd hh:mm:aa" )?
hope this helps
Jose
Hello TJ,
Below code is sample for you, hope this will help.
a!forEach( items: cdtcomparison( {dateOne: now()}, {dateOne: now()+1} ), expression: { if( fv!item.attributeName = "dateOne", { attributeName: fv!item.attributeName, isDifferent: fv!item.isDifferent, previousValue: text( fv!item.previousValue, "MM/DD/YYYY HH:MM" ), currentValue: text( fv!item.currentValue, "MM/DD/YYYY HH:MM" ) }, fv!item ) })
Unknown said:datetext( "2011-03-23 07:00:02", "yyyy-mm-dd hh:mm:aa" )
Hi Jose,
This function with literals is not working for me. I just need to identify if a key-val in dict is supposed to be of date type. If yes then convert it back to date before casting back into cdt.
TJ, is above code work for you?