Doubt in SETFILTER

kishi_g
Member Posts: 162
Hi,
I created one table and form. table fields are NUMBER and FROMCODE.Primary key is NUMBER.
I gave data on this table like this.
NUMBER FROMCODE
1 100
2 101
3 102
4 200
5 201
6 202
7 300
8 301
9 302
In form I wrote the code in ONOPENFORM Trigger:
code1 := '100' + '..' + '102';
code2 := '200' + '..' + '202';
SETFILTER(fromcode,code1,code2);
SETFILTER(fromcode,'%1|%2',code1,code2); //I tried this code also.
when i run this form no records was showed.I want to show 100 to 202 only by using code1 and code2.
how can i do that?????
Thanks & Regards,
Kishore.
I created one table and form. table fields are NUMBER and FROMCODE.Primary key is NUMBER.
I gave data on this table like this.
NUMBER FROMCODE
1 100
2 101
3 102
4 200
5 201
6 202
7 300
8 301
9 302
In form I wrote the code in ONOPENFORM Trigger:
code1 := '100' + '..' + '102';
code2 := '200' + '..' + '202';
SETFILTER(fromcode,code1,code2);
SETFILTER(fromcode,'%1|%2',code1,code2); //I tried this code also.
when i run this form no records was showed.I want to show 100 to 202 only by using code1 and code2.
how can i do that?????
Thanks & Regards,
Kishore.
0
Comments
-
If you want to open the form with the filtered record every time you open it, i would use the SourceTableView Property of the form and set the filter there.
if not, try SetRange(code,from,to) in the onOpenFormTrigger or, what i think is best, open the form by using a filtered record as a Variable and form.runmodal(NumberOfForm,FilteredRecord).0 -
Hi McClane,
Thanks for ur reply. is it possible to show the combination of these two(code1 and code2) by using this code. becaz i will use this code in another form.
code1 := '100' + '..' + '102';
code2 := '200' + '..' + '202';
SETFILTER(fromcode,code1,code2);
regards,
kishore.0 -
Hi Kishore
The best way to test if your filter is going to work is to run your table and apply the filter manually before trying to construct a filter and wondering whether it is actually going to work.
For example, you want 2 ranges to show:
Range 1: 100..102
Range 2: 200..202
In NAV it's not possible to apply a filter with: FromRange..ToRange, in other words, 100..102..200..202, instead you should build a filter that includes an OR constructor between the 2 ranges, something like 100..102|200..202.
One way to achieve this is by constructing and applying the following filter: SETFILTER(fromcode, FilterString) WHERE FilterString is set to '100..102|200..202'
Hope this helps!0 -
Hi Wiechardt,
Thanks for ur reply. I take Range3 as code.
Range 1: 100..102
Range 2: 200..202
Range3 := 'Range1|Range2';
setfilter(fromcode,Range3);
when i run the form no records was showing.
Thanks & Regards,
Kishore.0 -
you wrote
Range3 := 'Range1|Range2';
but maybe this is better....Range3 := Range1 + '|' + Range2;
with your method, nav will apply this filter: 'Range1|Range2',
not the values of the txtconst!! [-X0 -
please write the filter that you see after you run form. It should be displayed when you press TableFilter0
-
Hi Guys,
Thanks for ur replies. I got the solution by using FORMAT function.
Range3 := FORMAT(Range1) + '|' + FORMAT(Range2);
setfilter(fromcode,Range3);
Thanks & Regards,
Kishore.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