Hi @SaimaRasheed,
Creating offline Apps for SQL Server data is not similar as the example article. There are many other aspects that we need to take into consideration.
Please take a look at the posts from Staff CarlosFigueira in the following thread:
Does the PowerApps solution has capaility for offline working
For the code in step 3, I will try to explain it:
If(Connection.Connected, // used to check connection status
ClearCollect(LocalTweets, // Collect the Online Data when connection is online,collection name is LocalTweets
Twitter.SearchTweet("PowerApps", {maxResults: 100}));
UpdateContext({statusText: "Online data"}) //Context variable used to show Online Status
,
LoadData(LocalTweets, "Tweets", true); //When connection is offline, load Data from Local cache file named "Tweets"
UpdateContext({statusText: "Local data"}) //Update the Status to offline
);
LoadData(LocalTweetsToPost, "LocalTweets", true); //Load tweets that need to be posted from local cache file called "LocalTweets"
SaveData(LocalTweets, "Tweets") //Save the LocalTweets collection into local cache file called "Tweets"
To build an offline App that would work for SQL Server, basically we need to at least create 4 collections to work with it.
1. A collection to hold the online data,
2. A collection for the newly added items,
3. A collection for the updated items,
4. A collection for the deleted items,
Depends on the connection status, we need to either update the data source drectly, or update the local collection (then "sync" it with the Datasource when status is online).
Regards,
Michael