AnsweredAssumed Answered

Strange "Validate Always" behavior with scripted variable…

Question asked by andrewggrant on May 5, 2011
Latest reply on May 5, 2011 by LaRetta_1

Title

Strange "Validate Always" behavior with scripted variable…

Post

I will try to explain what happened in detail. I am hoping someone can explain WHY it is happening.

In a Table, we created a field, set to Number type, with validation set to "Always", and strict data type of Number.

We then set a Variable ($ID_List) in a script to a number (I know variable only hold text). Next we used the script step of "Set Field" to set the newly created number field to the value of the Variable "AS A NUMBER" using the calculation:

GetAsNumber ( $ID_List ).

Immediately we get an error code of 502 for validation issue.

STEP 2.

After much head scratching, we experimented by removing the strict data type of number from the field and left validation to "Always". Still failed.

STEP 3.

Set the variable to a text string and changed the table field to a data type of "Text". Left validation to "Always" and removed the strict data type of number. Everything works.

Can anyone explain why this is happening? I understand that variables only hold text and that numbers put into a variable are stored as text. When I use the function of "GetAsNumber ( $ID_List )" I expect the text numbers to be treated as actual numbers. Why isn't this working?

Outcomes