KBacca
4th February 2011, 05:00
OK - I'm developing a report and I needed an SQL select coded to get records from the tfgld106 table (Finalized Transactions).
I originally wrote my SQL query as:
select tfgld106.*
from tfgld106
where
tfgld106.leac INRANGE {:leac.f} and {:leac.t}
and tfgld106.fyer INRANGE {:fyer.f} and {:fyer.t}
and tfgld106.fprd INRANGE {:fprd.f} and {:fprd.t}
Where the leac.f/leac.t is the General Ledger Acct # range (From/To)
fyer.f/fyer.t is the Fiscal Year Range (From/To)
fprd.f/fprd.t is the Fiscal Period Range (From/To)
This worked just fine until we hit 2011 and when the report is run with a range like:
Fiscal Year FROM: 2010 TO: 2011
Fiscal Period FROM: 10 TO: 1
Obviously my SQL didn't account for this because of the Fiscal Period Range.
So - I modified the SQL to the following:
select tfgld106.*
from tfgld106
where
tfgld106.leac INRANGE {:leac.f} and {:leac.t}
and (tfgld106.fyer >= :fyer.f and tfgld106.fprd >= :fprd.f )
and (tfgld106.fyer <= :fyer.t and tfgld106.frpd <= :fprd.t)
For some reason - this Select Statement didn't return any rows - which I'm sure are there.
Can anyone see something I'm not doing right?
Does anyone have any suggestions or comments?
It seems to me that the logic in the SQL looks right....
It's been a long day and I'm afraid my mind is scattered right now...
Thanks in advance!
I originally wrote my SQL query as:
select tfgld106.*
from tfgld106
where
tfgld106.leac INRANGE {:leac.f} and {:leac.t}
and tfgld106.fyer INRANGE {:fyer.f} and {:fyer.t}
and tfgld106.fprd INRANGE {:fprd.f} and {:fprd.t}
Where the leac.f/leac.t is the General Ledger Acct # range (From/To)
fyer.f/fyer.t is the Fiscal Year Range (From/To)
fprd.f/fprd.t is the Fiscal Period Range (From/To)
This worked just fine until we hit 2011 and when the report is run with a range like:
Fiscal Year FROM: 2010 TO: 2011
Fiscal Period FROM: 10 TO: 1
Obviously my SQL didn't account for this because of the Fiscal Period Range.
So - I modified the SQL to the following:
select tfgld106.*
from tfgld106
where
tfgld106.leac INRANGE {:leac.f} and {:leac.t}
and (tfgld106.fyer >= :fyer.f and tfgld106.fprd >= :fprd.f )
and (tfgld106.fyer <= :fyer.t and tfgld106.frpd <= :fprd.t)
For some reason - this Select Statement didn't return any rows - which I'm sure are there.
Can anyone see something I'm not doing right?
Does anyone have any suggestions or comments?
It seems to me that the logic in the SQL looks right....
It's been a long day and I'm afraid my mind is scattered right now...
Thanks in advance!