Calculate in form Fields

13 views
Skip to first unread message

QFlexLogistik - Sebastian Bauer

unread,
Jan 22, 2023, 6:46:35 AM1/22/23
to Ultradox
Hello,

Does anyone have an idea how I can round off the result of a calculation in a form field?

my calculation looks like this, for example, 33 / 6 = 5.5 and it should be 5.

Daniel Florey

unread,
Jan 22, 2023, 7:00:15 AM1/22/23
to sebasti...@qflexlogistik.de, Ultradox
Hi,
you can use the number renderer to cut off the part after the comma like this:
${myresult;number(op=#)}
This will not do a proper rounding, it will just cut off the digits after the comma (e.g. 5.9 will become 5).
I'll try to add rounding to the number renderer next week.
Best,
Daniel

Mit freundlichen Grüßen / Kind regards

Sebastian Bauer
Triebfahrzeugführer, Disponent, Planung, IT




QFlexLogistik GmbH
Niederrheinstr. 7
40474 Düsseldorf

T        +49 (0) 211 90 99 3433
E        sebasti...@qflexlogistik.de

HRB 99042 Düsseldorf
Geschäftsführer: Claes Crasemann

--
You received this message because you are subscribed to the Google Groups "Ultradox" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ultradox+u...@floreysoft.net.
To view this discussion on the web, visit https://groups.google.com/a/floreysoft.net/d/msgid/ultradox/4fca41af-ae59-4168-bbdc-5859344ecdccn%40floreysoft.net.

QFlexLogistik - Sebastian Bauer

unread,
Jan 22, 2023, 7:06:36 AM1/22/23
to Ultradox, daniel...@gmail.com, Ultradox, sebasti...@qflexlogistik.de
Hi Daniel,

I followed this guide:

https://help.ultradox.com/en/guides/quickstarts/calculatevalues.html

and then I simply add a new line to the calculation?

Daniel Florey

unread,
Jan 22, 2023, 7:10:31 AM1/22/23
to QFlexLogistik - Sebastian Bauer, Ultradox
Ah, ok. If you are using JavasScript to do the calculation you could just use

Math.round(.  ....put your calculation here....     )

in the JavaScript code.
In your case something like
Math.round(33 / 6)
should do the trick (using variables instead of numbers).
Message has been deleted

QFlexLogistik - Sebastian Bauer

unread,
Jan 22, 2023, 9:46:21 AM1/22/23
to Ultradox, daniel...@gmail.com, Ultradox, QFlexLogistik - Sebastian Bauer
Hi Daniel,

unfortunately with math.round ( ${...} / $ {...} ) the result is 5.5 not 5 but 6, so mathematically rounded, I only need the number before the decimal point.

Daniel Florey

unread,
Jan 22, 2023, 12:26:58 PM1/22/23
to QFlexLogistik - Sebastian Bauer, Ultradox
You can use Math.abs() instead of Math.round() then.
Reply all
Reply to author
Forward
0 new messages