cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Frequent Visitor

Show multiple variables if value is true

Hello,

 

I've got some checkboxes in one of my Powerapps and in a later screen i would like to summarize and show the ones that are checked. I've created an if statement that i think is correct but i get stuck on how to show the checkboxes if they are checked.

 

Does anyone know how to show the name of the textboxes if they are checked? This is my if statement.

 

If(Or(Role_DM.Value);(Role_IE.Value);(Role_Mgr.Value);(Role_SD.Value);(Role_SD_1st.Value);(Role_SD_2nd.Value);(Role_TL.Value);true;false)

 

Oh! And this is an ifstatement in an HTML-Textbox summarizing info from several screens.

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Frequent Visitor

Re: Show multiple variables if value is true

@mdevaney,

 

Just wanted to show what nailed it for me. The lines below is now showing my collection column values in my html textbox.

"<Table>"&
"<tr>"&
"<th>Department</th>"&
"<th>Role(s)</th>"&
"</tr>"&
"<tr>"&
"<td>"&Department.Selected.GroupName&"</td>"& "<td>"&Concat( EmpRoles, CheckboxText & "<br>" )&"</td>"&
"</tr>"&
"<tr>"&
"<td></td>"&
"</tr>"&
"<Table>

 

Thank you very much for giving me the advice before. Smiley Happy

View solution in original post

5 REPLIES 5
Highlighted
Super User III
Super User III

Re: Show multiple variables if value is true

@repema01 

 

You can use the following code.  Note that I had to type in the Checkbox names manually.

 

If(Role_DM.Value,"DM","")&
If(Role_IE.Value,"IE","")&
If(Role_Mgr.Value,"Mgr","")&
If(Role_SD.Value,"SD","")&
If(Role_SD_1st.Value,"SD 1st","")&
If(Role_SD_2nd.Value,"SD 2nd","")&
If(Role_TL.Value,"TL","")

If you want each result on a new line do this instead.

 

If(Role_DM.Value,"DM<br>","")&
If(Role_IE.Value,"IE<br>","")&
If(Role_Mgr.Value,"Mgr<br>","")&
If(Role_SD.Value,"SD<br>","")&
If(Role_SD_1st.Value,"SD 1st<br>","")&
If(Role_SD_2nd.Value,"SD 2nd<br>","")&
If(Role_TL.Value,"TL","")

 

---

Please click "Accept as Solution" if my response helped to solve your issue so that others may find it more quickly.  If your thought the post was helpful please give it a "Thumbs Up."

Highlighted
Frequent Visitor

Re: Show multiple variables if value is true

Thank you very much @mdevaney,

 

That works really well. Yesterday evening however I started wondering if I was asking the correct question and I don't think i did.

 

Since I will probably need to add and remove checkboxes from my PowerApps application in the future i think i need to add them to a collection when checking them instead. Then i'll show the collection instead. That way I just need to add new checkboxes and copy the collection code in the 'onCheck' variable from another checkbox to add it.

 

Again thank you very much for your time.

Peter

Highlighted
Super User III
Super User III

Re: Show multiple variables if value is true

That’s a very good thought to ensure easy maintainability of your code. You are correct, a single column table stored within a collection will do what you require.
Highlighted
Frequent Visitor

Re: Show multiple variables if value is true

@mdevaney,

 

Just wanted to show what nailed it for me. The lines below is now showing my collection column values in my html textbox.

"<Table>"&
"<tr>"&
"<th>Department</th>"&
"<th>Role(s)</th>"&
"</tr>"&
"<tr>"&
"<td>"&Department.Selected.GroupName&"</td>"& "<td>"&Concat( EmpRoles, CheckboxText & "<br>" )&"</td>"&
"</tr>"&
"<tr>"&
"<td></td>"&
"</tr>"&
"<Table>

 

Thank you very much for giving me the advice before. Smiley Happy

View solution in original post

Highlighted
Super User III
Super User III

Re: Show multiple variables if value is true

@repema01
Im glad you were able to figure it out and I appreciate you taking the time to write me back. Having the solution here will be helpful in case someone else has the exact same issue.

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

Power Platform ISV Studio

Power Platform ISV Studio

ISV Studio is designed to become the go-to Power Platform destination for ISV’s to monitor & manage published applications.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Tech Marathon

Maratón de Soluciones de Negocio Microsoft

Una semana de contenido con +100 sesiones educativas, consultorios, +10 workshops Premium, Hackaton, EXPO, Networking Hall y mucho más!

Top Solution Authors
Top Kudoed Authors
Users online (7,651)