how to cast a context variable

I create a new document Type called calcul1 with field1 type double with field2 type double in the scheme I create an other field named total In the edit form I create a button called add which sould add field1 + field2 when total is declared as string I get the good result When total is declared as double I get an error the chain is : FETCH>DOCUMENT EXECUTION CONTEXT > SET CONTEXT VARIABLE name=field1 value=@{Document[“calcul1:champ1”]} EXECUTION CONTEXT > SET CONTEXT VARIABLE name=field2 value=@{Document[“calcul1:champ2”]} and then I declare : DOCUMENT > UPDATE PROPERTY value = @{Context[“field1”]} + @{Context[“field2”]} xpath = calcul1:total

i have got a good result when total is declared as a string( xxx+oooo ) but nothing when declared as a double, and I need a doubled summ in this field thanks for help Raymond

0 votes

2 answers

2930 views

ANSWER



thank's alot for this explanation Raymond

0 votes



There is a much simpler way to do this:

FETCH>DOCUMENT
DOCUMENT > UPDATE PROPERTY 
  value = @{Document["calcul1:champ1"] + Document["calcul1:champ2"]}
  xpath = calcul1:total

Your issue comes from here:

DOCUMENT > UPDATE PROPERTY value = @{Context[“field1”]} + @{Context[“field2”]} xpath = calcul1:total

Value will be evaluated as a string if you have @{Context[“field1”]} + @{Context[“field2”]} instead of @{Context[“field1”] + Context[“field2”]}

0 votes