Appframe Knowledge Base


1 hits
9

Loading data asynchronous in Appframe

In release Appframe 430 there are support for loading data, forms, reports and executing procedures asynchronously. The framework takes care of loading forms, opening reports and loading data in child datasource. But when it comes to dataobjects that doesn't have a master object, dataobjects that you would like to manually, procedures or fetching data outside dataobject, there are some changes required in order to load async.

'Example 1: Loading dataobject async
aviw_Testing_Async.refreshDataSourceAsync()


'Example 2: Loading dataobject async and working with data
Private Async Sub LoadTestData()
     Dim vTask = aviw_Testing_Async.refreshDataSourceAsync()
     Await vTask
     'do your stuff
End Sub


'Example 3: Executing procedure
Private Async Sub ExecuteTestProcedure()
     Dim vProc = new afProcedureCall("astp_Teting_Async")
     vProc.Parameters.Add("Test","Test")
     Dim vDataSet as DataSet = Await vProc.ExecuteAsync()
     'do your stuff
End Sub



'Example 4: Executing procedure
Private Async Sub LoadTestData()
     Dim vRec= new afRecordSource("aviw_Testing_Async")
     vRec.MaxRecords = -1
     vRec.SelectColumns.Add("Test")
     Dim vDataTable as DataTable = Await vRec.GetDataAsync()
     'do your stuff
End Sub


'Adding status in statusbar for tasks
 Dim vTask = aviw_Testing_Async.refreshDataSourceAsync()
CR3.AddStatus("Loading data",vTask)
' or
CR3.AddStatus(CR3.TaskType.Data,vTask)

'Locking form using a task
Dim vProc as new afProcedureCall("astp_CRM_Test");
Dim vTask = vPro.ExecuteAsync();
Me.Lock(vTask);



win · Perma link post comment Posted by: Peter Øren (02-sep-2014)

Tomas Dambrauskas :
A step forward... (12-sep-2014)