Expand my Community achievements bar.

Radically easy to access on brand approved content for distribution and omnichannel performant delivery. AEM Assets Content Hub and Dynamic Media with OpenAPI capabilities is now GA.

Calculate

Avatar

Level 1

My first day with Live Cycle... I have two numeric fields that i want to subtract. How do I do it?

5 Replies

Avatar

Level 10

Use the following code to get the subtraction..

NumericField1.rawValue - NumericField2.rawValue

Your language should be FormCalc.

Thanks

Srini

Avatar

Level 1

Thank you so much for answering! WHERE do I write the code?

Avatar

Level 10

It usually depends on your requirement. If you want the subtraction happen when the user leaves any of NumericField then you need to place it in the exit event of both the NumericFields.

At the same time you need to find where to display the subtracted value. If you want to display the subtraction in another NumericField. Then your code will look like:   NumericField3.rawValue = NumericField1.rawValue - NumericField2.rawValue;

If you want the Subtraction happen on a button click, move the code to click event of the button..

Hope this gives an idea..

Thanks

Srini

Avatar

Level 1

Hi AktivOrtopedteknik,

Could you please send the requierments because there are too many cases you can do scripting for almost 10 different events. So to better help you send the requierments so I can tell what is the best route.

Thank you,

Avatar

Level 1

Almost ashamed to tell you but when I meant WHERE to write the code I asked in wich field to type it. Not in the form but in the program... But I found it myself! The scriptwrite window was hidden... I confess: I'm a woman, blond and Swedish! But I couldn't have maked it work without you telling me how to type the code! Thank you so much! I will probably be back here soon with silly questions! If you dont ask, you won't learn!!!