cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
akbarmahfuzalam
Post Prodigy
Post Prodigy

Patch Gallery to SharePoint List

Hi Team,

 

I want to know what needs to be done or change in the formula below wherein I want the user to submit the button and the gallery gets empty one by one where there is an entry(If(!IsBlank(AHTReason.Text),).

But as of now, it's not happening though it submits the data to SharePoint List.

 

Concurrent(
Notify("Submitting your records...",NotificationType.Information),
ForAll(AHTBULKGallery.AllItems,
If(!IsBlank(AHTReason.Text),
Patch(
AHTException,Defaults(AHTException),
{Shiftdate:AHTSHIFTDATE.Text,Enterprise_ID:AHTEID.Text,LOB:AHTLOB.Text,Queue:AHTQueue.Text,Reason:AHTReason.Text,'Requested By':AHTTLs.Text,'Approved By':AHTOPSLEAD.Text,'Uploaded By':AHTUploadeBy.Text}
))));

Notify("All records has been submitted successfully!",NotificationType.Success);
Set(gvReset,true);Set(gvReset,false)

 

 

1 ACCEPTED SOLUTION

Accepted Solutions

@akbarmahfuzalam ,

It should work at Screen OnVisible. I am getting a little lost with this as the issues seem to keep changing.

View solution in original post

32 REPLIES 32
WarrenBelz
Super User
Super User

Hi @akbarmahfuzalam ,
Two things - is the gallery Items based on a collection - if so do this

Notify("Submitting your records...",NotificationType.Information);
ForAll(
   AHTBULKGallery.AllItems,
   If(
      !IsBlank(AHTReason.Text),
      Patch(
         AHTException,
         Defaults(AHTException),
         {
            Shiftdate:AHTSHIFTDATE.Text,
            Enterprise_ID:AHTEID.Text,
            LOB:AHTLOB.Text,
            Queue:AHTQueue.Text,
            Reason:AHTReason.Text,
            'Requested By':AHTTLs.Text,
            'Approved By':AHTOPSLEAD.Text,
            'Uploaded By':AHTUploadeBy.Text
         }
      )
   )
);
RemoveIf(
   YourGalleryCollectionName,
   !IsBlank(AHTReason)   //I assume this is the field name
);
Notify("All records has been submitted successfully!",NotificationType.Success);
Set(gvReset,true);
Set(gvReset,false)

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

@WarrenBelz ,

 

First of all, Thank you very much for your response.

 

Two things - is the gallery Items based on a collection - it so do this.

No, I have not used any Collection here. Basically I am using Two SharePoint List.

1- WHOSWHO ( which is the master list of the employee)

2. Another SharePoint List named as AHTException

So I have to filter the Gallery based on Supervisor of SP List WHOSWHO and Then Patching it back to AHTException SP List.

 

AHTReason is a Text Input which is not there in WHOSWHO SP List and present in AHTException SP List.

 

akbarmahfuzalam_0-1598513634568.png

 

 

@akbarmahfuzalam ,

If not based on a collection, do you want to remove the items from the list as they are patched to the other list?

If so, you can replace the collection name with your list name in my code.

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

 

 

@WarrenBelz ,

 

I have replaced the collection name with my Gallery name, but I am getting an error on the first line itself where is a comma. It showing in red

 

 

akbarmahfuzalam_0-1598530697124.png

 

@WarrenBelz ,

 

I am getting an error as "unexpected Characters. Characters used in the formula is an unexpected way"Error.jpeg

@akbarmahfuzalam ,

Fixed on the original - I removed the Concurrent and missed a couple of things in the tidy-up. That should be a semi-colon and there was one missing further down.

@WarrenBelz ,

 

I am sorry to ask you where do I need to put those extra close bracket and Semicolon in the below code.

 

The function RemoveIf has some invalid arguments.
Invalid Argument type

The first argument of RemoveIf should be a collection.

 

Note: If I Say AllItems then it says as " The first argument of RemoveIf should be a collection."

Whereas I am not using the collection here

 

RemoveIf(AHTBULKGallery.AllItems,
!IsBlank(AHTReason.Text)
);

 

akbarmahfuzalam_0-1598711255402.png

 

 

 

 

@akbarmahfuzalam ,

If you look at my code, it was referring to removing from a collection that is the source data of the gallery - you cannot use RemoveIf() from a gallery name - you are deleting records from a data set, either a collection or a list. I suspect you do not want to remove them from a list which is why I specifically mentioned it needs to be a collection.

You need to have your gallery based on a collection of items from your list.

Do you understand the concept of what I am saying?

HI @akbarmahfuzalam ,

Just checking if you got the result you were looking for on this thread. Happy to help further if not.

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

Helpful resources

Announcements
PA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Welcome Super Users.jpg

Super User Season 2

Congratulations, the new Super User Season 2 for 2021 has started!

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Top Solution Authors
Top Kudoed Authors
Users online (752)