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

Show an specific column from database

I have a database with several columns like:

Name/  Department/  communicate/   coach/    leader/ colaborate
I have 2 dropdown lists: dpdownDpto and dpdownGift

the dpdwnDpto has the info in Department column and the items for dpdownGift are the other columns (communicate,coach,leader,colaborate).

 

The thing i need to do is  when i chose a departament in dpdownDpto and  a Gift in dpdownGift, for example:

dpdownDpto: manufacture

dpdownGift: coach

I want to show in a bar chart the value in coach column for each person in manufacture department.

 

in sql query is something like this:
SELECT Name, dbdwnGift.selected.value
FROM MyTable
WHERE Department = dpdwndpto.selected.value
ORDER BY name

I want to know if there is a way to do this in powerapps:

I try to use ShowColumns but i can't do it dinamically, 

I try this but isn't working:

Search(ShowColumns('[dbo].[Praise1]';"Name";dpdnGift.Selected.Value;"Department"); dpdnDepartament.Selected.Result;"Departament")

1 REPLY 1
mdevaney
Super User
Super User

@Msaldivar 

Unfortunately code dpdnGift.Selected.Value is not allowed in SHOWCOLUMNS.  This is because SHOWCOLUMNS does not allow variables for column names; only static text like "Name" or "Department".

 

You are going to have to build a SWITCH statement and manually define the expected values in dpdnGift.  I think you would benefit from reading this old forum post.  Another member outlines exactly how to do it right at the end of the thread.  https://powerusers.microsoft.com/t5/Building-PowerApps-Formerly/Text-to-text-literal/td-p/142846

 

---
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."

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

Power Platform Call June 2022 768x460.png

Power Platform Community Call

Join us for the next call on June 15, 2022 at 8am PDT.

PA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.

PA.JPG

New Release Planning Portal (Preview)

Check out our new release planning portal, an interactive way to plan and prepare for upcoming features in Power Platform.

Top Solution Authors
Top Kudoed Authors
Users online (3,480)