Calculate Min,Max values from multi-dimensional arrays

2 posts in this topic

Guest BinaryVision

I have the results of a SQL query returned to an array via the GetRows method. Then I need to go back to the array and determine the min and max values of the first value (column) of each record returned. It appears that the _ArrayMin and _ArrayMax functions are only designed to work with a one-dimensional array. Is there an easier way to do this other than looping through the first value in every record and assigning that to a one-dimensional array to then run the min/max functions on? Thanks for any input in advance!

Share this post

Link to post

Share on other sites

Guest BinaryVision

I found a quick workaround for this type of situation. Since I'm already using ORDER BY in my SQL query and the first value of each row is what I want to look at, I can just take the [0][0] position as the Min number and [uBound($qryresult,1) - 1][0] as the Max number. I wanted to do this without hitting the database again which is why I'm trying to do this in the code. Cheers!