Rule creation in Information steward

Hi,

I am trying to build a rule in IS to count the materials iteration in my data base table.

  1. Can you please correct the below query.

DECLARE

declare variables

$V_Count_Mat_Num int;

BEGIN
$V_Count_Mat_Num = SQL(‘SQL_DB’, 'SELECT COUNT(MATERIAL) FROM MATERIAL_MASTER WHERE MATERIAL = '|| $Material );

IF ( $V_Count_Mat_Num = 1)
BEGIN
RETURN TRUE;
END
ELSE
IF ( $V_Count_Mat_Num > 1)
BEGIN
RETURN FALSE;
END
ELSE
RETURN FALSE;
END

I am getting an error at

$V_Count_Mat_Num = SQL(‘SQL_DB’, 'SELECT COUNT(MATERIAL) FROM MATERIAL_MASTER WHERE MATERIAL = '|| $Material );

  1. kindly let me know how to count the string length in while creating a rule in IS.

I am getting an error with the below query

DECLARE

declare variables

$Material_Len int;

BEGIN
$Material_Len = length($Material) ;
IF ( $Material_Len > ‘18’ )
RETURN FALSE;
ELSE
RETURN TRUE;
END

Please help me out ASAP.

Regards,
Shobhan.


SHOBHAN (BOB member since 2012-10-01)

Have a look here for some rule syntax that definitely works:-

I think your problem here may be to do with declaring your variable as an integer and then comparing it to a varchar i.e. ‘18’ rather then 18.


Nemesis :australia: (BOB member since 2004-06-09)