Datakat
asked on
Capture list of Top N group sort
I have a report that shows sales by department. Within each department, it lists by group the top 5 stores. I need to pass the store numbers to a subreport after they have all printed to do some other calculations using another table that won't link to this one. How do I capture those top 5 store numbers? Or is it even possible to send them as a list to the subreport?
SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
ASKER
I have converted the array to characters successfully. And used shared array to get it to subreport. I wonder how I would do what James0628 suggested to convert it to numbers and send that to subreport? Details?
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
FWIW, Raghavendra probably should have gotten some points as well, since he was the first to suggest saving the numbers in a string. I handled it a bit differently, but it was the same basic idea. If you like, you can ask to have the question reopened, and then you can split the points between the three of us.
James
James
You can use arrays in CR formulas, but the result of a formula can't be an array, so you can't, for example, pass an array to a subreport parameter by linking a formula to the parameter. If you want to give a list of values to a subreport, then you have to use one of the methods that the others described.
Putting the list in a string doesn't necessarily have to hurt the subreport's performance. If the store number field is a number, then, as Raghavendra said, converting that field to a string in the subreport record selection formula could slow things down, because the subreport may have to read the records for every store and then convert the store number to a string to see if it's in the list (rather than ask the db to only send the records for the desired stores). However, rather than convert the store number to a string, you can convert the values in the string from the main report back into numbers. The difference is that CR should do that just once (for each subreport), and then it can send the list of numbers to the db so that the subreport only reads those stores.
I can provide more details if you like.
James