Evaluate Next Record with If Else

Printed From: Crystal Reports Book — Forum Name: Technical Questions

I'm working with Crystal Reports 2011 for Sage 100 ERP and I've come across an issue with one of our forms.
Specifically, the form is for our shipping department and the title of the form itself determines quite a few fields.

The title is determined by reading the detailed transaction type of the first line in a contract.
Unfortunately, there are numerous contracts that have a different type of record that does not have a transaction type so the form title reads what the else statement says, which is incorrect.

Here's the original code that determines the title of each form.
if {RO_21CrystalContractLineWrk.TransDetailRecordType}="R" then "Receiver" 

else "Shipper"

How can I change it so that I can accommodate for situations where if the transaction detail record type is blank, skip the record and move to the next record?

I tried the following but it gives me the next record number, which is correct but I want to evaluate that next record number using an if else.
if {RO_21CrystalContractLineWrk.TransDetailRecordType}="" then next({RO_21CrystalContractLineWrk.ReportLineNumber})

else if {RO_21CrystalContractLineWrk.TransDetailRecordType}="R" then "Receiver"
else "Shipper"



Edited by Ming801 - 18 Sep 2017 at 5:16am
is this only for the report header?
what if the second row is also empty, do you need to go to the third, etc until you find one that isn't empty?The next() is a row by row item and only evaluates for the next row. In your report header it is taking the first row in the report and then evaluating row 2 as "next" but that is as deep as you can go with that logic.