Filter integer field with >

Marcos
Member Posts: 55
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 ?
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
-
Use SETFILTER instead ...
ContactFeatureTypeRec.SETFILTER("Line No.",'>%1',LineInt);
or use SETRANGE like :
Record.SETRANGE(Field [,FromValue] [.ToValue])0 -
thnx
where stands the %1 for ??
LineNo ??0 -
Is doenst work for me, i get the error
Type conversion is not possible because 1 of the operators contains a invalid type.
Integer := Text0 -
-
btw
you should use
findset in stead of findfirst when you are going to loop the records.
oops off topic**********************
** SI ** Bert Van Gestel **
**********************0 -
Bgestel wrote:btw
you should use
findset in stead of findfirst when you are going to loop the records.
oops off topic
I have seen that error a lot of times.Regards,Alain Krikilion
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!0 -
LineInt is declared as Integer0
-
SETFILTER should automatically convert data types, but you can always do
ContactFeatureTypeRec.SETFILTER("Line No.",'>%1',FORMAT(LineInt));
0 -
DenSter wrote:SETFILTER should automatically convert data types, but you can always do
ContactFeatureTypeRec.SETFILTER("Line No.",'>%1',FORMAT(LineInt));
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.Diptish Naskar
For any queries you can also visit my blog site: http://msnavarena.blogspot.com/0 -
-
My point was that if the system screams at you because there is a data type conflict (integer > text), you can use the FORMAT command to convert the integer to text.0
-
Also keep in mind the sortings.
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.0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions