SETFILTER on Code datatype field

navuser1
Member Posts: 1,334
Sir,
Please guide me to filter out the below bound information on a Table.
Suppose A table is build a field(pk) called Value (Data type Code 20).
Table contains the record for the field Value starting from 1 to 9999999.
Now I want to filter the Table Data starting range from 9710101 to 9710399 and 9640601.
Currently I have handled the scenario with the help of EVALUATE function.
Thank you.
Please guide me to filter out the below bound information on a Table.
Suppose A table is build a field(pk) called Value (Data type Code 20).
Table contains the record for the field Value starting from 1 to 9999999.
Now I want to filter the Table Data starting range from 9710101 to 9710399 and 9640601.
Currently I have handled the scenario with the help of EVALUATE function.
Thank you.
Now or Never
0
Comments
-
navuser1 wrote:Sir,
Please guide me to filter out the below bound information on a Table.
Suppose A table is build a field(pk) called Value (Data type Code 20).
Table contains the record for the field Value starting from 1 to 9999999.
Now I want to filter the Table Data starting range from 9710101 to 9710399 and 9640601.
Currently I have handled the scenario with the help of EVALUATE function.
Thank you.
Hi
From a SQL prospective a "Code" Field type is a standard nvarchar like a "Text" field type.
So if you put an integer to a text field you will see a sort like:
1
10
11
2
3
35
36
37
9
99
If you place a setrange(mytextfield, '2', '5') you will receive "2","3","35","36","37".
You must usa an appropriate field type like "Integer" or place some "0" before your number.
something like:
001
002
003
009
010
011
035
036
037
099
The alphabetic order will be similar to integer sequence.
Bye
MatteoReno Sistemi Navision Developer0 -
Matteo is correct.
However, for that very specific example you present, the range-numbers have the same number of digits, so you can write your filter simply like this:
SETFILTER(Value,'9710101..9710399|9640601');
But note that it would not work if the from/to range values had different number of digits.Bardur Knudsen
Microsoft - Dynamics NAV0 -
What I have done to handle this....
// Save my bound data into a temporary Table Begin TempInteger.DELETEALL; RecInteger.RESET; RecInteger.SETFILTER(RecInteger.Number,'%1..%2|%3',9710101,9710399,9640601); IF RecInteger.FINDSET THEN REPEAT TempInteger.INIT; TempInteger.COPY(RecInteger); TempInteger.INSERT; UNTIL RecInteger.NEXT =0; // Save my bound data into a temporary Table End //Finding the data which I have to check into above temp table Begin ........... ........... ........... //Finding the data which I have to check into above temp table End // Convert into int Begin EVALUATE(VarInteger, Code datatype field); // Convert into int End; // Check the Range Begin IF NOT TempInteger.GET(VarInteger) THEN ERROR(..); // Check the Range End;
Now or Never0 -
BardurKnudsen wrote:But note that it would not work if the from/to range values had different number of digits.
Sir,
Above mentioned line force me to knock the expert door. [-o<Now or Never0
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