Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.
SOLVED

|= null test, returns a 0

Avatar

Level 3

Hi folks,

This is really frustrating.

I have the following script happening:

if(this.rawValue |= null)
    form1.Pg2.PtA3DescChk.rawValue = 1;

So if there's any text in the above field, a checkbox will be ticked.

That works fine, except if there is no text and I just tab through the field, a zero is displayed in the field.  I don't want it to fill anything into the empty field, just to test whether it has any text or not.

Can anyone help me to tidy this up?

Thanks,

Peta

1 Accepted Solution

Avatar

Correct answer by
Former Community Member

Change pipeline(|) to exclamation point(!), otherwise you'll be doing a bitwise-or assignment, and I don't think that's what you're going for... :>

View solution in original post

6 Replies

Avatar

Level 9

Hi Peta,

Have you set any validation for the field that shows zero ?

Thanks,

Bibhu.

Avatar

Level 3

Hi Bibhu,

No I haven't set up any Validation rules.  But you reminded me to check and no there are no validations.

Tx

Peta

Avatar

Level 9

Hi Peta,

I have given a link to your earlier post. Check it out.

I guess the current '0' problem is weird..

Have you set the field's value to be zero if it's null in the exit event ?

Thanks,

Bibhu.

Avatar

Correct answer by
Former Community Member

Change pipeline(|) to exclamation point(!), otherwise you'll be doing a bitwise-or assignment, and I don't think that's what you're going for... :>

Avatar

Level 9

Oops !!! I missed that symbol ...I need to go for an eye test ...

Avatar

Level 3

Me too Bibhu.

You were both right!

You c@tc.se with picking up my | instead of my !

And you Bibhu for fixing my other problem.

Thank you both soooooooooooooo much!!!

The following has evaluated to null or missing: ==> liqladmin("SELECT id, value FROM metrics WHERE id = 'net_accepted_solutions' and user.id = '${acceptedAnswer.author.id}'").data.items [in template "analytics-container" at line 83, column 41] ---- Tip: It's the step after the last dot that caused this error, not those before it. ---- Tip: If the failing expression is known to be legally refer to something that's sometimes null or missing, either specify a default value like myOptionalVar!myDefault, or use <#if myOptionalVar??>when-present<#else>when-missing. (These only cover the last step of the expression; to cover the whole expression, use parenthesis: (myOptionalVar.foo)!myDefault, (myOptionalVar.foo)?? ---- ---- FTL stack trace ("~" means nesting-related): - Failed at: #assign answerAuthorNetSolutions = li... [in template "analytics-container" at line 83, column 5] ----