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.
0
Comments
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).
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.
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!
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.
but maybe this is better....
with your method, nav will apply this filter: 'Range1|Range2',
not the values of the txtconst!! [-X
"Never memorize what you can easily find in a book".....Or Mibuso
My Blog
Thanks for ur replies. I got the solution by using FORMAT function.
Range3 := FORMAT(Range1) + '|' + FORMAT(Range2);
setfilter(fromcode,Range3);
Thanks & Regards,
Kishore.