[RESOLVED] - Code in OnFindRecord in Customer Card

BorisK
Member Posts: 45
Can someone explain the purpose of the code in OnFindRecord in Customer Card:
RecordFound := FIND(Which);
CurrForm.EDITABLE := RecordFound OR (GETFILTER("No.") = '');
EXIT(RecordFound);
It was introduced in version 4.00. It appears to cause performance issues in one of our databases and I can't see any adverse effects if I remove it (and local variable RecordFound!).
Perhaps it is used when Customer Card is opened from somewhere else - but where?
RecordFound := FIND(Which);
CurrForm.EDITABLE := RecordFound OR (GETFILTER("No.") = '');
EXIT(RecordFound);
It was introduced in version 4.00. It appears to cause performance issues in one of our databases and I can't see any adverse effects if I remove it (and local variable RecordFound!).
Perhaps it is used when Customer Card is opened from somewhere else - but where?
0
Comments
-
It helps to protec Customer evidence from inserting unwanted records... If You omit line
CurrForm.EDITABLE := RecordFound OR (GETFILTER("No.") = '');
, you can set filter on primary key (field No.) and if nothing exist for this filter, you can enter some data and insert new record... Nothing more. Try It..0 -
Hmmm... :?
Thanks for the reply but I am not sure what you mean.
You can't set a filter for "No." anyway because it will be reset by
Form - OnAfterGetRecord()
SETRANGE("No.");
Any more ideas anyone?0 -
Try to change code like this:
RecordFound := FIND(Which); EXIT(RecordFound); { CurrForm.EDITABLE := RecordFound OR (GETFILTER("No.") = ''); EXIT(RecordFound); }
or (it doesn`t matter which one, thre result will be the same)RecordFound := FIND(Which); //CurrForm.EDITABLE := RecordFound OR (GETFILTER("No.") = ''); EXIT(RecordFound);
and then set filter on "No." field... You can see difference between standard and modified solution.0 -
I know it shouldn't but it seems to take awfully long time on the first line (FIND). May be nothing to do with code as such but I thought I would ask. Anyway - any more ideas what this code is for?0
-
As proposed try it and you will see.
If you filter for customer XXXXXXXYYYYYY and no such customer exists, your form will displayy a new record with XXXXXXXYYYYYY code. If you move to another field and type something your record might be inserted. So this code sets the form to non-editable if you filter for a customer that does not exist in order to avoid this.
Regarding the performance issue use your client monitor to see where the problem is.0 -
OK, I got it now.
Thank you both, this is all I need to know!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