cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
priyankbhat
Helper III
Helper III

DataTable is showing [object Object] in column for data from sharepoint

Hi,

 

I have created small App that pulls data from sharepoint list.

 

Form has Datatable and Formviewer to display rows selected in data table. Connection between Data table and form viewer has no issue. In data table i am showing 2 columns that are "Single Line of Text" in sharepoint.

 

I am planning to include Modified person name in view to identify who last updated this record rather than clicking on each rows and viewing in formviewer. Issue is when i include column which is "Person or Group" in sharepoint I see value [object Object] appearing in my App created with Powerapps. I tried running through properties and advance properties and even tried searching solution on internet but i failed to find solution.

 

Please guide me on how to fix this issue.

 

Thanks

2 ACCEPTED SOLUTIONS

Accepted Solutions

Hi Priyank,

 

It does seem to be a bit temperamental - sometimes it renders CreatedBy, sometimes it renders Author - and then you get [object Object] values.  Pretty weird, not sure why it does this, I'm sure someone more knowledgable than me could explain 🙂

 

To work around it however, you can add a column when you create the collection and manually traverse the person column object to put the object property you're looking for into the added column.  This effectively 'flattens' the object down to the field you want.

You can then use the added column in your grid.

 

so;

ClearCollect(CollectStuff, AddColumns(SharePointList, "FlatAuthor", Author.DisplayName))

Bear in mind, this only exists in the collection so you can display it in the data table.

 

complexGrid2_1.PNG

 

Hope this helps,

 

RT 

View solution in original post

Hi Russel,

 

Your suggestion looks promising let me try this.

 

Thanks

Priyank

View solution in original post

6 REPLIES 6
RusselThomas
Microsoft
Microsoft

Hi priyankbhat,

 

I know it used to be the case that DataTables could not render complex (or nested) objects at all.

I do believe this was updated in a later release however and, for Modified By and Created By at least, it seems to render the DisplayName property without any manipulation;

 

complexGrid.PNG

 

Do you perhaps have some more details you can share to help reproduce the problem on this side?

 

Kind regards,

 

RT

Hi RT,

 

Find below screen short of error that is appearing.

 

 

Capture.JPG

 

REDStatus is collection that has been created from existing sharepoint view. Below is code.

 

Refresh('Status Report');
ClearCollect(REDStatus, Filter('Status Report', RAG_x0020_Status.Value = "RED"))

Below screenshot is from original sharepoint list.

Capture2.JPG

 

Thanks

Priyank

 

Thanks Priyank,

 

 

 

It seems to work the same for me whether using the source direct or using a collection from the source.  Below is the collection;

 

complexGrid2.PNG

 

So, I'm a bit stumped to be honest. 

I do notice however that your column names in your collection are different from the source, but changing the display names on my side don't affect the outcome. 

 

Are you using the web studio or the desktop studio?

 

 

Kind regards,


Russel

Hi Russel,

 

I am using web studio.

 

Here is steps i done before i identified issue.

1) Add DataTable to screen and gave datasource to existing sharepoint table.

2) I am able to select column. 

3) Next thing i did was created collection using script i shared earlier and filtered data.

4) Manually in advance property window replaced sharepoint view with collection.

5) I am still able to see data in collection. Even any new data getting added to collection is correctly displaying.

 

Now issues occures if i do below

1) Goto property window and select additional Fields.

2) Additional text field is correctly getting displayed

3) Issue appears when i select any fields which has choices or "People and Group" datatype.

 

Temporarily i identified workaround

1) Goto property window and select original sharepoint table.

2) Select new columns which are choices or "People and Group" data type

3) Fields start displaying correct data 

4) Go back again to advance property and manually replace sharepoint table with collection.

 

This is workaround. Is there way when i see data as [object Object] I can manually map/make configuration to resolve issue ?

 

Thanks

 

Priyank Bhat

Hi Priyank,

 

It does seem to be a bit temperamental - sometimes it renders CreatedBy, sometimes it renders Author - and then you get [object Object] values.  Pretty weird, not sure why it does this, I'm sure someone more knowledgable than me could explain 🙂

 

To work around it however, you can add a column when you create the collection and manually traverse the person column object to put the object property you're looking for into the added column.  This effectively 'flattens' the object down to the field you want.

You can then use the added column in your grid.

 

so;

ClearCollect(CollectStuff, AddColumns(SharePointList, "FlatAuthor", Author.DisplayName))

Bear in mind, this only exists in the collection so you can display it in the data table.

 

complexGrid2_1.PNG

 

Hope this helps,

 

RT 

View solution in original post

Hi Russel,

 

Your suggestion looks promising let me try this.

 

Thanks

Priyank

View solution in original post

Helpful resources

Announcements
PA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

Power Query PA Forum 768x460.png

Check it out!

Did you know that you can visit the Power Query Forum in Power BI and now Power Apps

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

R2 (Green) 768 x 460px.png

Microsoft Dynamics 365 & Power Platform User Professionals

DynamicsCon is a FREE, 4 half-day virtual learning experience for 11,000+ Microsoft Business Application users and professionals.

Users online (1,272)