cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Aimén
Frequent Visitor

Patch & Update SharePoint problems -- Need Help !!

Hello PowerApps Community, 

I want to filter  "a collection and a SharePoint list" to Patch new values into SharePoint list or to Update the oldest one. 

 

Capture.PNG

 

This is my collection with reference column with took a Unique value. 


And then this my SharePoint list with the Same Colum. 

Capture1.PNG

 

Then I have to way to take to resolve this problem : 
1st : to  use ForAll & filter my two lists and if SharePointList.'Ligne de fabrication' = CollectionName.Lig ---> Update Else Patch (but the syntax is very horrible to settle). 
2st : Is Patch all value and delete the duplicated value but latest !!!! 



I want you to excuse my english, but I hope you receive my message 

Thank You for all of you

 

2 ACCEPTED SOLUTIONS

Accepted Solutions
WarrenBelz
Super User III
Super User III

Hi @Aimén ,

Firstly not the below is free-typed and I cannot test it and is more syntax guidance (so please adjust to your values and logic).

ForAll(
   atelier_info As aInfo,
   With(
   {
      wData:
      Lookup(
         StandardStatistique,
         'Linge de fabric' = aInfo.lig
      ).ID
   },
   Patch(
      StandardStatistique,
      If(
         !IsBlank(wData),
         {ID:aInfo.ID},
		 Defaults(StandardStatistique)
      ),
      {
         Field1:aInfo.Field1,
         Field2:aInfo.Field2,
         . . . . . . .
      }
   )
)

 

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.

View solution in original post

Aimén
Frequent Visitor

Hello @WarrenBelz , I find yesterday the solution and it's the same as you 
Here is it : 

ForAll(
    atelier_info;
    If(
        IsBlank(
            LookUp(
                Standard_Statistique;
                'Ligne de fabrication' = lig
            )
        );
        Patch(
            Standard_Statistique;
            Defaults(Standard_Statistique);
            {
                Département: depart;
                Atelier: atel;
                'Ligne de fabrication': lig;
                'Nombre d''approbation': nbre_appr;
                'Nombre de FOS': nbre_fos;
                'Nombre de FOScom': nbre_fos_com;
                'Nombre de FOS de ctl': nbre_fos_ctl;
                'Nombre de FOS Loto': nbre_fos_loto;
                'Nombre de LP': nbre_LP;
                'Nombre de LPcom': nbre_LP_Com;
                'Nombre Doc Tech': nbre_Doc_Tech;
                'Nombre des autres documents': nbre_autre
            }
        );
        Patch(
            Standard_Statistique;
            LookUp(
                Standard_Statistique;
                'Ligne de fabrication' = lig
            );
            {
                Département: depart;
                Atelier: atel;
                'Ligne de fabrication': lig;
                'Nombre d''approbation': nbre_appr;
                'Nombre de FOS': nbre_fos;
                'Nombre de FOScom': nbre_fos_com;
                'Nombre de FOS de ctl': nbre_fos_ctl;
                'Nombre de FOS Loto': nbre_fos_loto;
                'Nombre de LP': nbre_LP;
                'Nombre de LPcom': nbre_LP_Com;
                'Nombre Doc Tech': nbre_Doc_Tech;
                'Nombre des autres documents': nbre_autre
            }
        )
    )
)

 

Thank You so much for your answer, Cheers Up

View solution in original post

2 REPLIES 2
WarrenBelz
Super User III
Super User III

Hi @Aimén ,

Firstly not the below is free-typed and I cannot test it and is more syntax guidance (so please adjust to your values and logic).

ForAll(
   atelier_info As aInfo,
   With(
   {
      wData:
      Lookup(
         StandardStatistique,
         'Linge de fabric' = aInfo.lig
      ).ID
   },
   Patch(
      StandardStatistique,
      If(
         !IsBlank(wData),
         {ID:aInfo.ID},
		 Defaults(StandardStatistique)
      ),
      {
         Field1:aInfo.Field1,
         Field2:aInfo.Field2,
         . . . . . . .
      }
   )
)

 

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.

View solution in original post

Aimén
Frequent Visitor

Hello @WarrenBelz , I find yesterday the solution and it's the same as you 
Here is it : 

ForAll(
    atelier_info;
    If(
        IsBlank(
            LookUp(
                Standard_Statistique;
                'Ligne de fabrication' = lig
            )
        );
        Patch(
            Standard_Statistique;
            Defaults(Standard_Statistique);
            {
                Département: depart;
                Atelier: atel;
                'Ligne de fabrication': lig;
                'Nombre d''approbation': nbre_appr;
                'Nombre de FOS': nbre_fos;
                'Nombre de FOScom': nbre_fos_com;
                'Nombre de FOS de ctl': nbre_fos_ctl;
                'Nombre de FOS Loto': nbre_fos_loto;
                'Nombre de LP': nbre_LP;
                'Nombre de LPcom': nbre_LP_Com;
                'Nombre Doc Tech': nbre_Doc_Tech;
                'Nombre des autres documents': nbre_autre
            }
        );
        Patch(
            Standard_Statistique;
            LookUp(
                Standard_Statistique;
                'Ligne de fabrication' = lig
            );
            {
                Département: depart;
                Atelier: atel;
                'Ligne de fabrication': lig;
                'Nombre d''approbation': nbre_appr;
                'Nombre de FOS': nbre_fos;
                'Nombre de FOScom': nbre_fos_com;
                'Nombre de FOS de ctl': nbre_fos_ctl;
                'Nombre de FOS Loto': nbre_fos_loto;
                'Nombre de LP': nbre_LP;
                'Nombre de LPcom': nbre_LP_Com;
                'Nombre Doc Tech': nbre_Doc_Tech;
                'Nombre des autres documents': nbre_autre
            }
        )
    )
)

 

Thank You so much for your answer, Cheers Up

View solution in original post

Helpful resources

Announcements
PA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

Power Query PA Forum 768x460.png

Check it out!

Did you know that you can visit the Power Query Forum in Power BI and now Power Apps

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.

R2 (Green) 768 x 460px.png

Microsoft Dynamics 365 & Power Platform User Professionals

DynamicsCon is a FREE, 4 half-day virtual learning experience for 11,000+ Microsoft Business Application users and professionals.

Users online (1,310)