Setrange with an option field

sharon95
Member Posts: 183
Why this isn't working?
Table.setrange("Reason for Archiving",'<>%1|<>%2|<>%3', Table."Reason for Archiving"::'Delete Manually',Table."Reason for Archiving"::'Delete Completed Document',Table."Reason for Archiving"::'Delete Manually without Posting');
Thank you!
Table.setrange("Reason for Archiving",'<>%1|<>%2|<>%3', Table."Reason for Archiving"::'Delete Manually',Table."Reason for Archiving"::'Delete Completed Document',Table."Reason for Archiving"::'Delete Manually without Posting');
Thank you!
0
Answers
-
use
Table.setfilter0 -
mohana_cse06 wrote: »use
Table.setfilter
I get the error "a variable was expected"0 -
Check out this link
http://forum.mibuso.com/discussion/14858/setrange-for-option-type-fieldThanks
Blog - rockwithnav.wordpress.com/
Twitter - https://twitter.com/RockwithNav
Facebook - https://facebook.com/rockwithnav/0 -
RockWithNAV wrote: »Check out this link
http://forum.mibuso.com/discussion/14858/setrange-for-option-type-field
nothing works
0 -
you need to use "" double quotes for option values like
Table."Reason for Archiving"::"Delete Manually"0 -
mohana_cse06 wrote: »you need to use "" double quotes for option values like
Table."Reason for Archiving"::"Delete Manually"
ok, thank you, but what's the statement for saying "and" at the place of "|"?0 -
ok, thank you, but what's the statement for saying "and" at the place of "|"?
Take a look at the help for SETFILTER Function (Record).
0 -
Why this isn't working?
Table.setrange("Reason for Archiving",'<>%1|<>%2|<>%3', Table."Reason for Archiving"::'Delete Manually',Table."Reason for Archiving"::'Delete Completed Document',Table."Reason for Archiving"::'Delete Manually without Posting');
Thank you!
Use SETFILTER instead of SETRANGE..
eg.Table.SETFILTER("Reason for Archiving",'<>%1|<>%2|<>%3', Table."Reason for Archiving"::'Delete Manually',Table."Reason for Archiving"::'Delete Completed Document',Table."Reason for Archiving"::'Delete Manually without Posting');
0 -
SETRANGE accepts only two parameters: a FromValue and an optional ToValue.You can only filter to a single value (by leaving out the ToValue) or to a range. Any other situation you have to use SETFILTER.
MSDN Help:
SETRANGE: https://msdn.microsoft.com/en-us/library/dd355053.aspx
SETFILTER: https://msdn.microsoft.com/en-us/library/dd354919.aspx
In your situation, you want to set a filter on 3 different values, and therefore you must use SETFILTER. You cannot use SETRANGE in your situation.
I don't think you mean to use AND on a single field value, because there will not be any records that have all three values at the same time.0 -
Also Table.SETFILTER("Reason for Archiving",'<>%1&<>%2&<>%3'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