sschaller
Programmer
- May 10, 2007
- 10
I have created a Crystal report for Peachtree that tracks serial numbers as items are purchased and then sold. My client wants to be able to filter the report by the status of the item. This is complicated because a separate transaction is created in the JrnlSNum table each time the status changes. In the table the status is represented by a number but I created a formula called {@Status} to show text for each status:
If {JrnlSNum.TransactionClass}=0
Then "appears on work ticket"
Else If {JrnlSNum.TransactionClass}=1
Then "Available"
Else If {JrnlSNum.TransactionClass}=2
Then "Returned by Customer"
Else If {JrnlSNum.TransactionClass}=3
Then "Sold"
Else If {JrnlSNum.TransactionClass}=4
Then "Returned to Vendor"
Else If {JrnlSNum.TransactionClass}=5
Then "Adjusted"
Then I created a parameter called {?Status} and populated the choices with Available, Sold, Adjusted, etc. At first in the Select Expert I said {@Status} = {?Status}. If someone chose Available for the status it would show each transaction where the status was available, but if the item was subsequently sold they don't want it to be included.
So I created a second formula called {@StatusDisplay} that looks like this:
If {JrnlSNum.SerialRecordNumber}=Maximum ({JrnlSNum.SerialRecordNumber},{JrnlSNum.SerialNumber})
Then {@Status}
Basically it will only show the status of the most recent transaction for each serial number. Now I want to set the selection so that {@StatusDisplay}={?Status} but it says "This formula cannot be used because it must be evaluated later." I can see why that would be the case because it doesn't know if {JrnlSNum.SerialRecordNumber}=Maximum ({JrnlSNum.SerialRecordNumber},{JrnlSNum.SerialNumber}) until the data is compiled. Is there any way around this though? Is there some way to have the report run in two passes so first it complies the complete set of data and then filters it so that {@StatusDisplay}={?Status}? Or any other way to accomplish what I'm trying to do? Any thoughts on the subject would be greatly appreciated.
Steve Schaller
TriStar Data Systems
Blue Bell, PA
If {JrnlSNum.TransactionClass}=0
Then "appears on work ticket"
Else If {JrnlSNum.TransactionClass}=1
Then "Available"
Else If {JrnlSNum.TransactionClass}=2
Then "Returned by Customer"
Else If {JrnlSNum.TransactionClass}=3
Then "Sold"
Else If {JrnlSNum.TransactionClass}=4
Then "Returned to Vendor"
Else If {JrnlSNum.TransactionClass}=5
Then "Adjusted"
Then I created a parameter called {?Status} and populated the choices with Available, Sold, Adjusted, etc. At first in the Select Expert I said {@Status} = {?Status}. If someone chose Available for the status it would show each transaction where the status was available, but if the item was subsequently sold they don't want it to be included.
So I created a second formula called {@StatusDisplay} that looks like this:
If {JrnlSNum.SerialRecordNumber}=Maximum ({JrnlSNum.SerialRecordNumber},{JrnlSNum.SerialNumber})
Then {@Status}
Basically it will only show the status of the most recent transaction for each serial number. Now I want to set the selection so that {@StatusDisplay}={?Status} but it says "This formula cannot be used because it must be evaluated later." I can see why that would be the case because it doesn't know if {JrnlSNum.SerialRecordNumber}=Maximum ({JrnlSNum.SerialRecordNumber},{JrnlSNum.SerialNumber}) until the data is compiled. Is there any way around this though? Is there some way to have the report run in two passes so first it complies the complete set of data and then filters it so that {@StatusDisplay}={?Status}? Or any other way to accomplish what I'm trying to do? Any thoughts on the subject would be greatly appreciated.
Steve Schaller
TriStar Data Systems
Blue Bell, PA