How to know that Record.GET has been already executed ?
amer
Member Posts: 22
To avoid unnecessary DB traffic I want to do GlSetup.GET only once because it is Global variable (GlSetup is "General Ledger Setup" tables) but there is no way to detect for a Record variable that Record.GET has been already executed.
(I need GlSetup to handle validation triggers for some fields in another table)
I could use some GetFlag boolean variable to set it TRUE after GET statement but is there any more convenient way?
(ISEMPTY, COUNT, GETPOSITION are useless, Table GlSetup has Primary key always blank, etc)
Best Regards,
Amer
(I need GlSetup to handle validation triggers for some fields in another table)
I could use some GetFlag boolean variable to set it TRUE after GET statement but is there any more convenient way?
(ISEMPTY, COUNT, GETPOSITION are useless, Table GlSetup has Primary key always blank, etc)
Best Regards,
Amer
0
Comments
-
Store it in TempGLSetup table and then you don't have to do get
for example
function GETGLSetup()
if not TempGLSetup.get then begin
GLSETUP.get;
TempGLSetup := GLSETUP;
TempGLSetup.insert;
end;
This way you can use TempGLSetup and all you have to do is call GETGLSetup everywhere.0 -
Check out Codeunit 90:
GetGLSetup() IF NOT GLSetupRead THEN GLSetup.GET; GLSetupRead := TRUE;
GLSetupRead is a global boolean variable0 -
No that is just bad advice, you can't simply replace FIND('-') with FINDFIRST.0
-
In the above example you can.
He never said that you should replace all FIND('-') with FINDFIRST.
He said in examples such as that, it is possible.This isn't a signature, I type this at the bottom of every message0 -
In some cases you can make that replacement, but the post implies that it is always the case, and that would be bad advice.0
-
FINDFIRST vs. FIND('-') only makes a difference on SQL. It change the way in which SQL builds its cursors. The two commands behave the same way on the native database.There are no bugs - only undocumented features.0
-
It's just NOT a problem what you need to care about.
It's doesn't created any traffic after first call. Navision has own data cache.
I am not so sure. Try to use Client Monitor or SQL profiler. Every time I issue GLSetup.GET(), there are at least two DB messages.
I agree that Nav produces pretty traffic but NAV also used to avoid it whenever it is possible.
Proof is: as DenSter Quoted example:Check out Codeunit 90:
Code:
GetGLSetup()
IF NOT GLSetupRead THEN
GLSetup.GET;
GLSetupRead := TRUE;
Obviously, boolean variable is the best way.
If you all agree, maybe they should implement above structure in something like GETCASHED because setup tables (with one row only and read purpose) are pretty frequently used in code(just to save coding).
Thanks!
Best Regards,
Amer0 -
For me a get on a setup table is poor in DB traffic.
When i use the client monitor a GET is less than 1 ms.
I completly agree with Black tigger
You just need to do the get before your loop for a get on a setup table.
But do better attention with the FIND and FINDSET and the keys
regards.0 -
Oh I do agree that you will not get any real performance increase by modifying one GET statement (unless that GET statement is executed 1000 times in a loop or something).0
-
Or without boolean:
function GetGLSetup IF recGeneralLedgerSetup."Primary Key" = '' THEN BEGIN recGeneralLedgerSetup.GET(); recGeneralLedgerSetup."Primary Key" := 'X'; END;
of course, you may not save the record.Regards,Alain Krikilion
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!0 -
I think the code can be written in 50 different ways. I think standard navision should have a signle instance codeunit so that you get all the setups at logining in of the company and then you could just get them from the single instance codeunit.0
Categories
- All Categories
- 75 General
- 75 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
- 611 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 253 Dynamics CRM
- 103 Dynamics GP
- 6 Dynamics SL
- 1.5K Other
- 991 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 28 Design Patterns (General & Best Practices)
- Architectural Patterns
- 9 Design Patterns
- 4 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1K General Chat
- 1.6K Website
- 77 Testing
- 1.2K Download section
- 23 How Tos section
- 249 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions

