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

Community Tip - Stay updated on what is happening on the PTC Community by subscribing to PTC Community Announcements. X

How can I set a defined variable to NULL?

chrish
12-Amethyst

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.

ACCEPTED SOLUTION

Accepted Solutions
chrish
12-Amethyst
(To:chrish)

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
StefanBode
12-Amethyst
(To:chrish)

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

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.

chrish
12-Amethyst
(To:chrish)

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.

Announcements


Top Tags