Expand my Community achievements bar.

SOLVED

Data Element - Empty String Default Value Bug?

Avatar

Level 1

Setting default value for data element 'JavaScript Variable' when the actually JS value is an empty string doesn't return the 'Default Value' is set within the data element. An empty string is returned instead. Since an empty string is considered to be a false type in JS, developers might expect then to rely on the 'Default Value' to be populated instead. 

 

Is anyone else experiencing this? If so, this should be updated if the JS path resolves but return an empty string vs a ref error, then the data element should fallback on the default value. 

 

mikeb55262024_0-1579112138976.png

Topics

Topics help categorize Community content and increase your ability to discover relevant content.

1 Accepted Solution

Avatar

Correct answer by
Level 4

Default Values get populated on Launch based off:

 

  • typeof VARIABLE returns "undefined"
  • VARIABLE returns "null"

A blank string is technically a blank string and that would just return naturally.

 

So the best way is to run a Custom Code and return null when it comes to a blank string.

View solution in original post

1 Reply

Avatar

Correct answer by
Level 4

Default Values get populated on Launch based off:

 

  • typeof VARIABLE returns "undefined"
  • VARIABLE returns "null"

A blank string is technically a blank string and that would just return naturally.

 

So the best way is to run a Custom Code and return null when it comes to a blank string.