Putting together a report and would appreciate some guidance. I'm working entirely within Report Script. I need to have a dynamic array to store some string values that I can check against as I'm processing each line of the report. From what I've read up on I have to allocate and deallocate memory for this, which gets me a bit nervous so I want to make sure I'm doing it properly. The pseudocode for what I want to do would go something like this:
Within my before.layout of my detail section I could call the functions to decide what to do with the currently processing record. Then in an after.field section I'd essentially want to zero out the array values to start fresh. End of report, totally deallocate the array (if it's necessary).
Is this even possible? Or better yet, advisable? Any code examples of doing this properly would be greatly appreciated.
Kind regards,
Rich
Code:
CREATE EMPTY ARRAY to store string values that are 9 characters long
DEFINE FUNCTION addToArray(newElement)
ALLOCATE/RESIZE the current array
ADD newElement to array
END FUNCTION
DEFINE FUNCTION existsInArray(stringValue)
FOR all indexes of array
IF stringValue = current index's value THEN
RETURN true
END IF
END FOR
RETURN false
END FUNCTION
DEFINE FUNCTION destroyArray
FREE all memory allocated to the array
END FUNCTION
Is this even possible? Or better yet, advisable? Any code examples of doing this properly would be greatly appreciated.
Kind regards,
Rich