Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Crystal 9: only want part of field within formula Post Reply Post New Topic
Author Message
psfin_mn
Newbie
Newbie
Avatar

Joined: 01 Dec 2008
Location: United States
Online Status: Offline
Posts: 9
Quote psfin_mn Replybullet Topic: Crystal 9: only want part of field within formula
     Posted: 16 Jan 2009 at 8:53am
Working on a Crystal 9 form, and have an IF THEN formula in which I have to put together multiple fields.  One of these fields is a character field, but I only want PART of what is in the field to display...
The field will look like this ~
 
Prepayment: -25, Invoice: 11030794
 
(The "Prepayment:" is a constant.)
I need to print the "-25" part of the field.  So I only ever need the  -9999
i.e. the number in between the ":" and the ",".
 
How do I do that?  
IP IP Logged
psfin_mn
Newbie
Newbie
Avatar

Joined: 01 Dec 2008
Location: United States
Online Status: Offline
Posts: 9
Quote psfin_mn Replybullet Posted: 16 Jan 2009 at 2:43pm
I figured out something that appears to be working for my purpose...  Here's what I came up with:
 
 

StringVar CommentSpacer;
CommentSpacer := CHR(13) + CHR(10);

StringVar  PayMsg;
StringVar  AmtFromPayMsg;
local numbervar start;
local numbervar comma;
local numbervar amt_length;

PayMsg := {APY2021.PYMNT_MESSAGE.B};

start := instr({APY2021.PYMNT_MESSAGE.B}, ":")+1;
comma := instr({APY2021.PYMNT_MESSAGE.B}, ",");
amt_length := (comma - start);

IF PayMsg <> ""
THEN AmtFromPayMsg := mid(PayMsg, start, amt_length)
ELSE AmtFromPayMsg := "";


// do NOT want to see the Prepayment, Invoice from system
// make it more of a standard Details a  line
if {APY2021.PYMNT_MESSAGE.B} LIKE 'Prepayment*'
AND {APY2021.VOUCHER_STYLE} = 'REG'
and {APY2021.PAID_AMT} = 0
Then 
  TRIM({APY2021.DESCR254_MIXED.K}) + CommentSpacer 
   + 'PREPAID: Invc '  + {APY2021.INVOICE_ID} 
   + '                                    '  
   + '                                    '
   + '$'  + AmtFromPayMsg
   + CommentSpacer     + CommentSpacer 


else if {APY2021.VOUCHER_STYLE} = 'REG'
and {APY2021.PAID_AMT} = 0
Then  {APY2021.DESCR254_MIXED.K} ;

 
 
 
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