need help,filter field using variable

baru
Member Posts: 27
customer.setfilter("no",10-001);can i "no" declare using variable?
customer.setfilter(Var,10-001);
0
Comments
-
Why? Ik you can set the variable to a value you can write SETFILTER in the same place.0
-
:? What in heavens name do you mean??? Or is my english so bad
If you want to populate a variable you useVar := "No."
And there is no use filtering on variables because (unless it is an array) it only contains one value.
But you can doSetrange("No.", Var);
0 -
You cannot set filters on variables, you can only set filters on fields in tables. You can use the value of a variable to set the value of the filter:
MyCodeVariable := '10-001'; MyCustomer.SETFILTER("No.",'=%1',MyCodeVariable);
0 -
It looks like you might be wanting to use a "macro substution" (I think thats what we called it in Foxpro)
if xyz then
set var := "no."
else
set var := "Alt. No."
setfilter(var,10-110);
You can't do this in Navision
I think the closest thing we have would use RecordRef0 -
What do you mean you can't do this in Navision....
IF xyz THEN MyRecord.SETFILTER("No.",SomeValue) ELSE MyRecord.SETFILTER("Another No.",SomeValue);
Just because it has different syntax doesn't mean "you can't do that in Navision". Or am I missing something?0 -
Sorry for the confusion, I was trying to make my example simple and of course you can set filters on different fields using an if statement
maybe this would be clearer
a function
setMyFilter(var)
inside the function
setfilter(var,somevalue);
Mostly I was wondering if what he was looking to do was Macro substitution
In some languages you can substitute a variable for a field0 -
sorry, if my question is very hard to understand . because my english is very bad. #-o
so thank everyone for your help.0 -
Of course, you can, you need to use RecordRef and FieldRef to do that...
I am not sure, this example is not tested, but you need something like this:RecRef.GetTable(YourRec); FRef := RecRef.FIELD(YourRec."Field Name"); //get the field into fieldref FRef.SETFILTER(SomeValue); //set the filter to the selected field RecRef.SetTable(YourRec); //set all fitlers back to your record variable
0 -
THX, Kine .
u re great..
=D> it's solve my problem0
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