Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Help with Formula Post Reply Post New Topic
Author Message
synergy_texas
Newbie
Newbie


Joined: 28 May 2010
Online Status: Offline
Posts: 4
Quote synergy_texas Replybullet Topic: Help with Formula
     Posted: 16 Jun 2010 at 7:52am
Fairly new to Crystal and need help in writing a formula.  Here is what I have so far.
 
if {INVOICE.INVOICE_NUMBER} = {TRANS.INVOICE_NUMBER}

and {TRANS.ACCOUNT} in '12345, 65432'

then ({INVOICE.INVOICE_AMT} - {TRANS.AMOUNT})

else {INVOICE.INVOICE_AMT}

Table Invoice will have 1 record with an invoice number.  Table Trans can have multiple records with an invoice number that exists within the Invoice table.  When one of the Trans records has ACCOUNT 12345 or 65432 then I need to print the invoice amount minus the trans amount.  If either of those two accounts don't exist then I just need to print the invoice amt.  There may be 1 or both accounts in the TRANS table.
 
Let me state the logic I need to follow.
 
Print INVOICE.INVOICE_AMT - TRANS.AMOUNT
IF EXISTS TRANS.ACCOUNT = 12345 or 65432.
IF NO TRANS.ACCOUNT = 12345 or 65432
THEN Print  INVOICE.INVOICE_AMT
 
I am trying to use a formula because I have to sum up all invoices for a particular company for each year.  So in 2010, I could have a company with 5 separate invoices (INVOICE) that may have 2 or more line items (TRANS).  If I can get the above logic to work for an individual invoice, then I can use the sum function on the formula to get the rest.
 
Any help would be greatly appreciated.
 
 


Edited by synergy_texas - 16 Jun 2010 at 9:34am
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4374
Quote lockwelle Replybullet Posted: 17 Jun 2010 at 3:14am
try in ["xxx","yyy"]...
IP IP Logged
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