Is the recordref open?

Ril
Member Posts: 6
Am I missing the obvious parameter or function in C/side which would actually allow me to check if a recordref is open?
This to avoid the error from NAV saying RECORDREF variable not initialized.
Hope any one knows or maybe have a workaround other than keeping some parallel index for open or not.
It is needed for a temporary based array where i keep differnt tabels in differnt indexes, though out a process
Index[x,y] may have an open recordref but at runtime i need to check this.
This to avoid the error from NAV saying RECORDREF variable not initialized.
Hope any one knows or maybe have a workaround other than keeping some parallel index for open or not.
It is needed for a temporary based array where i keep differnt tabels in differnt indexes, though out a process
Index[x,y] may have an open recordref but at runtime i need to check this.
Richard Lindberg
0
Comments
-
You can try this:
-create a new codeunit with a function that accepts a recordreference and function puts it in a global variable.
-in the OnRun-trigger access the variable so it gives an error if not initialized.
To control if the variable is initialized :
-Make a global (cduTestRecordReference) to that new codeunit.CLEAR(cduTestRecordReference); cduTestRecordReference.SendRecordReference(rerTheRecordReference); IF cduTestRecordReference.RUN THEN MESSAGE('recordreference is initialized');
Regards,Alain Krikilion
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!0 -
Thank you for your reply - i did already try this approach - how ever in the context im running - i am able to crach the NAS - because NAV - blocks on the execption even though it was catched by the IF cu.run thing.
So this does not do the trick for me.
So conclusion is that I have to maintain a persited index keeping track on sets open - and in the same post hope that NAV development reads this and fixes this obvious lack of functionallity in c/side using RecordRef.Richard Lindberg0 -
If I understand the question correctly, you want to check if the RecordRef has been initialized to something or not, is that correct?
If so, this is dirty, but:IF FORMAT(MyRecordRef) <> '' THEN BEGIN ... ... END;
0 -
Dirty but very nice!
Can you create a new topic in the tips&tricks forum with this one?Regards,Alain Krikilion
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!0 -
Thank you MTC - that was exactly it - dirty who cares - c/side on the edge is often dirty, knowing all the dirty trick is what makes the c/side "programmers" world go round.Richard Lindberg0
-
comming back to this topic, because i ran into the “The length of the source exceeds the size of the destination buffer” Error with the dirty solution (IF FORMAT(RecordRef) then ... )
and the kriki-solution (if Codeunit.RUN then ... ) has a small but importend disadvantage: it can't be used in write transactions
using NAV5 and NAV6 classic.
are there any other solutions, how to test whether a record-Ref is initialized or not?Svensk.Tiger (Henning Möller)
PASS Multibank Solutions AG
(Kaum macht man was richtig, schon geht es. / Once you do it right, suddenly it works.)0 -
Tried this on a NAV 2009R2 classic:
MESSAGE('%1',recref.NUMBER);
and when it is not initialized, it returns 0.Regards,Alain Krikilion
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!0 -
kriki wrote:Tried this on a NAV 2009R2 classic:
MESSAGE('%1',recref.NUMBER);
and when it is not initialized, it returns 0.
THX, this is working fine.Svensk.Tiger (Henning Möller)
PASS Multibank Solutions AG
(Kaum macht man was richtig, schon geht es. / Once you do it right, suddenly it works.)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