Data Connectivity
 Crystal Reports Forum : Crystal Reports for Visual Studio 2005 and Newer : Data Connectivity
Message Icon Topic: Formula Post Reply Post New Topic
Author Message
CircleD
Senior Member
Senior Member
Avatar

Joined: 11 Mar 2011
Location: United States
Online Status: Offline
Posts: 251
Quote CircleD Replybullet Topic: Formula
    Posted: 14 Mar 2011 at 5:24pm
I created this to print mailing labels for Invoices but there is an error somewhere.Would someone please glance it over and see where I went wrong?What I'm trying to do is only print labels for 1 days Invoices at the end of the day.I'm beginning to catch on to CR but I've about gone blind looking at this.



if CurrentDate = {AR14.DATE_CREATED}
then {AR14.CUST_NAME},{AR14.CUST_ADDR1},{AR14.CUST_ADDR2},{AR14.CUST_CITY},{AR14.CUST_STATE},{AR14.CUST_ZIP}
else Next (AR.14.INV_NUMBER)
IP IP Logged
hilfy
Admin Group
Admin Group
Avatar

Joined: 20 Nov 2006
Online Status: Offline
Posts: 3701
Quote hilfy Replybullet Posted: 15 Mar 2011 at 3:54am
Where are you using this formula?  Are you getting an error message?
 
-Dell
IP IP Logged
CircleD
Senior Member
Senior Member
Avatar

Joined: 11 Mar 2011
Location: United States
Online Status: Offline
Posts: 251
Quote CircleD Replybullet Posted: 15 Mar 2011 at 12:33pm
Thanks for replying.It's in the formula editor for the details section since I'm using the built in template for mailing labels.The error I get is :

,{AR14.CUST_ADDR2},{AR14.CUST_CITY},{AR14.CUST_STATE},{AR14.CUST_ZIP}
else Next (AR.14.INV_NUMBER)  Does not seem to be part of the Formula
IP IP Logged
hilfy
Admin Group
Admin Group
Avatar

Joined: 20 Nov 2006
Online Status: Offline
Posts: 3701
Quote hilfy Replybullet Posted: 16 Mar 2011 at 3:24am
You can't do multiple fields separated by commas.  If you want to build the address, you need to do it something like this (I'm also adding carriage returns so it appears on multiple lines and testing for null values in addr2.)
if CurrentDate = {AR14.DATE_CREATED} then 
  if IsNull(AR14.CUST_ADDR2) then
    {AR14.CUST_NAME} + chr(10) + chr(13) + {AR14.CUST_ADDR1} + chr(10) + chr(13) + 
    {AR14.CUST_CITY} + ', ' +{AR14.CUST_STATE} + '  ' +{AR14.CUST_ZIP}
  else
    {AR14.CUST_NAME} + chr(10) + chr(13) + {AR14.CUST_ADDR1} + chr(10) + chr(13) +
    {AR14.CUST_ADDR2}+ chr(10) + chr(13) + {AR14.CUST_CITY} + ', ' +{AR14.CUST_STATE} + '  ' +{AR14.CUST_ZIP}
else Next (AR.14.INV_NUMBER)
-Dell
IP IP Logged
CircleD
Senior Member
Senior Member
Avatar

Joined: 11 Mar 2011
Location: United States
Online Status: Offline
Posts: 251
Quote CircleD Replybullet Posted: 16 Mar 2011 at 11:15am
Thanks for the help. As you can probably tell I'm learning as I go and I'm about as newbie as all get out.

I tried that formula you wrote and now I get the "The ) is missing" error with the AR14 highlighted in the  If null (AR14.CUST_ADDR2)




Edited by CircleD - 16 Mar 2011 at 11:32am
IP IP Logged
CircleD
Senior Member
Senior Member
Avatar

Joined: 11 Mar 2011
Location: United States
Online Status: Offline
Posts: 251
Quote CircleD Replybullet Posted: 18 Mar 2011 at 1:49pm
I fixed some of the errors (or at least the syntax checker says so) and got this:

if  ({AR14.DATE_LAST_INVC}) = "" then
  if IsNull({AR14.CUST_ADDR2}) then
    ({AR14.CUST_NAME}) + chr(10) + chr(13) + ({AR14.CUST_ADDR1}) + chr(10) + chr(13) +
    ({AR14.CUST_CITY}) + ', ' +({AR14.CUST_STATE}) + '  ' +({AR14.CUST_ZIP})
  else
    ({AR14.CUST_NAME}) + chr(10) + chr(13) + ({AR14.CUST_ADDR1}) + chr(10) + chr(13) +
    ({AR14.CUST_ADDR2})+ chr(10) + chr(13) + ({AR14.CUST_CITY}) + ', ' +({AR14.CUST_STATE}) + '  ' +({AR14.CUST_ZIP})
else Next ({AR10.INVC_NUMB})

I also go to thinking about it and thought that maybe this would work as well or better but I don't know since I am somewhat handicapped in that this is a new program we are setting up and right now I am hooked into a test database and certain areas we haven't started working with as yet.If someone would venture an opinion about either formulas chances of doing what I want would be appreciated.


Local NumberVar Index;
Local NumberVar invoicenumber := 0;
Local NumberVar Stringlength := Length ({AR10.INVC_NUMB});

//loop through the characters in invc_numb
For Index := 1 to Stringlength Step 1 Do
(If ({AR10.INVC_NUMB}) [Index] = "invoicenumber"Then
     (invoicenumber := invoicenumber + 1;)
Else (invoicenumber := (invoicenumber;)
);
invoicenumber)

IP IP Logged
CircleD
Senior Member
Senior Member
Avatar

Joined: 11 Mar 2011
Location: United States
Online Status: Offline
Posts: 251
Quote CircleD Replybullet Posted: 24 Mar 2011 at 12:58am
Well neither formula is doing what I wanted it to do.At any rate I talked to the accountant yesterday and she said she would prefer to just input the date she wants the labels to print from and now I have to start all over and to be honest I'm stumped as to what to write.Man I hate being a newbie.
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.031 seconds.