The Solution: Concurrent Function
The Concurrent function allows you to run multiple operations at the same time, dramatically reducing load times.
Before (Sequential)
// Each call waits for the previous one
ClearCollect(colCustomers, Customers);
ClearCollect(colOrders, Orders);
ClearCollect(colProducts, Products);
After (Parallel)
Concurrent(
ClearCollect(colCustomers, Customers),
ClearCollect(colOrders, Orders),
ClearCollect(colProducts, Products)
)
Advertisement
Performance Impact
If each API call takes 1 second:
- Sequential: 3 seconds total
- Concurrent: ~1 second total (limited by slowest call)
Best Practices
- Use Concurrent in your App.OnStart for initial data loading
- Group related but independent data fetches together
- Don't use Concurrent if one operation depends on another's result
- Combine with loading indicators for better UX
Pro tip: Combine Concurrent with App.StartScreen to show users a loading screen while data loads in the background.