SETFILTER on an option string

sharon95
Member Posts: 183
I have to set a filter on an option string but it gives me an error....
I'm trying this:
TB1.SETFILTER("Customer Type",'<>%1','Business');
but it says that the type conversion is not possible..... please help me!
I'm trying this:
TB1.SETFILTER("Customer Type",'<>%1','Business');
but it says that the type conversion is not possible..... please help me!
0
Best Answer
-
It should be...
TB1.SETFILTER("Customer Type",'<>%1',"Customer Type"::"Business");
5
Answers
-
It should be...
TB1.SETFILTER("Customer Type",'<>%1',"Customer Type"::"Business");
5 -
Thanks, now I want to write an if statement on the same table....
IF AddressG."Customer Type" = 'Male' THEN BEGIN
but it doesn't work...0 -
-
Use similar format...
IF AddressG."Customer Type" = AddressG."Customer Type"::"Male" THEN BEGIN
0 -
Use this
IF AddressG."Customer Type" = AddressG."Customer Type"::"Male" THEN BEGIN
OR ELSE
IF AddressG."Customer Type" = 3 (Integer Value)Thanks
Blog - rockwithnav.wordpress.com/
Twitter - https://twitter.com/RockwithNav
Facebook - https://facebook.com/rockwithnav/0 -
Please do not use "IF AddressG."Customer Type" = 3 (Integer Value)" - it is widely accepted that this is bad practice and makes code difficult to read/understand. I know it exists in a few places in standard NAV code but that doesn't mean we should do it. Imagine if the posting routines (e.g. CU 12, 22) used this format - it would be a nightmare to try to understand that code.0
-
Dear Sir ,
i want to Generate Sales Register by using Location filter , posting Date filter and Tax type Filter .
Location And Posting filter successfully working but tax type filter not work.
code likeRecPurchaseHeader - OnPreDataItem()
RecCompany.GET;
TxtDateFilter := '';
txtLocationfilter :='';
IF RecPurchaseHeader.GETFILTER("Posting Date") <> '' THEN
TxtDateFilter := 'Purchase Period ' +RecPurchaseHeader.GETFILTER("Posting Date")
ELSE
TxtDateFilter := 'Purchase Register';
IF RecPurchaseHeader.GETFILTER("Location Code") <> '' THEN
txtLocationfilter := 'Location Filter :- ' +RecPurchaseHeader.GETFILTER("Location Code")
IF recdetail.SETFILTER("Tax Type",'<>%1',"Tax Type"::'CST') THEN
txtCSTVAT := 'CST Filtering ' + RecDetails(RecDetails."Tax Type"::CST)
ELSE
txtCSTVAT := 'CST Filtering ' + RecDetails(RecDetails."Tax Type"::VAT);0 -
@Mohit_B1 - The last IF statement should be something like this...
recdetail2."Tax Type" := recdetail2."Tax Type"::"CST"; // NOTE - new record variable required here IF recdetail.GETFILTER("Tax Type") = FORMAT(recdetail2."Tax Type") THEN
...Note you need to create a new variable recdetail2 because in most versions of NAV FORMAT("Tax Type"::"CST") would give you the positional value as a text and not the option value as a text
P.S. You should not hijack an existing post like this - you should create your own separate post1 -
thanks your feedback Sir i will try ......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