MOD Function?

jennid

Member
Does Progress have a mod or most frequently used function? For example, say I have a table or temp table with a field in it called order_qty. Is there a function I could use to show me the most popular value in order_qty? Like if the quantity of 100 has been ordered 12 times and the qty of 500 has been ordered 15 times, it would return the most frequently used value of the two?

If not, I can easily write logic to determine which value was used more, but wasn't sure if there was a built in Progress function for this.

Thanks,

Jenni
 

jennid

Member
Correction to my typo...it should be "mode" not "mod". It's the most frequently used number I am referring to, not remainder after division. Sorry for any confusion....
 

jennid

Member
Thanks. I suspected as much but one of our newer programmers asked the question and I wanted to make sure I was correct in saying no.
 

tamhas

ProgressTalk.com Sponsor
Note, however, that the right index on a temp-table can make finding such a value trivial. Just scan through the lines building a TT of order qty and count and index the count descending and pick off the top row.
 

jennid

Member
Agreed. We have a new programmer here and I had shown him how to do just what you suggested...creating a temp table with the right index. He asked if there was a mode function in progress that could be used. Just wanted to make sure I was correct in saying no. Glad to see that my thoughts were confirmed by the replies to this post. Thanks much.
 
Top