cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
SaimaRasheed
Level: Powered On

PowerApps with SQL server connection - Offline

Hello,

 

I am trying to use PowerApps offline mode for my SQL server database and I am having hard time to code it. My SQL server DB has two fields Name and ID. 
Can someone please help me on how to code it on PowerApps, for users  to be able to use it offline when entering in new data for my fields.

 

Thanks!

1 ACCEPTED SOLUTION

Accepted Solutions
Community Support Team
Community Support Team

Re: PowerApps with SQL server connection - Offline

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

Community Support Team _ Michael Shao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
3 REPLIES 3
Community Support Team
Community Support Team

Re: PowerApps with SQL server connection - Offline

Hi @SaimaRasheed,

 

Have you checked the following documentation?

Develop offline-capable apps with PowerApps

 

Regards,

Michael

Community Support Team _ Michael Shao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
SaimaRasheed
Level: Powered On

Re: PowerApps with SQL server connection - Offline

Yes but I am getting a bunch of errors from using the code that is provided for Step3

If(Connection.Connected,
Collect('[dbo].[TestTable]', TestTable);
UpdateContext({statusText: "Online data"})
,
LoadData('[dbo].[TestTable]', "Name", true);
LoadData('[dbo].[TestTable]', "GPID", true);
UpdateContext({statusText: "Local data"})
);
LoadData(Test, "Name", true);
LoadData(Test, "GPID", true);
SaveData(Test, "Name");
SaveData(Test, "Name");

And I am not sure why 
My local cache file that I created is called Test

Thanks,
Saima

Community Support Team
Community Support Team

Re: PowerApps with SQL server connection - Offline

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

Community Support Team _ Michael Shao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
firstImage

Watch Sessions On Demand!

Continue your learning in our online communities.

SecondImage

PowerApps Monthly Community Call

Next Wednesday, August 21st at 8am PDT

Top Community Contributors for July 2019

Top Community Contributors for July 2019

Let's thank our top community contributors

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

FirstImage

Power Platform World Tour

Coming to a city near you

thirdimage

PowerApps Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

FourthImage

Join PowerApps User Group!!

Connect, share, and learn with your peers year-round

FifthImage

Dynamics 365 and Power Platform April 2019 Release notes

Features releasing from April 2019 through September 2019!

SixthImage

Power Summit Australia 2019

August 20-23rd 2019

Users Online
Currently online: 62 members 4,695 guests
Please welcome our newest community members: