cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Msaldivar
Level: Powered On

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
Super User
Super User

Re: Show an specific column from database

@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
thirdimage

Power Apps Super User Class of 2020

Check it out!

thirdimage

New Badges

Check it out!

thirdimage

Power Apps Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

SecondImage

Difinity Conference

The largest Power BI, Power Platform, and Data conference in New Zealand

Top Solution Authors
Top Kudoed Authors
Users online (6,056)