Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Format for Invoice 1

Status
Not open for further replies.

elf1

Technical User
Jun 6, 2001
43
US
Hi,

Can you help me determine what change needs to be made to this formula, in order to have the "," between the City and State fields NOT print when there is nothing in any of the address, city or state fields?

I can always rely on Tek-Tips for the solution to all my Crytstal Problems.

Thank You,
Lisa

StringVar BT_Address1 :="";
StringVar BT_Address2 :="";
StringVar BT_Address3 :="";
if Trim({SO_26CRWInvoiceDataHeader.BillToAddress1}) <> "" then BT_Address1 := {SO_26CRWInvoiceDataHeader.BillToAddress1} + chr(13) + chr(10);
if Trim({SO_26CRWInvoiceDataHeader.BillToAddress2}) <> "" then BT_Address2 := {SO_26CRWInvoiceDataHeader.BillToAddress2} + chr(13) + chr(10);
//if Trim({SO_26CRWInvoiceDataHeader.BillToAddress3}) <> "" then BT_Address3 := {SO_26CRWInvoiceDataHeader.BillToAddress3} + chr(13) + chr(10);
// IF USING BILL TO ADDRESS LINE 3 REMOVE THE // FROM THE ABOVE LINE
BT_Address1 + BT_Address2 + BT_Address3 + trim({SO_26CRWInvoiceDataHeader.BillToCity}) + ", " + {SO_26CRWInvoiceDataHeader.BillToState} + " " + {SO_26CRWInvoiceDataHeader.BillToZipCode}
 
What you could do is just create another if statement.

IF TRIM(TRIM(Add1) + TRIM(Add2) + TRIM(Add3)) + TRIM(City) + TRIM(State))<> '' THEN (use the last line you have already)
ELSE
''

If this doesn't help let me know and I can look at it again. But given your description, I believe this should work for you.

 
Hi,
I am not certain how to make the change.

Can you help?

Thank You
 
Hi,

If I could get some additional help with this formula change, I would be grateful.

I am not an expert with Crystal, but have worked with it for several years.

I do not understand how to make the change you describe.

Thank you for your help.

You folks are the best!

 
Ok what you need to do is check to see if the strings are empty and if they are do not display the comma or antyhing else. If they aren't show what you need to show.

IF TRIM(address1)+ TRIM(field2) + ...etc = '' THEN
stringvar := ''
ELSE
Show full address string

Does this make sense...You already have most of the logic you need in your original formula. You just need to modify it to include a check for empty strings. If they exist don't show the comma. If there isn't any empty string show the comma in normal placement.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top