I created the code below, so that when it is online, it performs the updateif using as id the product direct in the database online.
If(Connection.Connected; UpdateIf('01_Products_All';UNIQUE_ID_PRODUCTS=BrowseGallery2.Selected.UNIQUE_ID_PRODUCTS; { Brand : DataCardValue1.Text; Quantity: Value(DataCardValue4.Text) } ); ClearCollect(LocalProductsAllOffline; UpdateIf(LocalProductsAll;UNIQUE_ID_PRODUCTS=BrowseGallery2.Selected.UNIQUE_ID_PRODUCTS; { Brand : DataCardValue1.Text; Quantity: Value(DataCardValue4.Text) } ));; SaveData(LocalProductsAll; "LPA");; SaveData(LocalProductsAllOffline; "LocPAoff"))
When offline, it updates a collection (LocalProductsAll), which was created in OnStart with online data. But I wanted only the updated products to be written to LocalProductsAllOffline.
ClearCollect(LocalProductsAllOffline; UpdateIf(LocalProductsAll;UNIQUE_ID_PRODUCTS=BrowseGallery2.Selected.UNIQUE_ID_PRODUCTS; { Brand : DataCardValue1.Text; Quantity: Value(DataCardValue4.Text) } ));;
Because when you go online again, it does not occur to execute the collection creation (LocalProductsAll), delete the updated values that were recorded.
The data that was updated would be saved in: LocalProductsAllOffline, to then send only the updated fields to sharepoint.
I need to write to the LocalProductsAllOffline table, only of the updated rows.
However, the code copies all lines from LocalProductsAll to LocalProductsAllOffline.
Hi AvenaFernando,
Not sure with the two collections LocalProductsAll and LocalProductsAllOffline, what’s the data saved in these two collections?
Please try if you could use a filter function to filter only the updated rows and update them to SharePoint list.
Best regards,
Mabel Mao
Hi @@v-yamao-msf
Not sure with the two collections LocalProductsAll and LocalProductsAllOffline, what’s the data saved in these two collections?
1. A collection to hold the online data, -> LocalProductsAll
2. A collection for the updated items, -> LocalProductsAllOffline
Understood?
In OnStart I create LocalProductsAll with columns structure and data online, and LocalProductsAllOffline I create only with the structure of the columns.
I have an UpdateIf in LocalProductsAll because it is this table when offline used in FormViewer or BrowseGallery1, so when updating offline, I have to show this data in some places (ex: BrowseGallery1).
ClearCollect(LocalProductsAllOffline; UpdateIf(LocalProductsAll;UNIQUE_ID_PRODUCTS=BrowseGallery2.Selected.UNIQUE_ID_PRODUCTS; { Brand : DataCardValue1.Text; Quantity: Value(DataCardValue4.Text) } ));; SaveData(LocalProductsAll; "LPA");;
After updating with updateif, I thought this record would go to the LocalProductsAllOffline collection, but it copies the entire table.
If creating a filter for only the updated product for the LocalProductsAllOffline collection, would it be best?
Please try if you could use a filter function to filter only the updated rows and update them to SharePoint list.
For this, I thought the way would be to add an update_field column (AddColumns) in the LocalProductsAll table?
So when I perform updateif write true to update_field?
And so when this data is updateif when offline, when I go online do I send to sharepoint only columns with column update_field = true?
The idea of creating a collection for:
A collection to hold the online date
A collection for the updated items
And had thought, informing about this with the post of Staff Carlos Figueira
Does the PowerApps solution have capability for offline working
User | Count |
---|---|
132 | |
132 | |
78 | |
75 | |
71 |
User | Count |
---|---|
210 | |
199 | |
64 | |
63 | |
53 |