Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.
SOLVED

Dynamically hide null responses

Avatar

Level 2

Hi all.

A bit of help with this problem I am having with the attached form.

Ideally with this form I would like to have my responses from my questions summarized under the appropriate header. 

So if the answer to the asked question is clicked as NC (Non-compliant) all NC answers will be listed under the text field labeled NC. This should follow for questions responses to PC too.

The way I have been doing it in the past is through "this.rawValue = Q1.Table1.Row1.TF2.rawValue + "\n" + Q1a.Table1.Row1.TF2.rawValue" for all my questions, with the result in my header text field is listed full of nulls. At the end of the process I then manually delete the nulls, leaving just the correct responses. This is rather tedious and time consuming and not very user friendly.

I have requested some help with this question in the past and the solution provided worked, but up to a point, only if i had 2 variables. I have tried to adapt the solution provided to cover multiple questions, but unfortunately no luck with my coding. My hacked solution is under the PC header text field.

So if anyone can help provide a solution to my problem that would be greatly appreciated.

Linked file Dropbox - Test removing nulls 2017-11-14.pdf

1 Accepted Solution

Avatar

Correct answer by
Level 2

Hi Radzmar

Thank's for this, it's exactly what I was looking for. Works perfectly.

View solution in original post

2 Replies

Avatar

Level 10

The script for the field at form1.#subform[0].EXNC should look this way to exclude null values:

var cResult = ""

cResult += Q1.Table1.Row1.TF2.isNull ? "" : Q1.Table1.Row1.TF2.rawValue + "\n";

cResult += Q1a.Table1.Row1.TF2.isNull ? "" : Q1a.Table1.Row1.TF2.rawValue + "\n";

cResult += Q1b.Table1.Row1.TF2.isNull ? "" : Q1b.Table1.Row1.TF2.rawValue + "\n";

cResult += Q1c.Table1.Row1.TF2.isNull ? "" : Q1c.Table1.Row1.TF2.rawValue + "\n";

cResult += Q12.Table1.Row1.TF2.isNull ? "" : Q12.Table1.Row1.TF2.rawValue + "\n";

this.rawValue = cResult;

Avatar

Correct answer by
Level 2

Hi Radzmar

Thank's for this, it's exactly what I was looking for. Works perfectly.