@rachelsweet123
All good. No worries on the method. There are a few things to consider.
First - before some of the suggestions. You are delimiting your items in your comments with ***, || and :
This means you need to be cautious of the html you are putting in from the comments. Meaning...In the event that someone happens to enter *** in the comments or ||, this will completely throw your formulas off!!
Just want to make this clear. There are ways to solve that, but, want to make sure you are prepared for that.
Next observation - varRecord1 - is that the Item property of your form??
Now, as far as your Items property for the gallery...This IS a great place for the ForAll function - which is a function that produces a Table (not a For Loop!)
So, changing your formula to:
Sort(
ForAll(
Filter(Split(varRecord1.Comments, "***"), !IsBlank(Result)),
With({_rec: Split(Result, "||")},
{User: Index(_rec, 1).Result,
CommentDate: DateTimeValue(Index(_rec, 2).Result),
Status: Last(Split(Index(_rec, 3).Result, ":")).Result,
Comment: Index(_rec, 4).Result
}
)
),
CommentDate
)
This now provides a valid record with a typed schema for your gallery. NOTE: This also sorts - which answers your other post.
Things like your User label would have a text property of: ThisItem.User etc.
Your HtmlText control would have a HtmlText property of: ThisItem.Comment
Now...tell me how you are adding comments. What is your strategy for that?