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 Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Complicated formulas causing error

Status
Not open for further replies.

lthomas6

MIS
Aug 22, 2007
87
US
I am running a Crystal 10 report to a SQL database and get the following error when trying to run the report.I have noted 3 items below.

---------------------------
Crystal Reports
---------------------------
A number, currency amount, boolean, date, time, date-time, or string is expected here.
---------------------------
OK
---------------------------

1. It looks like it is referencing a formula called InitJurisFormationFromList

The formula has the below:
shared stringVar array jurisFormationList;

jurisFormationList := getJurisdictionInfoList({?$DATABASEID$});

2. There's another formula in the report called getJurisFormationFromList

This formulas has the below:
shared stringVar array jurisFormationList;
shared stringVar inEid;

Local stringVar jurisFormation := "";
Local stringVar item;
Local numberVar i;
Local numberVar j;
Local numberVar listLength := Count(jurisFormationList);
Local stringVar midChar;
Local numberVar pos;
Local stringVar listEid;
Local numbervar lbeg;
Local numbervar lend;
Local numbervar lon;
Local numbervar keepGoing;
Local stringvar tmpStr;
Local numbervar tmpId;
Local numbervar myid;
local numbervar storedvar;
local numbervar iterCount;

lbeg:=1;
lend:=listLength;
lon:=int( (lend -1)/ 2) + 1;
keepGoing := 0;
myId := ToNumber(inEid);
iterCount := 0;

while keepGoing = 0 and iterCount < 24 do
(
iterCount := iterCount + 1;
//added the redim
redim preserve jurisformationlist[1000];
item := jurisFormationList[lon];
j:=0;
tmpStr := "";
tmpId := 0;

while j<length(item) and tmpStr = "" do
(
j := j + 1;
midChar := Mid(item, j, 1);
if midChar = "~" then
(
tmpId := ToNumber (Left(item,j-1));
tmpStr := Right(item,Length(item)-j);
);
);
storedvar := tmpId;
if myId = storedvar then
(
keepGoing := 1;
jurisFormation := tmpStr;
);
if myId < storedvar then
(
if lend = lbeg then
(
keepGoing := 1;
jurisFormation := "";
);
if lend<>lbeg then
(
lend := lon;
lon := int( (lend- lbeg) /2) + lbeg;
);
);
if myId > storedvar then
(
if lend = lbeg then
(
keepGoing := 1;
jurisFormation := "";
);
if lend <> lbeg then
(
lbeg := lon;
lon := int( (lend- lbeg) /2) + lbeg;
);
)
);

jurisFormation;
//if jurisFormation = '(jurisdiction not found)' then ' ' else jurisFormation;

3. There is another formula in the report called Jurisformation.

It has the below it its formula:
Shared stringVar array jurisFormationList;
Shared stringVar inEid;

inEid := CStr({ENTITY.Entity_EID},0,"");

{@getJurisFormationFromList};

Let me know if you need any other info. There are more formulas(4) in the report.
 
Is this your report or something you have inherited? The formula is very complex and it would definitely be better to do the same task in several formulas.

If you use Export > Report Definition you would at least get all of the formulas in a single document.

[yinyang] Madawc Williams (East Anglia, UK). Using Crystal 10 & 11.5 with Windows XP [yinyang]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top