Here is some trick:
you can use filter on GLAccount like that:
GLAccountRec.SETFILTER("No.",'%1..%2&%3',50000,51000,GLAccountNo);
IF GLAccountRec.FINDFIRST THEN ... ;
Relational Expressions for Set Inclusion
The relational operator IN is used to determine inclusion. It determines if the first
term is in a specific set. Therefore, it requires a list of values, a set, to compare
the term to. This list is part of the expression and is called a set constant.
Set Constant
There are no variables of type set, but there are constants of type set. A set
constant consists of an open square bracket ([) followed by a list of allowed
values separated by commas, followed by a close square bracket (]). For
example, a set of all the even numbers from one to ten looks like this:
[2,4,6,8,10]
Besides individual values, a member of a set can also be a range of values. A set
of all the numbers from one to twenty not evenly divisible by ten looks like this:
[1..9,11..19]
In addition, an individual value or a value used as part of a range can actually be
an expression. A list of numbers from 10 to 20, but not including the variable n
(as long as n was from 10 to 20), looks like this:
[10..n-1,n+1..20]
This does not help with syntax much, but suggests ranges are acceptable. This is from the manual that was published for V5.
Ranges are acceptable if the value type is Integer but are not acceptable if the value type is Code like :
if GlAccount."No." IN ["50000".."51000"] then
double quote is also not acceptable
@matttrax
you said that range can be done in classic client 2009 and worked fine. maybe you mean that range can be done if value type is integer,isnt it? :-k
It's always good to learn something new. Four years of NAV development and I didn't realize this was an option. :oops: So much for those giant CASE statements.
Anybody succeeded in using a variable with a IN statement?
Sort of
IF AnyRecord.Field IN [TextField] THEN ...
where TextField should contain something 'VALUE1,VALUE2,VALUE3'.
Comments
RIS Plus, LLC
I dont want to use
you can use filter on GLAccount like that:
GLAccountRec.SETFILTER("No.",'%1..%2&%3',50000,51000,GLAccountNo);
IF GLAccountRec.FINDFIRST THEN ... ;
Follow my blog at http://x-dynamics.blogspot.com
ERP Consultant (not just Navision) & Navision challenger
Tested in a 2009 classic client with strings and integers. Worked fine. I was surprised. I didn't recall this being possible.
@matttrax
you said that range can be done in classic client 2009 and worked fine. maybe you mean that range can be done if value type is integer,isnt it? :-k
IF 'A' IN THEN
MESSAGE('Found A')
ELSE
MESSAGE('Did not find A');
This ran even in 4.0 so it was around for a while
ERP Consultant (not just Navision) & Navision challenger
Just check it.
Just check it.
Sort of
IF AnyRecord.Field IN [TextField] THEN ...
where TextField should contain something 'VALUE1,VALUE2,VALUE3'.
Thanks