cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Power Apps Staff Mr-Dang-MSFT
Power Apps Staff

Re: Need help with customized form


@lumberjacklurch wrote:

Mr. Dang,

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.

 

image.png

Re: Need help with customized form

Mr Dang,

I tried your suggestion, but I got some errors.  Please see attached screenshots.

 

customformss1.jpgcustomformss2.jpgcustomformss3.jpg

Power Apps Staff Mr-Dang-MSFT
Power Apps Staff

Re: Need help with customized form

Please replace ThisItem.column with ThisItem.your_desired_column.

Fill it in with the name of the column whose contents you're trying to replace.

Re: Need help with customized form

customformss4.jpg

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?


Power Apps Staff Mr-Dang-MSFT
Power Apps Staff

Re: Need help with customized 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:

image.png

 

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.

 

Big idea: 

  • SharePointIntegration.Selected is the record picked from SharePoint and can be referenced anywhere
  • OnEdit, OnView, etc. happen at the app level and need to reference the SharePoint integration object and are not able to use ThisItem because that's only available inside the scope of a gallery and data card.

Re: Need help with customized form

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.

Re: Need help with customized form

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)))

 

And third...

 

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.

Re: Need help with customized form

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:

 

ClearCollect(col_ItemDetailView,
AddColumns(Split(Label3.Text, Char(10)),
"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:

 

col_ItemDetailView

 

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:

 

CountRows(col_ItemDetailView)

 

Everytime I click on an item in the SPO list, it does not show the correct number of rows (it shows 0).  

Re: Need help with customized form

*BUMP*

Re: Need help with customized form

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.

View solution in original post

Helpful resources

Announcements
New Ranks and Rank Icons in April

'New Ranks and Rank Icons in April

Read the announcement for more information!

Better Together’ Contest Finalists Announced!

'Better Together’ Contest Finalists Announced!

Congrats to the finalists of our ‘Better Together’-themed T-shirt design contest! Click for the top entries.

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

thirdimage

Community Summit North America

Innovate, Collaborate, Grow - The top training and networking event across the globe for Microsoft Business Applications

Top Solution Authors
Top Kudoed Authors
Users online (9,193)