Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

help with returning previous record

Status
Not open for further replies.
Apr 13, 2007
34
US
I am working on a report and need to do the comparison between current type and previous type to monitor user who changes the type within the table except for user “zy5897” or “wy5689”. The report is group by acct# then inv#. I need to output the prev type (tt) with prev date (1/10/07) even though the user is zy5897. I can’t get it to output because I think I have put criteria (account.user <> “zy5897” or account.user <> “wy5689”) in the report>selection formula> records to exclude these two users. I am not sure where I can place the criteria. Can anybody please provide some suggestions on how I should do this? Any help will be greatly appreciated. Thanks.

Table

Acct# inv# type date user
W525 Q8588 tz 2/25/07 wy5689
W525 Q8588 tt 2/20/07 zy5897
W525 Q8588 cc 1/20/07 cx8888
W525 Q8588 tt 1/10/07 zy5897


Output

Acct# inv# prev_type prev_date curr_type date user
w525 Q8588 tt 1/10/07 cc 1/20/07 cx8888
 
I would use a suppression formula on the section where you're showing the data instead of in the record selection.

If I understand you correctly, you want to suppress the records where the user is zy5897 unless the type in the next record has been changed? If I've got that right, I would use a couple of formulas (to make it easier to read!) to build the suppress formula:

{@SameAcct}
{table.Acct#} = next({table.Acct#})

{@SameInvoice}
{table.Inv#} = next({table.Inv#})

{@SameType}
{table.Type} = next({table.Type})

Your suppress formula would look something like this:

{table.user} = 'zy5897' and (not {@SameAcct} or not {@SameInvoice} or ({@SameAcct} and {@SameInvoice} and {@SameType})

You may have to tweak this. Also, someone else may have a better solution.

-Dell

A computer only does what you actually told it to do - not what you thought you told it to do.
 
Thanks for the help. Actually, I want to show all the user who have changed the type besides user zy5897, and wy5689. The problem I am having right now is that even though I need to eliminate user zy5897 from the report but with this particular scenario, with “ W525 Q8588 tt 1/10/07 zy5897” as the previous record. I still need to output this record in order to show a comparison between current and previous type. I can’t get it to work. Any ideas on how I can accomplish this? thanks

Table

Acct# inv# type date user
W525 Q8588 tz 2/25/07 wy5689
W525 Q8588 tt 2/20/07 zy5897
W525 Q8588 cc 1/20/07 cx8888
W525 Q8588 tt 1/10/07 zy5897


Output needs to be like the below:

Acct# inv# prev_type prev_date curr_type date user
w525 Q8588 tt 1/10/07 cc 1/20/07 cx8888
 
Have you tried the technique that I suggested?

The problem is that you can't show the previous data, but you can check and see if the next data has something in it that means that you'll need to show the current data.

In other words, I understand what you're trying to do, but you need to change the way that you're approaching it.

-Dell

A computer only does what you actually told it to do - not what you thought you told it to do.
 
I did but then I was confused with {@SameAcct}, {@sameInvoice}, are these variable that i have delcare?? how do I do this? I am really new to crystal and still trying to figure out a lot of stuff on my own.

thanks
 
Those are the variable name. You would name them "SameAcct", "SameInvoice", etc. when you create the formulas. When you use them in other formulas, you reference them as "{@SameAcct}", "{@SameInvoice}", etc.

-Dell

A computer only does what you actually told it to do - not what you thought you told it to do.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top