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

Update only dates shown in the gallery

I've an app where we can filter and export to MSExcel some data in the gallery and I'd like know if When I export this gallery, is it possible to add the word "processed" in the Status column of the sharepoint?

3.png

 

Thanks!!!

4 ACCEPTED SOLUTIONS

Accepted Solutions
BCLS776
Super User
Super User

Instead, try this one. The last code I posted incorrectly referenced the record:

ForAll(SharePoint_gtw_BCN,
    Patch(SharePoint_gtw_BCN, ThisRecord, {Status: "Processed"})
)

As well, you've got some error checking on your CSV export and you can include this code those checks. The ForAll will return a table of records, and one way to check that it ran is that the table will not be empty. In other words, !IsEmpty on the ForAll will return true.

 

Bryan

 

Bryan

 

_________________________________________________________________________________________
Help the community help more users by choosing to "Accept as Solution" if this post met your needs. If you liked the post and want to show some appreciation, please give it a Thumbs Up.

View solution in original post

BCLS776
Super User
Super User

OK, one more try:

With({aTable: SharePoint_gtw_BCN},
    ForAll(aTable,
        Patch(SharePoint_gtw_BCN, ThisRecord, {Status: "Processed"})
    )
)
_________________________________________________________________________________________
Help the community help more users by choosing to "Accept as Solution" if this post met your needs. If you liked the post and want to show some appreciation, please give it a Thumbs Up.

View solution in original post

FDOSSANT
Regular Visitor

Perfect!!!!! Thanks, Bryan!!!!

View solution in original post

BCLS776
Super User
Super User

@FDOSSANT, in response to your private message about adjusting this code to affect only the items from the Sharepoint List that are returned by your filter, here's how we do it:

With({aTable: Filter(
    SharePoint_gtw_BCN;
    StartsWith(
        Status;
        "-"
    );
    StartsWith(
        Title;
        TextSearchBox1.Text
    );
    StartsWith(
        'DEST.';
        TextSearchBox2.Text
    );
    StartsWith(
        BRANCH.Value;
        TextSearchBox3.Text
    );
    If(
        !IsBlank(DatePicker1.SelectedDate);
        'FECHA ENTREGA' = DatePicker1.SelectedDate;
        true
    );
    If(
        !IsBlank(DatePicker1.SelectedDate);
        'FECHA ENTREGA' = DatePicker1.SelectedDate;
        true
    )
    )}, // This creates the table of records to edit

// This edits the records' Status to show "Processed"
    ForAll(aTable,
        Patch(SharePoint_gtw_BCN, ThisRecord, {Status: "Processed"})
    )
)

We replace the Sharepoint List in the With() statement with the filter code. 

 

Hope this helps,

Bryan

_________________________________________________________________________________________
Help the community help more users by choosing to "Accept as Solution" if this post met your needs. If you liked the post and want to show some appreciation, please give it a Thumbs Up.

View solution in original post

10 REPLIES 10
BCLS776
Super User
Super User

If you use the Export functionality available within Sharepoint to directly export to IQY or CSV, then I don't believe it is possible to update the Status column at the same time. However, if you do this export using a Power App (integrated with the list or using a connector), then yes you can update the Status column as part of the app's functionality.

 

If you plan to use an app, I recommend searching on here for something like "exporting to a CSV", which should bring up multiple solutions for converting tabular data into a CSV for import into Excel.

 

Hope this helps,

Bryan

_________________________________________________________________________________________
Help the community help more users by choosing to "Accept as Solution" if this post met your needs. If you liked the post and want to show some appreciation, please give it a Thumbs Up.

Hello Bryan!!! thanks for quick reply and sorry for my poor explanation before.... In fact, the app has a button (excel icone) linked to a flow in power automate.

1.png

 

This is the flow in power Automate:

4.JPG

Then, what I'd really like is know if is possible to "add" the update to column "status" in the same flow. If it is possible, do you know what steps in power automate can I use do do it?

 

thanks one more time!!!!

BCLS776
Super User
Super User

It looks like your flow is a standalone component and doesn't know or care where its data comes from. For that reason, I would not modify the flow to update the Status column. Instead, use your Power App to do this. Your flow returns a completed value of true, so use that as a condition to run the following code immediately after your ExportCSV.Run():

ForAll(mySPList As aItem,
    Patch(mySPList, aItem, {Status: "Processed"})
)

This will change the Status column for all records in the Sharepoint List to show the string "Processed"

 

Bryan

_________________________________________________________________________________________
Help the community help more users by choosing to "Accept as Solution" if this post met your needs. If you liked the post and want to show some appreciation, please give it a Thumbs Up.
FDOSSANT
Regular Visitor

 

Thanks once again, Bryan!!

 

I'm trying do what you've said, but I've an error like as: "This function cannot be executed in the same data source that is used in ForAll"  This is the code that I have (including you soluction). Can you see where is the error?

 

Set(
    ExportCSVVar;
    ""
);;
ForAll(
    BrowseGallery1.AllItems;
    Collect(
        ExportCSVCol;
        {
            Tipo: TipoEnviogal.Text;
            Cliente: Clientegal.Text;
            MAWB: MAWBgal.Text;
            HAWB: HAWBgal.Text;
            Bultos: btsgal.Text;
            Peso: Pesogal.Text;
            CBM: VOLgal.Text;
            Dest: Destgal.Text;
            RX: RXgal.Text;
            ETD: ETDgal.Text;
            EDD: EDDgal.Text;
            KC: KCgal.Text;
            Transp: Transpgal.Text;
            HUB: HUBgal.Text;
            BRANCH: Branchgal.Text;
            Despacho: Despachogal.Text;
            Terminal: Terminalgal.Text;
            Observaciones: Observacionesgal.Text
        }
    )
);;
Set(
    ExportCSVVar;
    Concat(
        ExportCSVCol;
        Tipo & ";" & Cliente & ";" & MAWB & ";" & HAWB & ";" & Bultos & ";" & Peso & ";" & CBM & ";" & Dest & ";" & RX & ";" & ETD & ";" & EDD & ";" & KC & ";" & Transp & ";" & HUB & ";" & BRANCH & ";" & Despacho & ";" & Terminal & ";" & Observaciones & Char(10)
    )
)
;;Set(SuccesssVar;ExportCSV.Run("CSVFile";ExportCSVVar).completed);;


ForAll(SharePoint_gtw_BCN As aItem;
    Patch(SharePoint_gtw_BCN; aItem; {Status: "Processed"})
)


If(SuccesssVar="true";
Launch
("https://dbschenker-my.sharepoint.com/:x:/p/fernando_dossantos/EZKfXKlmpfxKgZ7Z9kI_FhUBXsT_hbNfBzndh6lewMr3Pw?e=USCXYW&Download=1"))

 

 

Thanks for your support!!

BCLS776
Super User
Super User

Instead, try this one. The last code I posted incorrectly referenced the record:

ForAll(SharePoint_gtw_BCN,
    Patch(SharePoint_gtw_BCN, ThisRecord, {Status: "Processed"})
)

As well, you've got some error checking on your CSV export and you can include this code those checks. The ForAll will return a table of records, and one way to check that it ran is that the table will not be empty. In other words, !IsEmpty on the ForAll will return true.

 

Bryan

 

Bryan

 

_________________________________________________________________________________________
Help the community help more users by choosing to "Accept as Solution" if this post met your needs. If you liked the post and want to show some appreciation, please give it a Thumbs Up.
FDOSSANT
Regular Visitor

hello Bryan!!! The flow to export to excel is working well, but unfortunately I've again the message saying something like that: "This function cannot be executed in the same data source that is used in ForAll"...

 

5.JPG

 

my sharepoint list is called: SharePoint_gtw_BCN... And I don't know what will be the other origen data List...

 

7.JPG

I guess that I need to review all the code to find it.

 

Thanks once again!!!

BCLS776
Super User
Super User

OK, one more try:

With({aTable: SharePoint_gtw_BCN},
    ForAll(aTable,
        Patch(SharePoint_gtw_BCN, ThisRecord, {Status: "Processed"})
    )
)
_________________________________________________________________________________________
Help the community help more users by choosing to "Accept as Solution" if this post met your needs. If you liked the post and want to show some appreciation, please give it a Thumbs Up.
FDOSSANT
Regular Visitor

Perfect!!!!! Thanks, Bryan!!!!

BCLS776
Super User
Super User

@FDOSSANT, in response to your private message about adjusting this code to affect only the items from the Sharepoint List that are returned by your filter, here's how we do it:

With({aTable: Filter(
    SharePoint_gtw_BCN;
    StartsWith(
        Status;
        "-"
    );
    StartsWith(
        Title;
        TextSearchBox1.Text
    );
    StartsWith(
        'DEST.';
        TextSearchBox2.Text
    );
    StartsWith(
        BRANCH.Value;
        TextSearchBox3.Text
    );
    If(
        !IsBlank(DatePicker1.SelectedDate);
        'FECHA ENTREGA' = DatePicker1.SelectedDate;
        true
    );
    If(
        !IsBlank(DatePicker1.SelectedDate);
        'FECHA ENTREGA' = DatePicker1.SelectedDate;
        true
    )
    )}, // This creates the table of records to edit

// This edits the records' Status to show "Processed"
    ForAll(aTable,
        Patch(SharePoint_gtw_BCN, ThisRecord, {Status: "Processed"})
    )
)

We replace the Sharepoint List in the With() statement with the filter code. 

 

Hope this helps,

Bryan

_________________________________________________________________________________________
Help the community help more users by choosing to "Accept as Solution" if this post met your needs. If you liked the post and want to show some appreciation, please give it a Thumbs Up.

Helpful resources

Announcements
Microsoft 365 Conference – December 6-8, 2022

Microsoft 365 Conference – December 6-8, 2022

Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.

Difinity Conference 2022

Difinity Conference 2022

Register today for two amazing days of learning, featuring intensive learning sessions across multiple tracks, led by engaging and dynamic experts.

European SharePoint Conference

European SharePoint Conference

The European SharePoint Conference returns live and in-person November 28-December 1 with 4 Microsoft Keynotes, 9 Tutorials, and 120 Sessions.

Power Apps Ideas

Check out the New Ideas Site

We are excited to announce a new way to share your ideas for Power Apps!

Top Solution Authors
Top Kudoed Authors
Users online (5,165)