PalArrayCount

Note: This page includes content based on the F1 documentation for Centura development. It may be partially converted to support APF development, but should be regarded to be of uncertain actuality. It is provided as is. Eventually, it should be replaced by documentation available from within Visual Studio.

SalNumber PalArrayCount(SalArray<SalString> Array)

PalArrayCount method is counting items in an array returning the result. This method should be used by the framework and applications in places where the size of an array is needed.

Parameters

Name Description
String: Array The array to be counted.

Returns

The return value is the size of the array. E.g. the item count.

Comments

The SalArrayGetUpperBound method will return 0 both for an empty array and for an array with just one item. This problem is solved with the PalArrayCount method which also returns the item count rather than the upper bound.

Example

Set nCount = PalArrayCount( sArray )
While i < nCount
   <This should be the place to put the code that should be run once per array entry>
   Set i = i + 1<   Set i = i + 1
C# code
nValues = Int.PalArrayCount(sValues);
if (i < nValues) 
{
	// First entry without any delimiter
	sList = Vis.StrSubstitute(Vis.StrSubstitute(sValues[0], "%", "%25"), ",", "%2C");
	i = 1;
	while (i < nValues) 
	{
		// Loop trough all other entries and add them delimited to the list
		sList = sList + "," + Vis.StrSubstitute(Vis.StrSubstitute(sValues[i], "%", "%25"), ",", "%2C");
		i = i + 1;
	}
}