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

Completion status with nested if statements?

Avatar

Level 2

I need something similar to the following script that is not working:

In theory, I would put the script in the "calculate" event of a text field called "Completion Status."

if(Subform.TextField1.rawValue !== null && Subform.TextField2.rawValue !== null && Subform.TextField3.rawValue !== null &&

Subform.TextField4.rawValue !== null &&

((TableSubform.Table.Row1.TextField5.rawValue == null && (TableSubform.Table.Row1.TextField6.rawValue == null && (TableSubform.Table.Row1.TextField7.rawValue == null) ||

((TableSubform.Table.Row1.TextField5.rawValue !== null && (TableSubform.Table.Row1.TextField6.rawValue ==  "Yes" && (TableSubform.Table.Row1.TextField7.rawValue == null) ||

((TableSubform.Table.Row1.TextField5.rawValue !== null && (TableSubform.Table.Row1.TextField6.rawValue ==  "No" && (TableSubform.Table.Row1.TextField7.rawValue !== null)) &&

((TableSubform.Table.Row2.TextField5.rawValue == null && (TableSubform.Table.Row2.TextField6.rawValue == null && (TableSubform.Table.Row2.TextField7.rawValue == null) ||

((TableSubform.Table.Row2.TextField5.rawValue !== null && (TableSubform.Table.Row2.TextField6.rawValue ==  "Yes" && (TableSubform.Table.Row2.TextField7.rawValue == null) ||

((TableSubform.Table.Row2.TextField5.rawValue !== null && (TableSubform.Table.Row2.TextField6.rawValue ==  "No" && (TableSubform.Table.Row2.TextField7.rawValue !== null))

)

{

this.rawValue="Complete";

} else {

this.rawValue="Not complete"

Basically, I have a form with four fields on top that need to be completed. Then, I have a three column table (first row being the header) with two rows of fillable text fields with the following rules in order for the form to be deemed complete:

If TextField5 is blank, then TextField6 and Textfield7 do not need to be filled in

If TextField5 is not blank, then TextField6 needs to be filled in with "Yes" or "No"

If TextField6 is "Yes," then TextField7 does not need to be filled in

If Textfield6 is "No," then TextField7 does need to be filled in

Please let me know where my script went wrong! Thanks!

0 Replies