cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Nida_Sayedi
New Member

How to DIspaly Columns from database in powerapps table with groupby

I have a sql table named doctorinfo , i have created a collection as follows

Collect(DocData,'[dbo].[DoctorInfo]')

Nida_Sayedi_0-1619171695441.png

 

i have other collection created using groupby  

ClearCollect(MyNewCollection,GroupBy(DocData,"Department","newgroup"))

 

Nida_Sayedi_1-1619171797686.png

 

Nida_Sayedi_2-1619171909555.png

How do I display mynewcollection in datatable in power apps?

 

Iam getting following error, how do i display table coulums , it is showing as [ObjectID,,]

Nida_Sayedi_3-1619172027903.png

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
RandyHayes
Super User III
Super User III

@Nida_Sayedi 

You cannot display a table in a table in the DataTable control.

Consider utilizing a Gallery instead of the DataTable as, not only will you have more control over it, but you can then nest a Gallery to show the table of the Grouping.

 

Create a Gallery and set the Items property to:

    GroupBy('[dbo].[DoctorInfo]', "Department", "_records")

 

Add a label in the Gallery and set the Text property to: ThisItem.Department

Add a Gallery in the Gallery and set the Items property to : ThisItem._records

Now add labels in that gallery as needed to show the data columns that you would like.

 

If you are stuck on using DataTables for some reason, then you can also consider the following:  2 DataTables 

The First datatable should have an items property of : 

    GroupBy('[dbo].[DoctorInfo]', "Department", "_records")

And the second DataTable would have an Items property of:  firstDataTable.Selected._records

 

I hope this is helpful for you.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

View solution in original post

1 REPLY 1
RandyHayes
Super User III
Super User III

@Nida_Sayedi 

You cannot display a table in a table in the DataTable control.

Consider utilizing a Gallery instead of the DataTable as, not only will you have more control over it, but you can then nest a Gallery to show the table of the Grouping.

 

Create a Gallery and set the Items property to:

    GroupBy('[dbo].[DoctorInfo]', "Department", "_records")

 

Add a label in the Gallery and set the Text property to: ThisItem.Department

Add a Gallery in the Gallery and set the Items property to : ThisItem._records

Now add labels in that gallery as needed to show the data columns that you would like.

 

If you are stuck on using DataTables for some reason, then you can also consider the following:  2 DataTables 

The First datatable should have an items property of : 

    GroupBy('[dbo].[DoctorInfo]', "Department", "_records")

And the second DataTable would have an Items property of:  firstDataTable.Selected._records

 

I hope this is helpful for you.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

View solution in original post

Helpful resources

Announcements
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

secondImage

Demo Extravaganza is Back!

We are excited to announce that Demo Extravaganza for 2021 has started!

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

Power Apps June 2021

June Power Apps Community Call

Don't miss the call this month on June 16th - 8a PDT

Top Solution Authors
Top Kudoed Authors
Users online (56,190)