I am saving a collection to a SharePoint multi-line column in an SP list. At the moment it saves as:
Developer,550,M365,375
The collection looks like:
collResources:
{
Role:
Rate:
}
The text in bold is the role, above.
I need to use a ClearCollect to read this particular column and fill the collection. I've read this but it doesn't seem to fit my requirements exactly:
You can do this with a table producing function like ForAll.
Ex.
ClearCollect(
colYours,
With({_sp: Filter(Split(yourString, ","), !IsBlank(Result))},
ForAll(Sequence(CountRows(_sp), 1, 2),
{Role: Last(FirstN(_sp, Value)).Result,
Rate: IfError(Value(Last(FirstN(_sp, Value + 1)).Result), 0)
}
)
)
)
I hope this is helpful for you.
Forgive me, but what would I replace yourString with? And how is it targeting the specific column in SharePoint? The column is called RatesCard, which I forgot to mention in my OP.
Thanks.
Well that is going to depend on your purpose.
Are you wanting to collect values for one record based on those comma separated values in the column, or for all of the records in your datasource.
I would need a little more context as to what you're trying to do to give more than a generic "yourString" in the formula.
Yes, but what I am asking is - you mention this is in a column in your SharePoint list, but SharePoint is many records, not just a column. So the question is - you need to convert just one record or all records, or specific records?
Hi,
Just the one record/item in the list.
Thanks for your help!
C
Then that would be the text to use - the lookup of that value:
ClearCollect(
colYours,
With({_sp: Filter(Split(LookUp(yourList, ID=<someID>, columnName), ","), !IsBlank(Result))},
ForAll(Sequence(CountRows(_sp), 1, 2),
{Role: Last(FirstN(_sp, Value)).Result,
Rate: IfError(Value(Last(FirstN(_sp, Value + 1)).Result), 0)
}
)
)
)
Now, unless you plan to add/remove or change these values in your app...I would skip the collection and just make it a variable:
Set(glbRateList,
With({_sp: Filter(Split(LookUp(yourList, ID=<someID>, columnName), ","), !IsBlank(Result))},
ForAll(Sequence(CountRows(_sp), 1, 2),
{Role: Last(FirstN(_sp, Value)).Result,
Rate: IfError(Value(Last(FirstN(_sp, Value + 1)).Result), 0)
}
)
)
)
This will do the same thing, but not have the in-memory collection overhead to your app.
Thanks. It's not reading it back correctly. Here is how it's submitting into the SPO column:
[{"Rate":550,"Role":"Developer"},{"Rate":750,"Role":"Fn Lead"}]
But when it reads it back it shows this in the collection:
I'm using this to collect it from the column:
Clear(collResources);
ClearCollect(
collResources,
With({_sp: Filter(Split(LookUp(EngagementRequests, ID=Gallery1.Selected.ID, RatesCard), ","), !IsBlank(Result))},
ForAll(Sequence(CountRows(_sp), 1, 2),
{Role: Last(FirstN(_sp, Value)).Result,
Rate: IfError(Value(Last(FirstN(_sp, Value + 1)).Result), 0)
}
)
)
);
The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.
This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.
User | Count |
---|---|
185 | |
53 | |
41 | |
36 | |
30 |
User | Count |
---|---|
242 | |
81 | |
71 | |
69 | |
65 |