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

if statement

Avatar

Level 1

How can I combine these 2 pieces of script to make an if statement fire only if both parts are true?

if ((Date2.rawValue == null) || (Date2.rawValue == ""))

if (NumStop.rawValue < NumStart.rawValue)

I can make it work with either seperatly but can't seem to figure out how to make them play togeather, I thought i could just stick "&&" between them but I have tried every way I can image and it isnt working.

thanks

1 Accepted Solution

Avatar

Correct answer by
Level 10

Hi,

Should be as simple as;

if ((Date2.rawValue == null || Date2.rawValue == "") && NumStop.rawValue < NumStart.rawValue)

But you don't need the Date2.rawValue == "" part anyway as an empty string will be converted to a null, try this instead;

if (Date2.isNull && NumStop.rawValue < NumStart.rawValue)

Regards

Bruce

View solution in original post

2 Replies

Avatar

Correct answer by
Level 10

Hi,

Should be as simple as;

if ((Date2.rawValue == null || Date2.rawValue == "") && NumStop.rawValue < NumStart.rawValue)

But you don't need the Date2.rawValue == "" part anyway as an empty string will be converted to a null, try this instead;

if (Date2.isNull && NumStop.rawValue < NumStart.rawValue)

Regards

Bruce

Avatar

Level 1

ThanKs Bruce, that worked great