Skip to content
Troubleshooting If-...
 
Notifications
Clear all

Troubleshooting If-statement with Airtable data in Text aggregator

12 Posts
2 Users
0 Reactions
6 Views
Trager
(@trager)
Posts: 6
Active Member
Topic starter
 

I have a bunch of information in an Airtable database wherefrom I send Weekly updates out.

I use a Text aggregator to create all the the info about each record that is sent out.

It looks something like this:

{{1.Client}}
<br>
{{1.Note}}
<br>
{{1.EmailNotificationName[]}}
<br>
<b>{{1.EmailNotificationTrigger1}}</b>
<br>
<b>{{1.EmailNotificationTrigger2}}</b>
<br>
do_not_remove_me
<br><br>

However sometimes the Note field is empty and create a weird empty row so I want the text aggregator to disregard this filed if it’s empty.

I’ve tried the below, but it’s creates an error, so not entirely sure what to do. Hope someone in here can guide me in the right direction.

{{1.Client}}
<br>
{{if(1.Note; 1.Note + "<br>"; "")}}

{{1.EmailNotificationName[]}}
<br>
<b>{{1.EmailNotificationTrigger1}}</b>
<br>
<b>{{1.EmailNotificationTrigger2}}</b>
<br>
do_not_remove_me
<br><br>
 
Posted : 20/06/2022 2:26 pm
JimTheMondayMan
(@jimthemondayman)
Posts: 7
Active Member
 

Try this:
{{if(1.Note != ""; 1.Note + "&lt;br&gt;"; "") }}


Jim - The Monday Man (YouTube Channel)
Watch Our Latest Video: Creating monday subitems using callin.io - The EASY Way
Schedule a 1-on-1 Tutorial Session

 
Posted : 20/06/2022 11:02 pm
Trager
(@trager)
Posts: 6
Active Member
Topic starter
 

Hi Jim, thanks for the reply. I attempted your suggestion, but it's still not truncating the note when the field is empty. Here's a copy-paste from the module:

{{1.Client}}

{{if(1.Note + "!=''"; 1.Note + " n"; "''")}}

 
Posted : 21/06/2022 5:44 am
JimTheMondayMan
(@jimthemondayman)
Posts: 7
Active Member
 

It appears you typed the text rather than using copy-paste.

The “!=” operator, which signifies "not equal to," should appear in green. You can select it from the General functions menu. Alternatively, to type it, you need to enter “{{!=}}” without the quotes.

Upon closer inspection, there seems to be an issue with the quotes as well.

Copying and pasting from my initial response would likely be the simplest solution.

 
Posted : 21/06/2022 11:19 am
Trager
(@trager)
Posts: 6
Active Member
Topic starter
 

Hi Jim

Apologies, it seems I only saw the Math functions previously. I've made the adjustment now, but it's still not functioning correctly. Please note that I've updated the field to one called 'season'. However, when an email is sent, the row without a season still appears blank.

 
Posted : 21/06/2022 1:26 pm
JimTheMondayMan
(@jimthemondayman)
Posts: 7
Active Member
 

Can you provide an example output when the Season is null versus when it is not null?

 
Posted : 21/06/2022 2:38 pm
Trager
(@trager)
Posts: 6
Active Member
Topic starter
 

Hi Jim
The email update is for updates of garment creation.
Sometimes a style will have a season assigned to it and sometimes it does not.

When null - it’s an empty field within the Airtable database, meaning no text is present.
When it’s not empty, it’ll contain text such as ‘Spring/Summer’ or ‘Pre Fall’.

So, the output in my test currently looks like this:

KNIT AND WOOL
Spring/Summer22
GSAK003 - LAMAINE MARL SLOUCH SWEATER
Delivery date has been moved ~ 1 day backwards.
FROM: 24/06/2022 TO: 25/06/2022
Jenny Parker

_

KNIT AND WOOL

_

KPS2319 - LOVE RETURN TURTLE NECK
Delivery date has been moved ~ 1 day backwards.
FROM: 24/06/2022 TO: 25/06/2022
Jenny Parker

Where the second instance has an empty season in the second row.

 
Posted : 22/06/2022 6:26 am
JimTheMondayMan
(@jimthemondayman)
Posts: 7
Active Member
 

At this point, I would verify that Season is indeed empty. Please try this:
{{if(length(1.Season) &gt; 0; "123" + 1.Season + "&lt;br&gt;"; "ABC")}}

 
Posted : 22/06/2022 11:07 am
Trager
(@trager)
Posts: 6
Active Member
Topic starter
 

It returns this:

_ KNIT AND WOOL
123 Spring/Summer22
GSAK003 - LAMAINE MARL SLOUCH SWEATER
Delivery date has been moved ~ 1 weeks forward.
FROM: 25/06/2022 TO: 16/06/2022
Jenny Parker_

__

KNIT AND WOOL
ABC KPS2319 - LOVE RETURN TURTLE NECK
Delivery date has been moved ~ 1 weeks forward.
FROM: 25/06/2022 TO: 16/06/2022
Jenny Parker

So it appears the second instance is empty - or at least lacks any text…

 
Posted : 22/06/2022 6:51 pm
JimTheMondayMan
(@jimthemondayman)
Posts: 7
Active Member
 

I'm uncertain about the specific change. However, if you now simply remove "123" and "ABC", it should function correctly.

 
Posted : 22/06/2022 8:38 pm
Trager
(@trager)
Posts: 6
Active Member
Topic starter
 

It does indeed work.

Thank you very much for guiding me through the debugging process.

 
Posted : 23/06/2022 11:22 am
JimTheMondayMan
(@jimthemondayman)
Posts: 7
Active Member
 

Glad I could assist!


Jim - The Monday Man (YouTube Channel)
We Create Custom Solutions
Schedule a 1-on-1 Tutorial Session

 
Posted : 23/06/2022 1:18 pm
Share: