Shane,
Regarding the field properties, I did have that set, and so it works when viewing the record (field rounds to 2 decimals). However, if you are editing the record, the field still shows the initial input, which in my case was autofilled from the pipeline and had 4+ decimals. While maybe no one would notice, my OCD really wanted it filled with only 2 decimals :)
Regrding your syntax, I agree that should work but for some reason, it is not working. round(2) in all documentation I googled seems to be what I would want, though it simply did nothing. However, Dougs solution did work.
Happy to have a solution, but that solution is the least intuitive thing I have ever seen lol.
Also, this entire time I could have simply made a field in my QB table, and had that field populate during my pipeline, but I really wanted to learn the proper Jinja code to do it without adding that field.
------------------------------
Mike Tamoush
------------------------------
Original Message:
Sent: 03-02-2023 17:21
From: Shane Miller
Subject: Performing Multiplication in Jinja for Pipelines
You're gonna laugh... well, or cry, depending on how long you've worked on this. go to the outcome fields properties.
Change this to 2 for 2 decimal places:
------------------------------
Shane Miller
Original Message:
Sent: 03-02-2023 17:13
From: Doug Henning
Subject: Performing Multiplication in Jinja for Pipelines
Round to 2 decimals: {{ "%.02f" | format(MyField * 0.68) }}
------------------------------
Doug Henning
Original Message:
Sent: 03-02-2023 16:58
From: Mike Tamoush
Subject: Performing Multiplication in Jinja for Pipelines
Any idea the syntax to round the number to 2 decimals?
I tried {{MyField * 0.68 | round(2) }} but this did not work.
------------------------------
Mike Tamoush
Original Message:
Sent: 03-02-2023 14:06
From: Mike Tamoush
Subject: Performing Multiplication in Jinja for Pipelines
I mistyped in my post. I should have said I tried {{MyField * .68}} and it would not work.
However, {{MyField * 0.68}} DOES work! Thank you! Turns out that leading zero is important.
------------------------------
Mike Tamoush
Original Message:
Sent: 03-02-2023 13:14
From: Shane Miller
Subject: Performing Multiplication in Jinja for Pipelines
Assuming that [MyField] is a variable in your Jinja2 template that contains a numeric value, you can use the following expression to multiply it by 0.68:
This expression multiplies the value of [MyField] by 0.68 and returns the result as a new value. The result will be a float value if [MyField] is a float, or an integer value if [MyField] is an integer.
------------------------------
Shane Miller
Original Message:
Sent: 03-01-2023 18:11
From: Mike Tamoush
Subject: Performing Multiplication in Jinja for Pipelines
I am trying to set a field to
[MyField] * .68
I tried this:
{{a.MyField .68}} but that syntax wont even save. I also tried {{My.Field}}*.68. This saves, but produces an error when the pipeline runs. I know I could make a field in my Trigger table that does this calculation, but I would rather learn how to multiply in Jinja!
------------------------------
Mike Tamoush
------------------------------