- TLC Home Home
- Discussions Discussions
- Documentation Documentation
- Knowledge Base Knowledge Base
- Education Education
- Blog Blog
- Support Desk Support Desk
Hi -
when writing conditional logic on a Set Data Values extension, what is the difference between "is not defined" and "is not populated"?
I would like to set something like this...
set variable_A (js_page) to variable_B (UDO var)
when variable_A (js_page) is not set
AND variable_B (UDO var) is set
thanks, John
09-06-2017 03:25 PM
Is not defined means the variable is declared. Whether or not its value is empty is not of importance. An example of a defined variable is:
var variable_A;
Is not populated means that variable is declared AND that it has a value. An example of a populated variable is:
var variable_A="test";
In your case I would do:
set variable_A (js_page) to variable_B (UDO var)
when variable_A (js_page) is not defined
AND variable_B (UDO var) is defined
AND variable_B (UDO var) is populated
This will ensure variable_B exists with a valid value before updating variable_A.
Cheers,
-Dan
09-14-2017 01:51 AM
To give a more technical response to your question I would say,
Is Not Defined would be evaluated as,
(typeof d['your_variable_here'] == 'undefined')
and Is Not Populated would be evaludated as,
(typeof d['your_variable_here'] != 'undefined' && d['your_variable_here'] == '')
09-14-2017 05:51 AM
09-14-2017 05:51 AM
09-14-2017 09:58 AM - edited 09-14-2017 10:36 AM
@john_gautreau @Yoosuf @dan_george
To add on to the other answers: the actual JavaScript code generated by each condition is documented here: Generated JavaScript Code for Load Rule/Extension Conditions
Copyright All Rights Reserved © 2008-2023