Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

Adobe Summit 2023 [19th to 23rd March, Las Vegas and Virtual] | Complete AEM Session & Lab list
SOLVED

First time IF user - the lessor of two choices

Avatar

Level 1

Hey everyone -

I need your help.

Field1 - Allowance

Field 2 - TotalReceipts

Field 3 needs to show:

IF Field1 < Field2 then show Field1's amount

IF Field1 > Field2 then show Field2's amount

I've read the LCD Scripting Basics for ver 8, but I still can't get it right. I've tried so many things my head is spinning.  Can someone please help me?

Thanks

1 Accepted Solution

Avatar

Correct answer by
Level 10

Assuming you are using Javascript:

if (Allowance.rawValue < TotalReceipts.rawValue){

     Don't know what you mean by show ....but this is where that code woudl go

} else {

     show field 2 amount

}

You have not taken into account if th etwo fields are equal.

Paul

2 Replies

Avatar

Correct answer by
Level 10

Assuming you are using Javascript:

if (Allowance.rawValue < TotalReceipts.rawValue){

     Don't know what you mean by show ....but this is where that code woudl go

} else {

     show field 2 amount

}

You have not taken into account if th etwo fields are equal.

Paul

Avatar

Level 1

Thank you pguerett. This worked perfect.