"Show If" questions in a save file template

Hi everyone,

Im struggling how to describe my problem so i do aplogise in advance if i make zero sense,

Im trying to save a pdf file with the results of questionnaire i have in my app.

How would i best achieve selecting questions and answers that will generate in the pdf file i create. Im trying to avoid having a list of 20 questions that are not relevant because of the show if functions in my questionnaire.

The questionnaire is a medical assessment, so it starts with roughly 30 questions. Within the assessment i have an area of body pain which i reference to another table as multiple area of body pains can be selected with multiple different questions. Its this section i am struggling on how to pull select questions into the pdf file. The leg will have 4 questions that are different to 4 questions relating to the neck.

I dont want to have all the body part questions pre filled on the report if only leg and neck are selected.

I hope that makes a little sense.

Regards
Ben

Solved Solved
0 6 242
1 ACCEPTED SOLUTION

@Rafael_ANEIC-PY has helped massively on this one as ive been struggling all weekend on how to achieve this. I just wanted to put the solution on here so others could see if they ever needed anything similar. Ive still got so much to learn, but i feel like im getting there bit by bit with all the help from app sheet community.

Hey Ben, i believe what youโ€™re looking for is:

<<IF: COUNT(SELECT(Area of Pain[Area of Pain],AND([Document ID]=[_THISROW].[Document ID],[Area of Pain]="Neck")))>0>>

Neck

Flexion ROM: <<INDEX(SELECT(Area of Pain[Flexion ROM:],[Document ID]=[_THISROW].[Document ID]),1)>>
Extension ROM: <<INDEX(SELECT(Area of Pain[Extension ROM:],[Document ID]=[_THISROW].[Document ID]),1)>>


<<EndIf>>

Thatโ€™s the pattern i believe you should repeat for each bodypart, let me know if you have any questions.

View solution in original post

6 REPLIES 6

Hello @Ben_Rix, your problem can be solved using templates if expressions, the idea of those is that you build your template listing ALL of the sections it could possibly have (in your case if someone feels pain in every part of the body haha), and then use conditional expressions that would return TRUE if youโ€™d like that section to be shown in your pdf file, or FALSE if you want that entire section to be skipped.

Thanks Rafael,

This could be exactly what Iโ€™m looking for.

Regards
Ben

Hi Rafael,

I believe this is something i am looking for:

<<If: COUNT([Related OrderDetails])>0>>

Order Detail Records

<<Start: [Related OrderDetails]>>

Product: <<[Product]>>
Qty: <<[Qty]>>
Amount: <<[Amount]>>

<<End>>

<<EndIf>>

How would i use the if statement on Related order details (in my case related area of pain) Body pain = Neck)

Regards
Ben

Hey Ben, for building the template itself iโ€™d need to know more about your app structure, particularly regarding how you ask the user the questions and how are their answers stored.

The general idea that i have is that you divide your template in sections per body part and then use as an if condition a COUNT(SELECT()) expression that would check if there is at least an entry on a given body part, and if there isnโ€™t, the section shouldnโ€™t be displayed.

@Rafael_ANEIC-PY has helped massively on this one as ive been struggling all weekend on how to achieve this. I just wanted to put the solution on here so others could see if they ever needed anything similar. Ive still got so much to learn, but i feel like im getting there bit by bit with all the help from app sheet community.

Hey Ben, i believe what youโ€™re looking for is:

<<IF: COUNT(SELECT(Area of Pain[Area of Pain],AND([Document ID]=[_THISROW].[Document ID],[Area of Pain]="Neck")))>0>>

Neck

Flexion ROM: <<INDEX(SELECT(Area of Pain[Flexion ROM:],[Document ID]=[_THISROW].[Document ID]),1)>>
Extension ROM: <<INDEX(SELECT(Area of Pain[Extension ROM:],[Document ID]=[_THISROW].[Document ID]),1)>>


<<EndIf>>

Thatโ€™s the pattern i believe you should repeat for each bodypart, let me know if you have any questions.

Thanks Steve

Top Labels in this Space