I have a report which I'm working on which has an input parameter (strSchoolIds) that is a string of comma separated list of unique schoolIds. I'd like to convert this string into a number array which can then be used in the record selection formula. Here is what I've come up with so far. But whenever I view the report just the first schoolId gets used.
Example input string for strSchoolIds might be 1,3,63,237,281
The resulting SQL query I'd like would be similiar to this
Select name, phone, numStudents
from schools
where schoolId in (1,3,63,237,281) and active =1
My current code is:
StringVar Array schools := Split ({?strSchoolIds}, ",");
Local NumberVar arrLen := UBound( schools );
Local NumberVar i := 1;
NumberVar Array schoolIdsArray;
While i <= arrLen Do
(
schoolIdsArray[i] = ToNumber(Trim(schools[i]));
i := i + 1;
);
{Schools.schoolId} in schoolIdsArray
and {Schools.active} = 1;