cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
alearner090
Frequent Visitor

Loading the SharePoint Edit Form with repeatable table data from SharePoint string field

I have a gallery in my SharePoint form. I am using this gallery as a repeating table. 

I am able to add the gallery and submit the data, I am storing the data in a string field. 

I am not able to reload the gallery with the existing data from the string field. 

When the form loads how do I populate my collection object from the existing SharePoint field values if it exists. 

Right now my edit form loads with an empty gallery, it doesn't populate with the data existing in the column value. 

 

here are some codes I have used 

 

Updating the string variable from the gallery items

 

Set(

    DescAmountData,

    Concat(

        AmountwithDesc_2.AllItems,

        Concatenate(SerialNo.Text,";", Amount.Text,";", AmountDesc.Text,"|" ) )

);

 

Adding to the collection every time a new gallery item is added

 

Collect(

    Spendingcoll,

    {

        SerialNo_2: Text(Last(Spendingcoll).SerialNo_2+1),

        Amount_2: " ",

        AmountDesc_2: ""

    }

)

 

Setting the data card value which is the column that stores the gallery data as a string

amounddescvalue1=Concatenate(Text(ThisItem.AmountsDesc),DescAmountData)

 

 

trying to reload the gallery with the data field this is not working. So my field name is AmoundDesc which holds the data. I am trying to reference the Datacard value corresponding to the column name

 

Set(DescAmount,DataCardValue10.Text); retreiving value from the datacard to the string

Clear(Spendingcoll); clear my collection

 

Set(DescAmount,Left(DescAmount, Len(DescAmount)-1)); remove the extra semicolon for the splitting of the string

 

ForAll(Split(DescAmount,"|"), Collect(Spendingcoll, {SerialNo: Text(Last(FirstN(Split(Result,";").Result,1).Result).Result), Amount:Text(Last(FirstN(Split(Result,";").Result,2).Result).Result), AmountDesc:Text(Last(FirstN(Split(Result,";").Result,3).Result).Result)}))

 

above code is to split the string and update the collection. it has three input text field in the gallery

 

This code is in the screen ONVISIBLE box. 

 

so far it is not working..... 

1 ACCEPTED SOLUTION

Accepted Solutions

Hi @alearner090 ,

 

I made a test with all formulas you provisioned with only changing the variable name, and result shows it was working fine:

50.png

 

So I think the issue is coming from the first variable: Set(DescAmount,DataCardValue10.Text);

OnVisible has a higher priority than loading Form, which means the DataCardValue10.Text will get data from the data source after OnVisible finishes running.

 

Please try and modify this variable to:

 

Set(DescAmount,SharePointIntegration.Selected.AmountsDesc)

 

You need to get data from the table directly.

 

Hope this helps.

 

Best regards,

Community Support Team _ Jeffer Ni
If this post helps, then please consider Accept it as the solution to help the other members find it.

 

View solution in original post

4 REPLIES 4
v-jefferni
Community Support
Community Support

Hi @alearner090 ,

 

Could you please share a sample value in that column?

 

Best regards,

Community Support Team _ Jeffer Ni
If this post helps, then please consider Accept it as the solution to help the other members find it.

here is the value that is stored in SharePoint Column

;89;89 desc|;91;91 desc|;92;92 desc| (the first part is for SerialNo but my Serial no is blank it should be autoincremented, following is the code to add new item in gallery)

Collect(

    Spendingcoll,

    {

        SerialNo:Text(Last(Spendingcoll).SerialNo+1),

        Amount:"",

        AmountDesc: ""

    }

)

 

the attached image is the Form. 

there is a tab called COR which opens the screen with teh gallery. 

 

Hi @alearner090 ,

 

I made a test with all formulas you provisioned with only changing the variable name, and result shows it was working fine:

50.png

 

So I think the issue is coming from the first variable: Set(DescAmount,DataCardValue10.Text);

OnVisible has a higher priority than loading Form, which means the DataCardValue10.Text will get data from the data source after OnVisible finishes running.

 

Please try and modify this variable to:

 

Set(DescAmount,SharePointIntegration.Selected.AmountsDesc)

 

You need to get data from the table directly.

 

Hope this helps.

 

Best regards,

Community Support Team _ Jeffer Ni
If this post helps, then please consider Accept it as the solution to help the other members find it.

 

View solution in original post

Thanks, also another was the gallery input elements default value was not set to gallery items input.

Helpful resources

Announcements
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

secondImage

Demo Extravaganza is Back!

We are excited to announce that Demo Extravaganza for 2021 has started!

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

Power Apps June 2021

June Power Apps Community Call

Don't miss the call this month on June 16th - 8a PDT

Top Solution Authors
Top Kudoed Authors
Users online (91,069)