Text Helper (Uppercase) & Maths Helper (Rounding Numbers)

Hello,

  1. How do we make text uppercase?
  2. How can we round decimal places (e.g. after a currency conversion)?

Thank you.

Hi @BharatKaravadra,

I suggest using inline Javascript in your inputs. You can refer to any step and use a Javascript function to modify the output.

  1. Do this: {{ step_x.path.to.data.toUpperCase() }}
  2. Do this: {{ Math.round(step_x.path.to.data * 100) / 100 }}

Let me know if this doesn’t work for whatever reason!

Hello @ashrafsam , thanks for the advice but I can’t see where to add the Javascript.

With regards to rounding, see here: Farming Currency - Activepi... for a currency conversion where the value of 18.966 is to be rounded.

And here: Farming Currency - Activepi... is where values are inserted into the body of an email.

So, where is the Javascript added, and then how do I pull the rounded value?

At your links it says: The step_slug can be found by moving your cursor over any of your flow steps, it will show to the right of the step.

But I can’t find anything on a rollover to add the Javascript. Once I can do this, the Uppercase and other use of Javascript should be simple enough.

Thank you.

for a currency conversion where the value of 18.966 is to be rounded.

You can use the code block with Typescript. The following code rounds a number to two decimal places.

exports.code = async (params) => {
    // Ensure 'money' is treated as a number
    const money: number = Number(params.money);
    const roundedMoney: number = parseFloat(money.toFixed(2));
    // Return the rounded value
    return { roundedMoney };
};

What do you want mean with

Regarding your question on making text uppercase:

Could you specify how you’d like to transform the text? There are different ways to capitalize text: FULL CAPS, Capitalizing Every First Letter, or just the first letter, etc.

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.