0

I have an app and power automate combo where I am collecting columns from the selected gallery item in order to email the details to the user. When I check my collections, all desired columns are shown, including columns with a null value. When I check the ProfileData variable passed through the JSON function, the columns with null values have been dropped out. Is there a way to get columns with null to stick in the ProfileData variable? I'm open to ideas on different approaches as well. Any help is much appreciated.

Edit: Updated code below - I learned that pointing the app at an excel spreadsheet will include null attributes, but pointing it at a sharepoint list will excluse null attributes. Any ideas on how to include attributes with null values from a sharepoint list?

//Clear the existing profile collection
Clear(ProfileContent);

// Loop through each item in ProfileContent and collect the file data
Collect(ProfileContent,ShowColumns(CurrentItem,
First,Last,Middle,Phone,Class,Score,Grade)
);

// Set the ProfileData variable with the JSON representation of ProfileContent
Set(ProfileData, JSON(ProfileContent,JSONFormat.FlattenValueTables))

1 Answer 1

0

Inside your ForAll you are referring to the selected item in the gallery - which will give you the same record over and over. If you change it to ThisRecord, you will get the records from the ProfileCollection as (I imagine) you intend.

Also, you are right, there seems to be an issue with SharePoint data sources where null values are not being emitted; to work around that, instead of using ShowColumns you can create the record explicitly:

...
// Collect selected items from RecordsGallery1 into ProfileCollection
Collect(ProfileCollection,RecordsGallery1.AllItems);

// Loop through each item in ProfileCollection and collect the file data
ForAll(
  ProfileCollection,
  Collect(
    ProfileContent,
    {
      Title: ThisRecord.Title,
      'Last Name': ThisRecord.'Last Name',
      'First Name': ThisRecord.'First Name',
      'Middle Initial': ThisRecord.'Middle Initial',
      etc..
    }
  )
);
...
Sign up to request clarification or add additional context in comments.

6 Comments

thanks - my problem is when i set the ProfileData variable and pass it through JSON, the attributes with null values drop out of the record-- Set(ProfileData, JSON(ProfileContent,JSONFormat.FlattenValueTables));
I tried this scenario, added some null values to properties of my records, and they were emitted in the JSON correctly. Can you provide a short, self-contained, correct example that we can use to reproduce your issue? That will help us find a solution for you.
Thanks! I tried building a sample app using an excel spreadsheet and am getting the expected results when an attibute is null - the attribute is shown in ProfileData with a null value. Also I figured out my ProfileCollection was redundant so I'm only using ProfileContent now. I can't figure out what could be wrong with my actual app... it is based on a sharepoint data set, could that be related? its the only difference between my actual app and sample app
yeah, looks like it has something to do with sharepoint, i pointed my sample app at a sharepoint list and the null attributes are dropping out
You're right, when I tried with a SharePoint data source I do see the missing null values. To work around this issue, you can create the record to be collected explicitly instead of using ShowColumns. I updated the answer with the new way, and when I use that construct I can see the null values in the JSON. Thank you for reporting this issue, I'll pass it along to the product team.
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.