Best answer

Increase the number with FORMATER


Userlevel 1

Hello Goodnight. I have a question, I am using the FORMATER but I am not managing to do something. I have numbers from 1 to 4. I want each zapier to increase the number. If the previous one was 1, the next zapier, it will be 2. Until it reaches 4. Then it returns to 1 again. How could I do it? :) Thank you

icon

Best answer by ikbelkirasan 8 May 2021, 01:26

@rafaelzarro - This can be solved easily with a JavaScript code step.

const currentNumber = Number(inputData.number);
const maxNumber = Number(inputData.maxNumber);
const nextNumber = (currentNumber % maxNumber) + 1;

return [{ nextNumber }];

 

View original

2 replies

Userlevel 7
Badge +11

@rafaelzarro - This can be solved easily with a JavaScript code step.

const currentNumber = Number(inputData.number);
const maxNumber = Number(inputData.maxNumber);
const nextNumber = (currentNumber % maxNumber) + 1;

return [{ nextNumber }];

 

Userlevel 1

Ohhh really thank you very much !!!! amazing

Reply