setting filter on TableBox or on a SubForm
jks
Member Posts: 277
Hi all,
I want to do following but do not know how could I achieve it:
I have one table containing data in following format
No.
JS11
J___
_S__
__1_
ABCD
___D
Now conside Customer card in Navision. On it I want to display only those values from the above table which matches with the current customer.
i.e if my customer is JS13 then from above table J___, _S__, __1_ values should be displayed on it.
So how could I set the filter in above manner? Will it be possible to use Table Box for this or I have to use a SubForm? Will it be possible to directly set the properties of the control and do not need to do any coding?
Thanks for any help.
I want to do following but do not know how could I achieve it:
I have one table containing data in following format
No.
JS11
J___
_S__
__1_
ABCD
___D
Now conside Customer card in Navision. On it I want to display only those values from the above table which matches with the current customer.
i.e if my customer is JS13 then from above table J___, _S__, __1_ values should be displayed on it.
So how could I set the filter in above manner? Will it be possible to use Table Box for this or I have to use a SubForm? Will it be possible to directly set the properties of the control and do not need to do any coding?
Thanks for any help.
0
Comments
-
It is possible to create such a filter, but its a little fragile.
The simplest approach, and the most fragile, is to build a filter string.
the code is something like (I haven't tested this, but hopefully you get the general idea):filtertoken := '' ; filterstring := '' ; for i:= 1 to strlen(customer.no) do begin filtertoken := padstr('','_', 1-i) + DummyText."No"[i] + padstr('','_', strlen(customer,"no.") - i ) //not sure if this syntatically correct, you may have to do a copystr to get the ith char if filterstring <> '' then filterstring := filterstring + '|' + filtertoken else filterstring := filtertoken end ;
This is fairly dangerous code... lots of potential problems here. Not the least of which is that there is a limit to the number of characters that can be in a filterstring... its something like 250, so that puts an upper limit of the length of your customer no's to abotu 15 characters.
second of all, its very vulnerable to having bad characters in the customer no that will cause the filter string to break.
finally, the code is generally not performant.
but anyway, it can be done.
If you are looking to match any character, and not specifically the underscore character, you can use ? in your search string to do match any single char.
there are a couple of other clever ways to do this, btw. but I leave that to you.0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.7K Microsoft Dynamics NAV
- 18.8K 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
- 327 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