Same code over multiple lines

rzirpolo
Member Posts: 6
I am new to the Navision C/AL code so am learning this as I go along. I am trying to use the SETFILTER option but have noticed that there is a limit to how much code can be put on one line. I simply tried to continue it on a new line but I get a syntax error. The maximum code it lets me enter one line is,
SETFILTER("Customer No.",'<>CA16&<>CO05&<>EU05&<>EU100&<>EU101&<>EU102&<>EU11&<>EU21&<>EU26&<>EU28&<>EU30&<>EU36&<>EU44&<>EU46
On the next line it continues,
&<>EU47&<>EU72&<>EU79&<>EU92&<>GF04&<>IN14&<>IN17&<>IN26&<>IN53&<>IT08&<>RE42&<>TI04&<>TL01&<>TR27');
If I just use this which fits on the one line it compiles fine.
SETFILTER("Customer No.",'<>CA16&<>CO05&<>EU05&<>EU100&<>EU101&<>EU102&<>EU11&<>EU21&<>EU26&<>EU28&<>EU30&<>EU36&<>EU44&<>EU46');
Any help here would be greatly appreciated.
SETFILTER("Customer No.",'<>CA16&<>CO05&<>EU05&<>EU100&<>EU101&<>EU102&<>EU11&<>EU21&<>EU26&<>EU28&<>EU30&<>EU36&<>EU44&<>EU46
On the next line it continues,
&<>EU47&<>EU72&<>EU79&<>EU92&<>GF04&<>IN14&<>IN17&<>IN26&<>IN53&<>IT08&<>RE42&<>TI04&<>TL01&<>TR27');
If I just use this which fits on the one line it compiles fine.
SETFILTER("Customer No.",'<>CA16&<>CO05&<>EU05&<>EU100&<>EU101&<>EU102&<>EU11&<>EU21&<>EU26&<>EU28&<>EU30&<>EU36&<>EU44&<>EU46');
Any help here would be greatly appreciated.
0
Comments
-
you can use MARK to do the filtering. As for the code above this is how you can put it on multiple lines
SETFILTER("Customer No.",'<>CA16&<>CO05&<>EU05&<>EU100&<>EU101&<>EU102&<>EU11&<>EU21&<>EU26&<>EU28&<>EU30&<>EU36&<>EU44&<>EU46' +'<>EU47&<>EU72&<>EU79&<>EU92&<>GF04&<>IN14&<>IN17&<>IN26&<>IN53&<>IT08&<>RE42&<>TI04&<>TL01&<>TR27');0 -
Superb, thank you very much. It's not the tidiest code in the world but at this point I just want to get it working.
I have no documentation or help files so what is MARK ? do you have an example or a link to another forum ?
Saying that a link to any help with syntax on Navision Attain would be a god-send. I can't seem to find any literature to help me out.0 -
On installation CD there are a couple of PDF. As for the Mark. here is an example
if item.find('-') then repeat if Vendor.get(Item."Vendor No.") then Vendor.Mark(true); until item.next = 0; Vendor.MARKEDONLY(true); Message('there are ' + format(Vendor.count) + ' vendor that are selected on Item');
Also in code hit F5 and look for all the variables. As for code examples, the whole navision is open.0 -
After further consideration I realised I couldn't use these customer no's. So I now use this filter,
SETFILTER("Invoicee Role",'APP - EXT FLEET MGMT|CAT|EXT|EXT FLEET MGMT|EXTERNAL FLEET MGMT|FLEET MANAGEMENT|FLEET SERVICES'
+'FRANCHISEE|LEASE CO. (FIXED PR)|LEASE COMPANY|MANU (FIXED PR)|MANUFACTURER|OTHER|WARRANTY');
It compiles fine but when I run it I get the error,
"The filter 'APP - EXT FLEET MGMT|CAT|EXT|EXT FLEET MGMT|EXTERNAL FLEET MGMT|FLEET MANAGEMENT|FLEET SERVICES|'FRANCHISEE|LEASE CO. (FIXED PR)|LEASE COMPANY|MANU (FIXED PR)|MANUFACTURER|OTHER|WARRANTY' is invalid.
You entered an inavlid expression in the filter....
Do I need to enter anything different when using filters with spaces, fullstops, etc ?0 -
If you have prackets () you will need to put within single quotes '
I strong suggest to use Mark.0 -
Why not just create a new boolean field, mark these customers with this boolean field, then filter on teh boolean field?Confessions of a Dynamics NAV Consultant = my blog
AP Commerce, Inc. = where I work
Getting Started with Dynamics NAV 2013 Application Development = my book
Implementing Microsoft Dynamics NAV - 3rd Edition = my 2nd book0 -
We have several Vendors that offers Yearly discounts. Not all, so in the beginning we used to type out all the codes and it's a real pain.
So another train of thought was if these customer/vendors all have something in common you can try & group them in another way either using say dimensions or creating you'r own custom field.
Then you can filter on that really easily.0 -
And usually it is pretty bad to hardcode the values in the code. Navision is great because in it you can set up almost everything. What is going to happen if you will decide to add a customer to your filter or delete a customer.....going back to code writing. So I think deadlizard is right, you should create a new boolean field and filter buy it. And do not forget to add this field to the Customer Card, so users can change settings themselvesBest Regards,
Oleg0
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