I have a report based on a SQL view on a SAP database, with this formula field @Wanneer in the detail section:
if {Omzet_ALL.DocDate} <= CurrentDate and {Omzet_ALL.DocDate} >= dateadd("yyyy",-1,currentdate) then 0
else if {Omzet_ALL.DocDate} <= dateadd("yyyy",-1,currentdate) and {Omzet_ALL.DocDate} >= dateadd("yyyy",-2,currentdate) then 1
else if {Omzet_ALL.DocDate} <= dateadd("yyyy",-2,currentdate) then 2
I'm grouping on field CC (SAP B1 CardCode).
In the same group I've put 3 other fields:
Diff: Distinct count of @Wanneer
Min: Minimum of @Wanneer
Max: Maximum of @Wanneer
The last field in the group section is @WonLost:
stringvar X := '';
if DistinctCount (
{@Wanneer}, {Omzet_ALL.CC}) = 3 then X := 'Uit lijst';
if DistinctCount (
{@Wanneer}, {Omzet_ALL.CC}) = 2 and Minimum (
{@Wanneer}, {Omzet_ALL.CC}) = 0 and Maximum (
{@Wanneer}, {Omzet_ALL.CC}) = 1 then X := 'Uit lijst';
if DistinctCount (
{@Wanneer}, {Omzet_ALL.CC}) = 2 and Minimum (
{@Wanneer}, {Omzet_ALL.CC}) = 0 and Maximum (
{@Wanneer}, {Omzet_ALL.CC}) = 2 then X := 'Won';
if DistinctCount (
{@Wanneer}, {Omzet_ALL.CC}) = 2 and Minimum (
{@Wanneer}, {Omzet_ALL.CC}) = 1 and Maximum (
{@Wanneer}, {Omzet_ALL.CC}) = 2 then X := 'Lost';
if DistinctCount (
{@Wanneer}, {Omzet_ALL.CC}) = 1 and Minimum (
{@Wanneer}, {Omzet_ALL.CC}) = 0 then X := 'Won';
if DistinctCount (
{@Wanneer}, {Omzet_ALL.CC}) = 1 and Minimum (
{@Wanneer}, {Omzet_ALL.CC}) = 1 then X := 'Lost';
if DistinctCount (
{@Wanneer}, {Omzet_ALL.CC}) = 1 and Minimum (
{@Wanneer}, {Omzet_ALL.CC}) = 2 then X := 'Long lost';
X
"Uit lijst" meaning it should be dropped from the list (not implemented yet).
The result is like this:
Now I want to sort on the field @WonLost (last column).
Is that possible?
Thanks for any help.