cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

How can I set a defined variable to NULL?

SOLVED
chrish
Newbie

How can I set a defined variable to NULL?

I need to be able to reset a variable (specifically a UserSession variable/property) to NULL so that the behavior of my mashup is predictable.

I've tried:

newObject.username = NULL;

But this syntax throws a runtime error that "NULL" isn't defined.

Thanks for the help.

1 ACCEPTED SOLUTION

Accepted Solutions

Re: How can I set a defined variable to NULL?

Stefan / Carlos, I actually figured this one out with a little trial and error. The keyword is actually "null" (all lower case). You can actually set a property to "null". I did it successfully; to the point that a Mashup Validate widget correctly evaluated an expression UserName=null as TRUE.

HOWEVER!!!  The exception to this is SESSION properties. Once set; they will not reset to null without restarting browser (session). If you set them to "null"; they are simply set to "" (which is useful knowledge in it's own way). Hope this helps!  It certainly did me.

View solution in original post

3 REPLIES 3

Re: How can I set a defined variable to NULL?

I'm not sure, but I assume the "NULL" must be "undefined". Have seen this in some JAVA scripts.

Re: How can I set a defined variable to NULL?

I think it's not possible, I usually face this need too, but there's no way to "undefine" or set to null to an already set property.

Re: How can I set a defined variable to NULL?

Stefan / Carlos, I actually figured this one out with a little trial and error. The keyword is actually "null" (all lower case). You can actually set a property to "null". I did it successfully; to the point that a Mashup Validate widget correctly evaluated an expression UserName=null as TRUE.

HOWEVER!!!  The exception to this is SESSION properties. Once set; they will not reset to null without restarting browser (session). If you set them to "null"; they are simply set to "" (which is useful knowledge in it's own way). Hope this helps!  It certainly did me.

View solution in original post

Announcements

Check out the upcoming Expert Session: Understanding ThingWorx Navigate Licensing in Community "Customer Events" section.