OR Filter on Forms

ta5
Member Posts: 1,164
Dear experts
I have a special form which needs to have 2 filters for security reasons. The problem is, that both filters are independent. For example only records with Field1 = 'x' OR Field2='y' must be shown. How can this be achieved?
Thanks in advance
Thomas
I have a special form which needs to have 2 filters for security reasons. The problem is, that both filters are independent. For example only records with Field1 = 'x' OR Field2='y' must be shown. How can this be achieved?
Thanks in advance
Thomas
0
Comments
-
temporary table.
filter set 1 on the record, insert them into the temporary table, then unset filter 1, set filter 2 and add those if you don't find them.
Ie:setfilter(field1,'x'); if findset then repeat temptable.setrange(primary key field,rec."primary key field"); temptable.setrange(primary key field 2,rec."primary key field 2"); if temptable.isempty then begin temptable.copy(rec); temptable.insert; end; until next = 0; imagine what will be next
0 -
Hi Sog
Thanks for quick reply.
It's a ledger entry table, I think it's too slow. What do you think?
Thomas0 -
I did something similar but it's not a simple solution. For large tables, the only way I know how to accomplish this efficiently is to create a new boolean field and assign its value in the OnInsert and OnModify table triggers. No need to use the MARK function or temporary tables. However, it only works if the conditions are static, since you have to hardcode them.
You may or may not need to add this new boolean field to an index, depending on the distribution of the values amongst the data (performance monitoring and/or your user base will tell you).
Dave0 -
ta5 wrote:Dear experts
I have a special form which needs to have 2 filters for security reasons. The problem is, that both filters are independent. For example only records with Field1 = 'x' OR Field2='y' must be shown. How can this be achieved?
Thanks in advance
Thomas
I have a scenario which is possibly the same as yours, basically a user can see item ledger entries if they were sold to their customer, so there is a field "Sales Rep." also a person in charge of a location can see entries for this there is a field "Sales Location" both fields link to the sales person table. Now there is a new field something like "Security filter" := "Sales Rep." + '|' + "Sales Location". So applying a filter to this new field gives an "OR" filter.
We had to do a lot with indexing and testing to make it work OK, but in the end its pretty fast. though its a pretty small database (approx 40gig) so not sure how it would go on a big one.David Singleton0
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