
Announcements
Dear All,
I am working on a SharePoint Form PowerApps where we have a Multi-Line Text Box having JSON Array like below
[
{
"Name": "ABC",
"Project": "Project 1",
"Salary": 100000
},
{
"Name": "XYZ",
"Project": "Project 2",
"Salary": 150000
}
]
And we have one gallery in the Form having dynamic grid structure and these 3 columns as "Name", "Project" & "Salary".
When user will open this form in edit mode, we want to display this column value data (which is in JSON Array) to that dynamic grid. Rows will be different depending upon business so Gallery should load these rows dynamically. User should edit it and then once click on Update it should be added to this Multi-Line Text field in JSON format.
Can you please help me with this?
Thanks,
Sanjay
Let's assume you have your target SharePoint record stored in a Variable called varCurrentRecord, and the field name of the multi-line text field (that stores your JSON string) is called ProjectDetails.
To parse the JSON string into a collection, you would use a formula like:
ClearCollect(
colProjectDetails,
ForAll(
Table(ParseJSON(varCurrentRecord.ProjectDetails)),
{
Name: Text(Value.Name),
Project: Text(Value.Project),
Salary: Value(Value.Salary)
}
)
);
After parsing the JSON string into a collection, you can display your Project details in a gallery. This allows you to perform adding, editing, and deletion just like any other gallery. When you're ready to save the data back to SharePoint, you can convert it back to a JSON string using the following approach:
Patch(
'SharePoint List',
LookUp('SharePoint List', ID = varCurrentRecord.ID),
{
ProjectDetails: JSON(colProjectDetails, JSONFormat.Compact)
}
);
See https://www.youtube.com/watch?v=FqfLiJDdC3Q by Reza for full explanation.
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.
Cheers!
Rick Hurt