cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
ashwinijain932
Regular Visitor

Few collection values are not getting stored into the SharePoint List

I am creating an application as shown below in the picture. I am trying to update 'Adjusted Hours' and Comments for multiple rows simultaneously so that the entire data is saved with 1 click. In this case, I am storing all the updated values in a collection and sending the collection values to SharePoint list (after clicking on tick mark). All the values are getting stored in the collection but only few values are getting stored in the SharePoint list. I have checked the code multiple times and tried various things but, still not luck. Can someone please explain me if I am missing anything.

 

ashwinijain932_0-1598239891415.png

 

I used to below code to save all the entries into the collection. 

 

If(

    ThisItem.Job in Collection1.Job1 And ThisItem.WeekEnding in Collection1.WeekEnding1,

    Patch(

        Collection1,

        First(

            Filter(

                Collection1,

                Job1 = ThisItem.Job,

                WeekEnding1 = ThisItem.WeekEnding

                )

            ),

            {AdjustedHours : Value(TextInput5.Text)}

            ),

    Collect(

        Collection1,

        {

            Job1 : ThisItem.Job,

            WeekEnding1 : ThisItem.WeekEnding,

            AdjustedHours : Value(TextInput5.Text)

        }

    )

)

 

And, I used the below code to send the data to SharePoint list.

 

ForAll(

    Collection1,

    Patch(Hours, First(Filter(Hours, Job = Job1, WeekEnding = WeekEnding1)), {'Adjusted Estimate Hours':  AdjustedHours, Comments: Comments1}));

 Navigate(Screen2); Clear(Collection1)

 

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
v-xida-msft
Community Support
Community Support

Hi @ashwinijain932 ,

Regarding the formula that you mentioned, I think there is something logic issue with it. I have made a test on my side, please try to modify your formula as below:

 

Firstly, you should add the "+" icon inside the Gallery rather than outside the Gallery. Then you could update current Gallery Item and add new entry via pressing the "+" icon. Set the OnSelect property of the "+" icon inside the Gallery to following:

Patch(
           Collection1,
           LookUp(Collection1,Job1 = ThisItem.Job && WeekEnding1 = ThisItem.WeekEnding),
           {
              AdjustedHours : Value(TextInput5.Text)
           }
);
Collect(
        Collection1,
        {
            Job1 : ThisItem.Job,
            WeekEnding1 : ThisItem.WeekEnding,
            AdjustedHours : Value(TextInput5.Text),
            Comments1: ""    // you should also include the Comments1 field here when you add a new entry
        }
)

Note: I assume that you have initialized the Collection1 already when you load your canvas app. Please do not forget adding the Comments1 field in your Collect formula as above.

 

You should modify your ForAll formula as below:

ForAll(
       Collection1 As LoopRecord,  // Modify formula here
       Patch(
               Hours,
               If(    // Modify formula here. Detect if the collection record is exited in your SP List or not
                  IsBlank(LookUp(Hours, Job = LoopRecord.Job1 && WeekEnding = LoopRecord.WeekEnding1)),
                  Defaults(Hours),
                  LookUp(Hours, Job = LoopRecord.Job1 && WeekEnding = LoopRecord.WeekEnding1)
               ), 
              {
                  'Adjusted Estimate Hours':  LoopRecord.AdjustedHours, 
                  Comments: LoopRecord.Comments1
              }
       )
);
Navigate(Screen2);
Clear(Collection1)

Please consider try above solution, then check if all collection records has been updated in your SP List.

 

Regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

1 REPLY 1
v-xida-msft
Community Support
Community Support

Hi @ashwinijain932 ,

Regarding the formula that you mentioned, I think there is something logic issue with it. I have made a test on my side, please try to modify your formula as below:

 

Firstly, you should add the "+" icon inside the Gallery rather than outside the Gallery. Then you could update current Gallery Item and add new entry via pressing the "+" icon. Set the OnSelect property of the "+" icon inside the Gallery to following:

Patch(
           Collection1,
           LookUp(Collection1,Job1 = ThisItem.Job && WeekEnding1 = ThisItem.WeekEnding),
           {
              AdjustedHours : Value(TextInput5.Text)
           }
);
Collect(
        Collection1,
        {
            Job1 : ThisItem.Job,
            WeekEnding1 : ThisItem.WeekEnding,
            AdjustedHours : Value(TextInput5.Text),
            Comments1: ""    // you should also include the Comments1 field here when you add a new entry
        }
)

Note: I assume that you have initialized the Collection1 already when you load your canvas app. Please do not forget adding the Comments1 field in your Collect formula as above.

 

You should modify your ForAll formula as below:

ForAll(
       Collection1 As LoopRecord,  // Modify formula here
       Patch(
               Hours,
               If(    // Modify formula here. Detect if the collection record is exited in your SP List or not
                  IsBlank(LookUp(Hours, Job = LoopRecord.Job1 && WeekEnding = LoopRecord.WeekEnding1)),
                  Defaults(Hours),
                  LookUp(Hours, Job = LoopRecord.Job1 && WeekEnding = LoopRecord.WeekEnding1)
               ), 
              {
                  'Adjusted Estimate Hours':  LoopRecord.AdjustedHours, 
                  Comments: LoopRecord.Comments1
              }
       )
);
Navigate(Screen2);
Clear(Collection1)

Please consider try above solution, then check if all collection records has been updated in your SP List.

 

Regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

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

MBAS Attendee Badge

Claim Your Badge & Digital Swag!

Check out how to claim yours today!

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

Top Solution Authors
Top Kudoed Authors
Users online (26,873)