Sep 09, 2022 08:13 AM
Hi there! I am a little stumped on creating these 2 formulas with a few different layers. All of my Commuity requests are about Iff statements- they hurt my brain, but I love them!
If an If statement is not the best approach, please let me know :slightly_smiling_face:
Formula 1
Display the word “Block” if a status is blocked, and if it does not say “Block” it shows the date/time/type of the webinar. What am I doing wrong here?
If({Status})='Block','Block',
DATETIME_FORMAT(SET_TIMEZONE({Start Date/Time}, 'America/Los_Angeles'),'MM/DD/YY h:mm A PT')&"-"&{Type})
Second Formula
The second one works as is below but I want to add a second webinar type that would return the “Sponsor” name field in the results.
If the webinar type is Sponsor OR Sponsored Survey, display date-sponsor-topic, ELSE display “date-webinar type-topic”
IF({Webinar Type}='Sponsor',DATETIME_FORMAT(Date, "MM-DD-YYYY")&" - "&Sponsor&" - "&Topic, DATETIME_FORMAT(Date, "MM-DD-YYYY")&" - "& {Webinar Type}&" - "&Topic)
Any help would be appreciated, thank you! I get a little stumped when my formulas get complicated :slightly_smiling_face:
Sep 09, 2022 09:29 AM
Hey @beder!
Re. Formula #1
Hmmmm… how is your formula behaving right now, and how does it differ from what it should be doing?
I haven’t plugged it into a playground to test it, but in terms of syntax, it seems sound and follows the logic you described.
IF(
{Status} = "Block",
"Block",
DATETIME_FORMAT(
SET_TIMEZONE(
{Start Date/Time},
'America/Los_Angeles'
),
'MM/DD/YY h:mm A PT'
) & "-" & {Type}
)
Re. Formula #2
This formula follows the logic you described:
IF(
OR(
{Webinar Type} = 'Sponsor',
{Webinar Type} = 'Sponsored Survey'
),
DATETIME_FORMAT(
{Date},
"MM-DD-YYYY"
) & " - " & {Sponsor} & " - " & {Topic},
DATETIME_FORMAT(
{Date},
"MM-DD-YYYY"
) & " - " & {Webinar Type} & " - " & {Topic}
)
There are a few instances where I can see this formula behaving in a weird way, but at least in a vacuum, this formula hits those requirements.
Sep 09, 2022 11:38 AM
Thank you! That worked :slightly_smiling_face: