Question

IF Else Statements in Message Body

  • 13 January 2022
  • 1 reply
  • 484 views

Hey,

is it possible to modify the message body (for example a discord message) with given fields?

For example i’ve compared two Dates (with Date / Time Compare Dates), the result is now:
Days 3
Hours: 22
Minutes: 5

In the Message Body i would like to say:
Event starts in 3 Days, 22 Hours, 5 Minutes
or
Event starts in 2 Hours, 10 Minutes
or
Event starts in 5 Minutes

So i need to say
{if $OutputDays > 0}$OutputDays Days, {endif}{if $OutputHours > 0}$OutputHours Hours, {endif}{if $OutputMinutes > 0}$OutputMinutes Minutes{endif}

Otherwise it would be
Event starts in 3 Days, 22 Hours, 5 Minutes
or
Event starts in 0 Days, 2 Hours, 10 Minutes
or
Event starts in 0 Days, 0 Hours, 5 Minutes

How can i resolve this?


This post has been closed for comments. Please create a new post if you need help or have a question about this topic.

1 reply

Userlevel 7
Badge +14

Hi @Svenbo 

This can be done using a Code step: https://zapier.com/apps/code/help

Or try using using the Formatter > Text > Spreadsheet Style Formula:

Articles:

https://zapier.com/help/create/format/use-spreadsheet-style-formula-functions-in-zaps

https://zapier.com/help/create/format/understand-spreadsheet-style-formula-functions