Select to view content in your preferred language

Survey123 Feature Report Expressions

1146
7
Jump to solution
04-17-2024 01:05 AM
Nihe_N8
Emerging Contributor

Hello,

I'm having difficulty formatting the expressions within a Feature Report Template.

Basically, I have a Summary Table at the start of the report which is laid out like below. I've only included part of the expression to give you an idea (there's a lot).

Non-ConformanceCorrective ActionDate to be Completed byActual Completion Date

${if q1 ==”no”}${q1_noncompliance_calc} ${/}

${if q2 ==”no”}${q2_noncompliance_calc} ${/}

${if q3 ==”no”}${q3_noncompliance_calc} ${/}

${if q4 ==”no”}${q4_noncompliance_calc} ${/}

${if q5 ==”no”}${q5_noncompliance_calc} ${/}

${if q1 ==”no”}${q1_actionrequired_calc} ${/}

${if q2 ==”no”}${q2_actionrequired_calc} ${/}

${if q3 ==”no”}${q3_actionrequired_calc} ${/}

${if q4 ==”no”}${q4_actionrequired_calc} ${/}

${if q5 ==”no”}${q5_actionrequired_calc} ${/}

${if q1 ==”no”}${q1_actiondate_calc} ${/}

${if q2 ==”no”}${q2_actiondate_calc} ${/}

${if q3 ==”no”}${q3_actiondate_calc} ${/}

${if q4 ==”no”}${q4_actiondate_calc} ${/}

${if q5 ==”no”}${q5_actiondate_calc} ${/}

${if q1 ==”no”}${q1_completiondate} ${/}

${if q2 ==”no”}${q2_completiondate} ${/}

${if q3 ==”no”}${q3_completiondate} ${/}

${if q4 ==”no”}${q4_completiondate} ${/}

${if q5 ==”no”}${q5_completiondate} ${/}

 

The table will display the answers of these 4 sub-questions/follow on questions to 51 main questions if that answer was "No". The expressions in the above table is basically replicated within each cell 51 times. 

What I want to achieve is all executed answers displayed in a list directly below each other and in a single line across all the cells. With the expression as in the table above, the answers end up being displayed like below, with gaps between answers which weren't executed etc.

Nihe_N8_0-1713340362456.png

In above, it almost does what I want, but the 3 answers should be aligned across the 4 cells and the table should be sized as such. They should also be displayed like a list one after the other in each cell.

If I change the expression in the table above so that it is all together (not on a new line for each question but a continuous piece of code) it ends up displaying everything like this:

Nihe_N8_1-1713340595069.png

The size of the table is what I want, but everything should be on a new line/paragraph and aligned across each cell.

Hope that makes sense, and apologies if its waffley. I'd really appreciate any ideas with this - its really been frustrating me!

Many thanks,

Nick

 

0 Kudos
1 Solution

Accepted Solutions
abureaux
MVP Frequent Contributor

Your screen caps are the expected behaviour fro how the Feature Report logic is set up. You have this:

abureaux_0-1713450830416.png

This will just remove that little bit of text in column 1.

I have this:

abureaux_1-1713450859939.png

Since the start tag is in the first column and the end tag is in the last column of the table, the entire row will be deleted. Please give this a try.

View solution in original post

7 Replies
abureaux
MVP Frequent Contributor

Can you add an example of what you want the output to look like?

For conditional questions, you can add carriage returns inside the IF() statement. E.g.,

${if q1 ==”no”}${q1_noncompliance_calc}
${/}${if q2 ==”no”}${q2_noncompliance_calc}
${/}${if q3 ==”no”}${q3_noncompliance_calc}
${/}${if q4 ==”no”}${q4_noncompliance_calc}
${/}${if q5 ==”no”}${q5_noncompliance_calc}${/}

Will result in something like (where; q1=yes, q2=no, q3=no, q4=yes, q5=yes):

Some text for q1
Some text for q4
Some text for q5

0 Kudos
Nihe_N8
Emerging Contributor

So in Survey123 I'm using a style of "pages dynamic-grid". The last section (last page) of this survey basically contains a summary of all of the answers to the questions. There are 51 "Yes/No" questions with Non-Conformance/Corrective Action Required/Date Corrective Action to be Completed by additional questions that are asked if any of those 51 questions is "No".

The Summary Table in Survey123 looks like below.

Nihe_N8_0-1713372313026.png

For example, this Summary shows that Q1, Q3 and Q5 were answered "No" and displays the follow on questions. All of the other questions were "Yes". I need to get this summary table into the feature report and for the most part it works using the expressions I wrote above. However what ends up happening, is when the Feature Report is generated, that table spreads itself over a whole page or 2 and is filled with a whole pile of white space between each of the answers and often doesn't align in a row like the s123 summary table above. 

There is a serious bit of info with this survey so I'm trying to make it as concise a possible to explain lol. I've attached a copy of the Feature Report Summary Table as I have it atm. Also attached an example (different answers to above but that's irrelevant) of how the output summary table looks when the feature report is generated. Its across 2 pages and doesn't look great. 

Let me know if you need any more info. Thanks again @abureaux 

0 Kudos
abureaux
MVP Frequent Contributor

Okay, I think I have a better idea of what you are looking to do now.

Unless I am mistaken, I assume these line items are not a single repeat, but instead all separate questions. Also, I assume that your summary page is utilizing a "relevant" expression to dynamically display content. If that is the case, the only way to get a clean output is with tables in your Feature Report.

Here is what I would do (I just guessed at the names):

Non-Conformance

Corrective Action

Date to be Completed By

Actual Completion Date

${if q1 ==”no”}${q1_noncompliance_calc}

${q1_correctiveaction_calc}

${q1_completedate_calc}

${q1_actualdate_calc}${/}

${if q2 ==”no”}${q2_noncompliance_calc}

${q2_correctiveaction_calc}

${q2_completedate_calc}

${q1_actualdate_calc}${/}

${if q3 ==”no”}${q3_noncompliance_calc}

${q3_correctiveaction_calc}

${q3_completedate_calc}

${q1_actualdate_calc}${/}

${if q4 ==”no”}${q4_noncompliance_calc}

${q4_correctiveaction_calc}

${q4_completedate_calc}

${q1_actualdate_calc}${/}

${if q5 ==”no”}${q5_noncompliance_calc}

${q5_correctiveaction_calc}

${q5_completedate_calc}

${q1_actualdate_calc}${/}

0 Kudos
Nihe_N8
Emerging Contributor

Yeah you're correct @abureaux - they aren't in repeats but are all separate questions inside groups. For example each one is set up like this in S123 (there are more questions and info inside each question group, but I've removed them from this example as they are irrelevant). The survey is huge - there's over 1,200 rows.

typenamelabelrelevant
begin groupq1grpQuestion 1 
select_one riskq1Current version of CPP on site 
select_one q1.1q1_1Select the Non-Conformance${q1}='no'
select_one q1.2q1_2Corrective Action Required${q1_1}
dateq1_3Date Corrective Action to be Completed by${q1_2}
end group   

 

The select_one risk is basically the Yes/No part. So only questions that have had No selected will end up showing in the Summary Table at the end of the survey.

I have tried doing what you suggested above, but the problem with that is that it ends up looking like the attached (empty cells if those questions were answered Yes). That was why I tried putting the expression into a single cell under each heading in the table. i do like how it keeps everything aligned however, but if that could be done without individual cells it would look better.

It's a complicated one 🤔 maybe this is a limitation of the software, but I'd have thought it would've been possible given how obvious a requirement it seems. Do you have any more thoughts?

0 Kudos
abureaux
MVP Frequent Contributor

Your screen caps are the expected behaviour fro how the Feature Report logic is set up. You have this:

abureaux_0-1713450830416.png

This will just remove that little bit of text in column 1.

I have this:

abureaux_1-1713450859939.png

Since the start tag is in the first column and the end tag is in the last column of the table, the entire row will be deleted. Please give this a try.

Nihe_N8
Emerging Contributor

YES!!!!! It works! You've no idea how great that is to get that working, thank you so much!!!

0 Kudos
abureaux
MVP Frequent Contributor

Glad to hear 🙂

Ya, that feature isn't over obvious, but it's incredibly helpful to know. Good luck with the rest!

0 Kudos