PBNI Multi Dimensional Array
- How-to
- PBNI
- Ashley Swatton
- PowerBuilder
- Monday, 28 October 2019 04:52 PM UTC
Hi,
I'm creating a PBNI using the SDK and C. I would like to know how I can create a multi dimensional pbarray and set it's values. I have a single dimension array working fine but can't figure out what to create a 2 dimensional pbarray.
pbarray sgpinterface::floatArrayToPBArray(IPB_Session * session, float data[], int size) {
pbuint numDimensions = 1; // Set This To 2 For 2D Array
PBArrayInfo::ArrayBound bound;
bound.lowerBound = 1;
bound.upperBound = size;
NewBoundedSimpleArray(pbvalue_dec, numDimensions, &bound);
pblong dim[1];
for (int i = 0; i
dim[0] = i + 1; // What Should This Be For 2D Reference?
float floatVal = data[i];
char b[100];
sprintf_s(b, 100, "%f", floatVal);
NewDecimal();
SetDecimal(decval, (LPCSTR)b);
SetDecArrayItem(dataArray, dim, decval); // How To Use Dim Here To Set 2D Array Value?
}
return dataArray;
}
Find Questions by Tag
Helpful?
If a reply or comment is helpful for you, please don’t hesitate to click the Helpful button. This action is further confirmation of their invaluable contribution to the Appeon Community.