?

Log in

entries friends calendar profile Компания НЭТИ Previous Previous Next Next
Filtering data on the form by “virtual” fields using OnFindRecord and OnNextRecord triggers - Сообщество неравнодушных к MD Nav (ex-Navision)
loggerzd
ru_navision
loggerzd
Filtering data on the form by “virtual” fields using OnFindRecord and OnNextRecord triggers
Purpose of this publication is to describe opportunity of filtering data on the form by “virtual” fields using OnFindRecord and OnNextRecord triggers. You can find many solutions of this problem on many forums on the Internet, but no one solution contains full description with total examples. During the preparation of this publication author caught almost all “bugs” of this method of filtering. If attentive readers will find any mistakes – please, tell us immediately.


Used terms:
• “virtual” field – any field on the list form. This field is not related with any field of the source table. Field’s value is calculated in the OnAfterGetRecord trigger.

Why have we needed this functional?
Our customer has many forms where “virtual” fields are used. It was necessary to do a solution to filter records on the form using values in “virtual” fields. At the same time user has to have a choise how to filter records – all records, only records with defined value, only record with any other value.
Suggested variants
• Using directives MARK and MARKEDONLY. Disadvantage – wasting of time to select records and all suitable.
• Using temporary table to change records on the form using OnFindRecord and OnNextRecord triggers. Disadvantage is necessity to manage temporary table in any changes of the data.
• Ignoring non-suitable records using OnFindRecord and OnNextRecord triggers. Disadvantage – form works a little bit longer then usually.

Solution
We’ve added 4 new functions on the form:
1. ShowThisRecord
2. FINDPosition
3. NEXTPosition
4. CheckAdditionsExists
We’ve added next code on the triggers:
1. OnFindRecord
2. OnNextRecord

Finalization
Solution works quite quickly and our customer is satisfied.
To download solution with simple example click here (*.fob) or here (*.txt)

Tags: , , ,

Leave a comment