Google Answers Logo
View Question
 
Q: Crystal reports - formula editor error ( No Answer,   3 Comments )
Question  
Subject: Crystal reports - formula editor error
Category: Computers
Asked by: candyofelvincan-ga
List Price: $2.00
Posted: 26 Mar 2004 10:31 PST
Expires: 25 Apr 2004 11:31 PDT
Question ID: 320819
I am running a report in Crystal Reports v8.5 that contains a formula
which splits the name field in the database into first, last and MI
for purposes of importing into another database.  The formula was
written by a crystal tech for me and worked fine UNTIL I had to
replace my harddrive and reinstall everything from scratch.  I saved
all the data, but of course had to reinstall all of the programs.  Now
every time I try to run the report, the formula editor pops open with
the error "a subscript must be between 1 and the size of the array -
OK" error displayed.  When I clear the error message and click on the
check formula button it returns "no errors found."  I'm using crystal
syntax.  I tried switching it to basic, but got immediate error
messages.
Can anyone help?
Answer  
There is no answer at this time.

Comments  
Subject: Re: Crystal reports - formula editor error
From: bbqfreak-ga on 29 Mar 2004 06:40 PST
 
When you check the validity of a Formula, the program usually only
checks the _syntax_ to make sure the language is legal, and not the
context of elements in it, since this depends on what information the
report is being run against.

If you could post the formula and a very short summary of what the
formula is used for, we could have a better idea of what's causing it,
and how to solve it.
Subject: Re: Crystal reports - formula editor error
From: candyofelvincan-ga on 29 Mar 2004 07:50 PST
 
Here is the formula.  There is some info on how the data is stored
below the formula.

stringvar firstn:=split({PYEmployees.Name},",")[2];
numbervar lngth:= len({PYEmployees.Name});
numbervar fn:= Instr({PYEmployees.Name},",") + 2;
Stringvar fnandmid:={PYEmployees.Name}[fn to lngth];
numbervar md:=instr(fnandmid," ");
numbervar lngth2:= len(fnandmid);
If md>0 then Stringvar midname:= fnandmid[md to lngth2] else "";

The formula breaks the name stored in a single field in the database
into its component parts.

The names in the database name field are in the format
Lastname, Firstname MI.
if there is a Jr or III or something, it would be
Lastname suffix, Firstnam MI.
In many cases there are hypenated lastnames and/or no middle name
and/or the middle name is spelled out rather than an initial.
Subject: Re: Crystal reports - formula editor error
From: atljay-ga on 02 Apr 2004 14:57 PST
 
In Crystal, if you subscript a string and the string is not as long as
that subscript, you will get that error.  If you say {stringfield}[5]
and {stringfield} is less than 5 characters long, you will get the
described error.  You will need to add more 'if then' stuff to your
formula to ensure each part is at least as long as the lower
subscript.  I don't think Crystal minds if you subscript beyond the
end of the string.

J

Important Disclaimer: Answers and comments provided on Google Answers are general information, and are not intended to substitute for informed professional medical, psychiatric, psychological, tax, legal, investment, accounting, or other professional advice. Google does not endorse, and expressly disclaims liability for any product, manufacturer, distributor, service or service provider mentioned or any opinion expressed in answers or comments. Please read carefully the Google Answers Terms of Service.

If you feel that you have found inappropriate content, please let us know by emailing us at answers-support@google.com with the question ID listed above. Thank you.
Search Google Answers for
Google Answers  


Google Home - Answers FAQ - Terms of Service - Privacy Policy