Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Evaluate Next Record with If Else Post Reply Post New Topic
Author Message
Ming801
Newbie
Newbie


Joined: 15 Sep 2017
Location: United States
Online Status: Offline
Posts: 2
Quote Ming801 Replybullet Topic: Evaluate Next Record with If Else
    Posted: 18 Sep 2017 at 3:58am
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
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 18 Sep 2017 at 7:06am
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.
IP IP Logged
Post Reply Post New Topic
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



This page was generated in 0.018 seconds.