cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Advocate II
Advocate II

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
Highlighted
Community Support
Community Support

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.

View solution in original post

3 REPLIES 3
Highlighted
Community Support
Community Support

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.
Highlighted
Advocate II
Advocate II

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

Highlighted
Community Support
Community Support

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.

View solution in original post

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

Power Platform ISV Studio

Power Platform ISV Studio

ISV Studio is designed to become the go-to Power Platform destination for ISV’s to monitor & manage published applications.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Tech Marathon

Maratón de Soluciones de Negocio Microsoft

Una semana de contenido con +100 sesiones educativas, consultorios, +10 workshops Premium, Hackaton, EXPO, Networking Hall y mucho más!

Top Solution Authors
Top Kudoed Authors
Users online (6,072)