开发者

How can I specify an arbitrary sort order without grouping?

I've been tasked with cleaning up a report that shows a summary of ticket sales by payment method used. One of the requirements is that I put the "Cash/Check" category on the bottom of the list, with all of the di开发者_如何学编程fferent credit cards above it. Using the group options to set a specified order won't work, because all of the payment types other than Cash/Check can change based on the client's specifications, so I can't create individual groups for each payment type and then put them in order. What I need is a way to put an ordered list of known payment types at the bottom or top of the list, followed by an unordered (or at least not explicitly ordered) list of unknown payment types. I haven't been able to find a good way to do this on the internet where there are unknown items involved. Any thoughts?


Either add an independent sequence field or sort by your value with a prefix added to your targeted value that ensures it's at the bottom of the list.

In this example, I want the resDesc value sorted alphabetically, unless the resSupCode value = 0, in which case I want it sorted first, so I append a space to the title:

if {vw_rpt_waitlist.resSupCode} < 1 then
    formula = Switch ({vw_rpt_waitlist.resSupCode} = -1, "Total, No Residence Listed", _
                      {vw_rpt_waitlist.resSupCode} = 0," " + {@xtab_title} + " Total")
else
    formula = {vw_rpt_waitlist.resDesc}
end if


Would it work for you to create a formula that returned 1 for the first one in the list, 2 for the second one in the list, and so on until you return 8 (or 12, or 1000, or whatever) for everything else, and then tell Crystal to sort on that formula instead of the payment type field?


Embed the cash/check query in a sub-report. Add it the Report Footer section.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜