Convert code datatype value to integer.

Hi guys i need a help in this one.

Table1.SETRANGE(ID1, ID2);

IF Table1.FIND(’-’) THEN
Table2.SETRANGE(TID1 , Table1.ID1);

Now the problem is in converting the value from code to integer,

Table1.ID1 value is code.

Table2.TID1 value is in integer

I am getting the type conversion error.

How to fix this and get the setrange to work please help.

Thanks.

Try

IF NOT EVALUATE(Table1.ID1, Table2.TID1) THEN Table2.TID1 := 0; // Table2.TID1 is not an integer value

Thanks Erik,

But i want to filter the record thats why i am using the setrange to filter the records.

I dont want to check if its integer value or not. I want to match the integer field with the code field data type how can i do this.

Thanks.

Try

Table1.SETRANGE(ID1, ID2);

IF Table1.FINDFIRST THEN BEGIN
EVALUATE(VarInteger,Table1.ID1);

Table2.SETRANGE(TID1 , VarInteger);

END;

Where VarInteger is of type Integer…

Thanks mohana it is working great.

Welcome [:)]