Print Page | Close Window

formula syntax comparing fields

Printed From: Crystal Reports Book
Category: Crystal Reports 9 through 2020
Forum Name: Technical Questions
Forum Discription: Formulas, charting data, Crystal syntax, etc.
URL: http://www.crystalreportsbook.com/forum/forum_posts.asp?TID=9392
Printed Date: 29 Apr 2024 at 3:55pm


Topic: formula syntax comparing fields
Posted By: cold_witt
Subject: formula syntax comparing fields
Date Posted: 16 Mar 2010 at 4:01am
After 8 years, I'm coming back to Crystal and learning all over again. 
I have a report where one field will depend on the results of another. 
The first field "ID_Type" is a formula that returns either the PO number or the Contract number.  Based on what that result is, the  formula "Exp Date" will return one of two database fields- either the PO_End_Date or the Contract_Exp_Date.
 
For ID_Type, I have the following syntax -
If instr({Contract_Prepay_Balance.SortType},"PO")>0 then
  formula="PO #"
else
  formula="Contract #"
end if
 
I think I can use this same syntax for the second "Exp Date", but not sure
If instr({Contract_Prepay_Balance.SortType},"PO")>0 then
  Exp_Date={Contract_Prepay_Balance.PO_End_Date}
else
  Exp_Date={Contract_Prepay_Balance.Contract_Exp_Date}
end if
 
Thanks!



Replies:
Posted By: kevlray
Date Posted: 16 Mar 2010 at 6:31am
Looks good to me.  Unless there is some syntax I missed.



Print Page | Close Window