Question,
Id writed a code that will filter contact feature type's from the contact feature type table.
But i want to skip lines, so i can put this data in columns of an other table.
CODE:
ContactFeatureTypeRec.RESET;
ContactFeatureTypeRec.SETRANGE("Feature Group",'Stabu paragraaf');
ContactFeatureTypeRec.SETRANGE(Code,Relatie);
ContactFeatureTypeRec.SETRANGE("Line No.",LineInt);
IF ContactFeatureTypeRec.FINDFIRST THEN BEGIN
REPEAT
STABU := ContactFeatureTypeRec.Feature;
LineInt := ContactFeatureTypeRec."Line No.";
UNTIL ContactFeatureTypeRec.NEXT = 0;
END;
What i want to do is filter > on the next line
CODE:
ContactFeatureTypeRec.RESET;
ContactFeatureTypeRec.SETRANGE("Feature Group",'Stabu paragraaf');
ContactFeatureTypeRec.SETRANGE(Code,Relatie);
ContactFeatureTypeRec.SETRANGE("Line No.",>LineInt);
IF ContactFeatureTypeRec.FINDFIRST THEN BEGIN
REPEAT
STABU1 := ContactFeatureTypeRec.Feature;
LineInt := ContactFeatureTypeRec."Line No.";
UNTIL ContactFeatureTypeRec.NEXT = 0;
END;
But i get an error on the > sign, does somebody has an solution here ?
0
Comments
ContactFeatureTypeRec.SETFILTER("Line No.",'>%1',LineInt);
or use SETRANGE like :
Record.SETRANGE(Field [,FromValue] [.ToValue])
where stands the %1 for ??
LineNo ??
Type conversion is not possible because 1 of the operators contains a invalid type.
Integer := Text
http://www.BiloBeauty.com
http://www.autismspeaks.org
you should use
findset in stead of findfirst when you are going to loop the records.
oops off topic
** SI ** Bert Van Gestel **
**********************
I have seen that error a lot of times.
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!
RIS Plus, LLC
Hi Daniel,
There are actually 2 things to notice here
1. The first code in the post
ContactFeatureTypeRec.RESET;
ContactFeatureTypeRec.SETRANGE("Feature Group",'Stabu paragraaf');
ContactFeatureTypeRec.SETRANGE(Code,Relatie);
ContactFeatureTypeRec.SETRANGE("Line No.",LineInt);
IF ContactFeatureTypeRec.FINDFIRST THEN BEGIN
Here also there is a setrange ContactFeatureTypeRec.SETRANGE("Line No.",LineInt); but according to Marcos post.....this never gives the error. :-k
2. While just the next set contains ContactFeatureTypeRec.SETRANGE("Line No.",>LineInt); and this generates the error.
Obviously the > sign causes the error, but when the setfilter is used along with this, it starts to give the type conversion error. FORMAT will definitely solve the error provided the "Line No" field is a code/text field.
But the error should also come in the first set of code...Marcos, do check the datatypes of both the "Line No." and Lineint, if both the fields are integer and defined properly then it should not give the error.
For any queries you can also visit my blog site: http://msnavarena.blogspot.com/
I have one side remark on your code ...
Don't use FINDFIRST in front of a loop. Only use FINDFIRST if you only need the first record. Use FINDSET or FIND('-') instead... .
Eric Wauters
MVP - Microsoft Dynamics NAV
My blog
RIS Plus, LLC
For text, the sorting is 1, 10, 2, 3, 30, 4, 5
For integers, the sorting for these number is 1,2,3,4,5,10,30
in this case (filtering < a value), I guess the only way to go is using all integers ... .
But in any way ... Denster is right ... to resolve the error message, you can use the FORMAT to resolve the conversion error.
Eric Wauters
MVP - Microsoft Dynamics NAV
My blog