Passing array data between PODS methods and M-Business JavaScript engine

If you want to pass array data to or return it from PODS methods called by M-Business JavaScript engine, you must implement an instance of the PODSArray interface. M-Business Client provides a generic implementation of PODSArray that you can access through the PODSAvantGo object's createStdArray( ) method. This approach requires filling in each location as a PODSVariant.

If the data that you want to return is already an array in the C code, you can improve speed and memory performance by implementing a PODSArray object around your data in place. See PODSArray object.

Below is an example of using createStandardArray() to create a four-element array:

PODSArray *newArray; 
PODSVariant *element;

newArray = PODScreateStdArray(podsPod.avantgo, 4); 
element = (PODSVariant *) malloc(sizeof(PODSVariant));

element->vt = PODS_STRING; 
element->u.strVal = "Data"; 
PODSsetElement(newArray, 0, element); 
element->u.strVal = "String"; 
PODSsetElement(newArray, 1, element); 
element->vt = PODS_INT32; 
element->u.i32Val = -9; 
PODSsetElement(newArray, 2, element); 
element->vt = PODS_UINT32; 
element->u.u32Val = 42; 
PODSsetElement(newArray, 3, element);

free(element); 
return newArray; 
}