Print Page | Close Window

?? on if statement in formula

Printed From: Crystal Reports Book
Category: Crystal Reports 9 through 2022
Forum Name: Report Design
Forum Discription: The best way to design a report and problems you have encountered
URL: http://www.crystalreportsbook.com/forum/forum_posts.asp?TID=20119
Printed Date: 02 May 2025 at 9:09pm


Topic: ?? on if statement in formula
Posted By: jbalbo
Subject: ?? on if statement in formula
Date Posted: 16 Oct 2013 at 3:35am
Hi

Try to do the following but is erroring out.

if {USER_DEFINED_DATA.ASSESSMENT_MONIKER} = "4D17FC8EFA484E8B884E5F1C9B3D55DB"

then

stringvar x;
numbervar start;
numbervar end;

 x:={USER_DEFINED_DATA.ASSESSMENT_DATA};
start:= instr(x,'@@T_400_ = ') + 12;
end := instr(x,'"@@T_501');
x:=mid(x,start,end-start);
x

else
{USER_DEFINED_DATA.CAD751}

Thanks






Replies:
Posted By: kevlray
Date Posted: 16 Oct 2013 at 4:48am
First off, what error are you getting?   In looking at your if statement, be aware that Crystal does not work quite like BASIC and I have noticed odd results if you do not put parans around code of the then of the if statement (also on the else, if a multi-statement).

if {USER_DEFINED_DATA.ASSESSMENT_MONIKER} = "4D17FC8EFA484E8B884E5F1C9B3D55DB"

then
(
stringvar x;
numbervar start;
numbervar end;

 x:={USER_DEFINED_DATA.ASSESSMENT_DATA};
start:= instr(x,'@@T_400_ = ') + 12;
end := instr(x,'"@@T_501');
x:=mid(x,start,end-start);
x
)
else
{USER_DEFINED_DATA.CAD751}


Posted By: jbalbo
Date Posted: 16 Oct 2013 at 4:54am
sorry..sorry....

I didn't enclose it in "("

Thanks...



Print Page | Close Window