Custom load methods

Custom load methods are similar to methods but can be used to populate a collection with records. Parameters and return values are handled the same way for methods that support them. The Infor SyteLine data source does not support output parameters or return values for custom load methods, although you can still check the MethodCompleted and Message values for execution failure.

The general syntax for a custom load method is shown in this example:


Dim retVal As IPFMethodReturnValueI = 
   context.Items.LoadFromMethod("methodName", 
      context.CreateMethodParameters(1, 2, 3))
If retVal.MethodCompleted = False Then
   ...do something with retval.Message...
End If

This clears the collection and reloads it with the data from the method. If the method fails, the current data remains. Fields returned from the method are mapped by name to the properties of the collection. If extra data is returned from the method that does not have a place in the collection, it is ignored. If some properties in the collection do not receive a value, they retain their default value.

The ItemLoaded event occurs as expected during a load from a custom load method.

If your script loads a collection in a FilterChanged event, make sure it sets the IsLoaded property to True, to ensure that the system does not overwrite the data.