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

Problem with formula field set to Boolean 1

Status
Not open for further replies.

mitchadams

Programmer
Jun 2, 2003
13
GB
I am using Crystal Reports 8.5, and am new to the product so must apologise for my limted knowledge.

I have a formula field which takes a unique identifier from my database and adds a modulus 11 style check digit to the end. The formula I have written should provide the correct results.

When I preview the report I get true or false, I cannot seem to work out how to display the value calculated.

The formula I am using is as follows:
Code:
numberVar total := 0;
numberVar i := 0;

for i := 1 to 7 step 1 do 
{STUDENTS.S_REF} & 
ToText(11 - ((total + (ToNumber(
Mid({STUDENTS.S_REF},i,1))*(9-i))) 
mod 11))







What happens if you get scared half to death twice?
 
You want to display the value of total.

So end your formula with

;
total;

All the best,

Naith
 
my mistake, I had a few too many things going on in the for loop.

the code I have folows, and I want to output the value of s_ref_chkdig
Code:
stringVar s_ref_chkdig:= '';
numberVar total := 0;
numberVar i := 0;

for i := 1 to 7 step 1 do 
(
    total = total + (ToNumber(Mid({students.s_REF},i,1))*(9-i))
);

s_ref_chkdig = ToText(11-(total mod 11));


What happens if you get scared half to death twice?
 
You are only using a "comparative = " not an "Assignment := " in your formula....happens all the time.

stringVar s_ref_chkdig:= '';
numberVar total := 0;
numberVar i := 0;

for i := 1 to 7 step 1 do
(
total := total + (ToNumber(Mid({students.s_REF},i,1))*(9-i))
);

s_ref_chkdig := ToText(11-(total mod 11));





Jim Broadbent
 
cheers mate, i think I am on a roll now...


What happens if you get scared half to death twice?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top