Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: HELP please! Array select statement driving me mad Post Reply Post New Topic
Author Message
kcat
Newbie
Newbie
Avatar

Joined: 25 Jul 2010
Location: United Kingdom
Online Status: Offline
Posts: 3
Quote kcat Replybullet Topic: HELP please! Array select statement driving me mad
     Posted: 25 Jul 2010 at 11:24pm

Dear all,

I have a select statement nightmare, the database I'm reporting on has no published schema and a host of confused reporters. I've almost cracked our reporting problem but the records I'm reporting on are missing an important indicator so I need as a final step in my select stement to work out if the last (max date) of any line record relating to the main record is in the current financial year. The section in blue below is where I am stuck... any assistance greatfully recieved!
 
If IsNull({NMLTRX.JVREF})
then
{Available_.Dept} = "London Capital Development" and
{NMLTRX.PERIOD} > "101100" and
{NMLTRX.GLCODE} startswith "1A"
else
If {RSSPOHEAD.ORD_DATE} > 20100331
then
{Available_.Dept} = "London Capital Development" and
{NMLTRX.PERIOD} > "101100" and
{NMLTRX.GLCODE} startswith "1A"
else
for {NMLTRX.JVREF} as Interger = 0000001 - 9999999
 {Available_.Dept} = "London Capital Development" and
 {NMLTRX.GLCODE} startswith "1A" and
 Max ({RSSPOLINE.REC_DATE}) > 20100331
next {NMLTRX.JVREF}
 
Thanks
Kcat
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4374
Quote lockwelle Replybullet Posted: 26 Jul 2010 at 3:23am

wrong code for a 'for' loop, not to mention, CR is only looking at 1 record, and won't read through the records in this method, and since you never reference jvref in the loop, all the data is always the same, so might as will just do an if statement and be done with it.

best solution for what you are doing is a stored proc on the database, then you can query the data and just get what you want.
 
HTH
IP IP Logged
kcat
Newbie
Newbie
Avatar

Joined: 25 Jul 2010
Location: United Kingdom
Online Status: Offline
Posts: 3
Quote kcat Replybullet Posted: 27 Jul 2010 at 1:59am
Thanks for the advice but unfortunately we have no access to the database itself except via Crystal.
 
K
IP IP Logged
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum