Skip to main content
Solved

Performing Multiplication in Jinja for Pipelines

  • March 1, 2023
  • 0 replies
  • 1298 views

Forum|alt.badge.img+16

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
------------------------------

Best answer by DougHenning1

Round to 2 decimals: {{ "%.02f" | format(MyField * 0.68) }}



------------------------------
Doug Henning
------------------------------

  • Quickbase Alumni
  • March 2, 2023

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:

{{ MyField * 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
------------------------------

  • Quickbase Alumni
  • March 2, 2023

Just to elaborate, you would drag your [MyField] field from the pre-populated list on the right side into the field that you want the calculation to occur in. This will automatically format the field name for you by putting the appropriate step number a. or b. etc along with the {{ }} in the correct position



------------------------------
Shane Miller
------------------------------