Expand my Community achievements bar.

Guidelines for the Responsible Use of Generative AI in the Experience Cloud Community.

Change event formCalc rawValue not working?

Avatar

Level 2

Hi

I have a question, I have a date/time field with change event field (in formCalc). In the change event is the following script:

DATE1.rawValue = Num2Date(Date2Num(xfa.event.newText,"DD-MMM-YY")+(NUMBER-12),"DD-MMM")

DAY1.rawValue = Num2Date(Date2Num(xfa.event.newText,"DD-MMM-YY")+(NUMBER-12),"EEE")

The NUMBER is a calcalated decimal field that find difference between two date where the person pick beforehand. However this is where my question is, how can I use that value in change event?

I have search with google and through the discussion and found that change event must use

     NUMBER.rawValue = xfa.event.newText

and I tryed this

     num = xfa.event.newText

     Number = num

but it does not work. Please advise on what to do?


1 Reply

Avatar

Level 10

The change event represents the value currently typed into a field. This meas not the entire value but the value since the last keystroke.

For example:

When you enter todays date 01/21/13 then the change event occurs 8 times because you make 8 changes to the field (0, 1, /, 2, 1, /, 1 and 3).

So, you script won't work here as the Date2Num method cannot resolve a valid number from the values returned from newText with the give date pattern.

You should use your script at the fields the exit:Event instead.