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

code help 1

Status
Not open for further replies.

dinshak

Technical User
Joined
Oct 31, 2007
Messages
39
Location
US
new to crystal can someone pls explain me briefly what each line is doing.

numberVar a ;
stringVar pos2;

a := instr ({RESULT.REPORTED_NAME}, "-Btl ");
if a > 0 then pos2:= Mid ({RESULT.REPORTED_NAME}, a + 5, 1)
else if instr({RESULT.REPORTED_NAME}, "Ster") > 0 then pos2 := '4'
else if instr({RESULT.REPORTED_NAME}, "TSA") > 0 then pos2 := '5'
else if instr({RESULT.REPORTED_NAME}, "PBS") > 0 then pos2 := '6'
else if (instr({RESULT.REPORTED_NAME}, "Received") = 7 or instr({RESULT.REPORTED_NAME}, "Tested") = 7
or instr({RESULT.REPORTED_NAME}, "Read") = 7 or instr({RESULT.REPORTED_NAME}, "Conf") = 7)
then pos2 := '7'
else if instr({RESULT.REPORTED_NAME}, "Gram") > 0 or instr({RESULT.REPORTED_NAME}, "Bact") > 0
then pos2 := '8'
else pos2 := '9';
pos2
 
dinshak,

a := instr ({RESULT.REPORTED_NAME}, "-Btl ");
'a' is assigned the position # of "-Btl" in ({RESULT.REPORTED_NAME}

if a > 0 then pos2:= Mid ({RESULT.REPORTED_NAME}, a + 5, 1)
if "-Btl" exists, 'pos2' is assigned the character following "-Btl"
if not:

else if instr({RESULT.REPORTED_NAME}, "Ster") > 0 then pos2 := '4'
else if instr({RESULT.REPORTED_NAME}, "TSA") > 0 then pos2 := '5'
else if instr({RESULT.REPORTED_NAME}, "PBS") > 0 then pos2 := '6'

then if "Ster" exists in {RESULT.REPORTED_NAME} then assisn '4' to pos2
and so on

else if (instr({RESULT.REPORTED_NAME}, "Received") = 7 or instr({RESULT.REPORTED_NAME}, "Tested") = 7
or instr({RESULT.REPORTED_NAME}, "Read") = 7 or instr({RESULT.REPORTED_NAME}, "Conf") = 7)
then pos2 := '7'

if 'Received', 'Tested', 'Read', or 'Conf' is in posisition 7 of {RESULT.REPORTED_NAME} then assign '7' to pos2

else if instr({RESULT.REPORTED_NAME}, "Gram") > 0 or instr({RESULT.REPORTED_NAME}, "Bact") > 0
then pos2 := '8'
else pos2 := '9';

and so on

pos2
show the result in 'pos2'

Andy
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top