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

Community Tip - Did you get called away in the middle of writing a post? Don't worry you can find your unfinished post later in the Drafts section of your profile page. X

How can I set a defined variable to NULL?

chrish
1-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
chrish
1-Newbie
(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

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
1-Newbie
(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.

Top Tags