Showing posts with label Powerapps. Show all posts
Showing posts with label Powerapps. Show all posts

Saturday, August 3, 2024

Concurrent operations in Power Apps

Concurrent operations in Power Apps can be used to run multiple operations simultaneously, which can improve the performance and responsiveness of your app. The Concurrent function allows you to execute multiple operations at the same time, which is particularly useful when you have independent tasks that can be processed in parallel.


Using the Concurrent Function

The Concurrent function runs multiple formulas at the same time. Each formula runs independently, and the app doesn't wait for one formula to complete before starting the next one. Here's the basic syntax:


PowerApps


Concurrent(

    Formula1,

    Formula2,

    ...

)

Example Scenarios

Loading Data from Multiple Sources:

If your app needs to fetch data from multiple data sources, you can use the Concurrent function to load them simultaneously, reducing the overall load time.


PowerApps


Concurrent(

    ClearCollect(Collection1, DataSource1),

    ClearCollect(Collection2, DataSource2),

    ClearCollect(Collection3, DataSource3)

)

Updating Multiple Records:

If you need to update multiple records in different data sources or even the same data source, you can use Concurrent to perform these updates at the same time.


PowerApps


Concurrent(

    Patch(DataSource1, First(DataSource1), {Field1: "Value1"}),

    Patch(DataSource2, First(DataSource2), {Field2: "Value2"})

)

Complex Calculations and Data Processing:

When your app performs complex calculations or data processing tasks that can be broken down into independent parts, use Concurrent to run these parts simultaneously.


PowerApps


Concurrent(

    ClearCollect(Result1, Filter(DataSource, Condition1)),

    ClearCollect(Result2, Filter(DataSource, Condition2))

)

Important Considerations

Independent Tasks: Ensure that the tasks you run concurrently do not depend on each other. If one task needs the result of another, you should not run them concurrently.

Error Handling: Since Concurrent does not wait for one formula to finish before starting the next, error handling can become more complex. Make sure to include appropriate error handling mechanisms for each concurrent task.

Performance: While Concurrent can improve performance by running tasks simultaneously, it may also increase the load on the client device and data sources. Test the app thoroughly to ensure it performs well under concurrent loads.

Example: Using Concurrent in a Power App

Here’s an example of using Concurrent in a Power App to load data from three different SharePoint lists simultaneously:


PowerApps


Concurrent(

    ClearCollect(Employees, 'Employees List'),

    ClearCollect(Departments, 'Departments List'),

    ClearCollect(Projects, 'Projects List')

)

In this example, the app will simultaneously clear and collect data from the three SharePoint lists (Employees, Departments, and Projects). This can significantly reduce the time it takes to load data into the app.


By using the Concurrent function effectively, you can improve the performance and responsiveness of your Power Apps canvas apps, especially when dealing with multiple independent data operations.

How to create an Offline-Enabled Canvas App Power Apps?

 Canvas apps developed in Power Apps are primarily designed to work online, as they often depend on cloud-based data sources like SharePoint, Common Data Service (Dataverse), SQL Server, etc. However, there are ways to enable limited offline functionality in a Power Apps canvas app. This involves using the local storage capabilities within the app to save data locally when offline and then sync it back to the cloud when online.


Steps to Create an Offline-Enabled Canvas App:

Save Data Locally When Offline:


Use the SaveData function to store data locally on the device.

Example:

PowerApps


SaveData(CollectionName, "LocalCollectionName")

Load Data from Local Storage When Online:


Use the LoadData function to retrieve locally stored data.

Example:

PowerApps


LoadData(CollectionName, "LocalCollectionName", true)

Check Network Connectivity:


Use the Connection signal to check if the device is online or offline.

Example:

PowerApps


If(Connection.Connected,

   // Code to execute when online

   Notify("You are online", NotificationType.Success),

   // Code to execute when offline

   Notify("You are offline", NotificationType.Error)

)

Sync Data When Back Online:


When the device is back online, sync the locally stored data with the cloud.

Example:

PowerApps

If(Connection.Connected,

   ForAll(LocalCollectionName,

       Patch(DataSource, Defaults(DataSource), {

           Field1: ThisRecord.Field1,

           Field2: ThisRecord.Field2,

           ...

       })

   );

   Clear(LocalCollectionName);

   RemoveData("LocalCollectionName");

)


Example Scenario:

Offline Form Submission:


Users can fill out a form while offline.

Save the form data locally using SaveData.

Online Data Sync:


When the app detects that it is back online, use LoadData to retrieve the locally stored data and sync it with the cloud data source.

Notify users of the sync status.

Considerations:

Data Storage Limits: There are limits on how much data you can store locally using SaveData. Make sure to handle large datasets appropriately.

Concurrency and Data Conflicts: When syncing data back to the cloud, handle potential conflicts that may arise due to concurrent data changes.

User Experience: Provide clear feedback to users about the offline/online status and any actions they need to take.

By following these steps, you can create a Power Apps canvas app that provides some level of offline functionality, allowing users to continue working even without an internet connection and sync their work once they are back online.

Saturday, December 5, 2020

Difference between the workflows and power Automate/Power Apps?


Difference between the workflows and power Automate/Power Apps


Workflow

  • SP 2010 workflows executed runtime
  • SP 2013 workflows runs workflow manger independently 
  • It runs endlessly
  • RestAPI calls are support
  • History maintains in workflow history list
  • impersonation step to act as a different user
  • Workflow types: List workflow, site workflow and reusable workflow

Power Automate:

  • It runs for 30 days only
  • “service account” user with a Power Automate license and run these flows with that user account
  • History maintains in power automate dashboard
  • impersonation step is not available
  • Types: Single approval , sequential approval and parallel approvals


Tuesday, December 1, 2020

Difference between PowerApps and MS Flow?

 PowerApps:

  • Repeatable operation occurred frequently and it takes a lot of time in total of a user 
  • Integrate different components or platforms of your digital workplace 
  • Quick time by cutting down the overall implementation time
  • Task-oriented processes can be implemented on PowerPlatform.
  • Improve productivity in your Office365 environment
  • Security and contextual data trimming is important for us
  • Business process implemented in Excel 

MS flow

  • User friendly drag & drop
  • Not enough integrators
  • Requires developers
  • The designers were not browser based products

  • Not mobile friendly

  • Ability to export and import workflows