I need help (again). I'm working on a customized form that is linked to a SPO list (obviously). In the form, I have a gallery, where, if a person is putting in a new entry, can make a list if items to be included in that entry. The problem I have now, is how to populate the gallery in the customized form when someone clicks on/opens an existing item in the list. I've tried to use ThisItem.<whatever> in the default values of the gallery, but it doesn't seem to be doing the job. Any ideas how I can make this work?
Solved! Go to Solution.
Thank you very much for the reply.
How would I get this to work in a customized form? Where would I put this code so when a user clicks on an item in the SPO list, they can view the split text in a gallery?
For a SP customized form, you could put it in the SharePoint Integration object's OnEdit action. This will execute the desired actions upon selecting to edit a record from the SharePoint list.
Did that, but got the same error. I don't know why it's having a problem with ThisItem. Shouldn't that be a default property of the form?
Ah, I see my mistake. ThisItem would work when you're inside the data cards and properties of the form. In this case, since you wanted it at the level of the form overall, you can reference that SharePoint integration object:
In the example above, SharePointIntegration.Selected.Id refers to the Id number of the chosen record. Change Id to the column of your choice and put it in the Split and you'll be good to go.
That got it to display in the gallery. Thanks!
One caveat thought, the gallery doesn't always display ALL of the lines from the record, and it also doesn't clear the collection between item selections. I tried to put Clear(col_collectionName) in the OnCancel property, but it doesn't seem to work.
What happens is, I click on one item, and the gallery displays the first record of it's ItemDetail record. I click the X, and close the form/item. I select another item, the gallery displays two lines, but both are the values of the first line of the previous item's ItemDetail. I click X, and close the form/item. I click on a third item, and the gallery displays the first record of the (3rd) item's ItemDetail column. Obviously, some very odd behavior.
OK, so I think I'm close to getting this working, but I need an explanation as to why it's not working. In trying to figure out this issue, I used a test app, where I created a label with multi-lined text with the "|" delimiter separating the elements in each line. In place of the OnView property, I used a button. For the OnSelect property of the button, I put...
ClearCollect(col_ItemDetailView, Split(Label3.Text, Char(10)))
Then, I put three labels into the first line/item in a gallery. For the first label's Text property, I put...
Left(Result, Find("|", Result)-1)
For the second...
Mid(Result, Find("|", Result)+1, (Find("|", Result, Find("|", Result)+1) - (Find("|", Result)+1)))
Mid(Mid(Result,Find("|",Result)+1),Find("|", Mid(Result,Find("|", Result)+1))+1)
Now, this WORKED in my test gallery. When I tried to use the exact same code in the customized form, however, it only partially worked. The first two labels were fine, but the last one showed the first record's last element and all the subsequent lines after that. I'm not sure why. When creating the collection in my test app, I checked that the collection was populated correctly from the split. I don't understand why, when I put it into the OnView property, it doesn't exhibit the same behavior.
OK, so I tried a different tack and used a data table instead of a gallery. Again, I got it to work in my test app, but not in the customized form. The multi-line text is in a label, and I'm using a button to initiate the split.
For the OnSelect property, I put:
"Item", Left(Result,Find("|", Result)-1),
"Description", Mid(Result,Find("|", Result)+1, Find("|", Mid(Result,Find("|", Result)+1))-1),
"Quantity", Mid(Mid(Result,Find("|",Result)+1),Find("|", Mid(Result,Find("|", Result)+1))+1))
And for the Items property of the data table, I have:
What is the difference between the text in a label versus text in a SPO list's record?
When I tried this in my customized form, it doesn't populate the collection at all. As a troubleshooting measure, I added a label to the form, and made it's Text property value:
Everytime I click on an item in the SPO list, it does not show the correct number of rows (it shows 0).
OK, so, I was never able to get this to work properly. Didn't get a lot of support on it either. I did in the beginning, but then, nothing. I ended up creating a separate SPO list for the items and tying it with the request list via a request ID column. Not my ideal solution, but at least it works.
Keep up to date with current events and community announcements in the Power Apps community.
A great place where you can stay up to date with community calls and interact with the speakers.
Check out the latest Community Blog from the community!