Highlighted

What does the 'is populated' condition mean?

I'm triggering events on the condition that variables are present in a data layer. However, when the variable has no value, it has been assigned an empty string, rather than being left out. Therefore, if we use the 'is defined' condition, the variable is always defined, so it fires the event regardless of if the variable has a value. I'm wondering what the definition of the 'is populated' is and if it can be used to get around this?
4 REPLIES 4
Highlighted

What does the 'is populated' condition mean?

Employee Emeritus
Hey Sean, The is populated condition will check if the variable is defined then it will check and make sure that it contains a value and does not equal an empty string. The is defined condition will only check if if the variable is defined and not worry about what the value is. variable_1 = "" -> is defined returns true, is populated returns false variable_2 = "foo" -> is defined returns true, is populated returns true
Highlighted

What does the 'is populated' condition mean?

Tealium Employee
Hi Sean, 'is populated' checks for a non-empty string ( b.variable_name != "" ). You can combine two conditions for example: variable is 'is defined' and 'is populated' to satisfy your condition. Make sure to check if the variable is defined first before you check if it is populated. Thanks, Jasmine
Highlighted

What does the 'is populated' condition mean?

Bronze Contributor
Bronze Contributor

Hi,

 

Can I use "is not populated" to determine events where the parameter does not exist?

 

We have a tag say variable_1 that only executes on certain conditions. That is, it is absent from the set of tags for a particular page when it does not meet the criteria. I've added an extension that assigns an event_label=not_event1 where the condition is variable_1=is not populated.

 

Will the "is not populated" condition capture the events where variable_1 does not execute? Or do I need to use "is not defined" for this particular example.

 

Thanks for your help!

 

Update: I checked it using a web debugging tool and the "is not defined" should be used if you want to track tags/parameters that do not execute.  Sorry, I should have done that before posting my question here.

Highlighted

What does the 'is populated' condition mean?

Tealium Employee

@franzine_co just wanted to confirm that what you found is correct!

 

For future readers, let's assume you have the following object:

utag_data = {
page_name : "home page",
page_type : ""
}

 

Is defined:

page_name would evaluate to true, because the variable is declared in the utag_data object

customer_id would evaluate to false, because the variable is not declared in the utag_data object

 

Is not defined:

page_name would evaluate to false, because the variable is declared in the utag_data object
customer_id would evaluate to true, because the variable is not declared in the utag_data object

 

Is populated:

page_name would evaluate to true, because page_name has a value of "home page"

page_type would evaluate to false, because page_type has no value - meaning it's an empty string

 

Is not populated:
page_name would evaluate to false, because page_name has a value
page_type would evaluate to true, because page_type has no value