Error Management with Lookup Temporary tables

Belias
Member Posts: 2,998
Maybe there's a topic about this but i don't remember where is it...
example: i have a temporary table and i fill it with two or more loops on the real table. (here's a raw code sample)
now, i'm gonna use this table in order to show a lookup in a request page.
moreover, if the user manually writes a value out of the range of this table, i have to give him an error.
My problem is that i still can't find a smart way to give a descriptive error to the user: here's my current version
-onlookup-
-onvalidate-
-Myvalidatefunctionforitemcodevariable-
Thanks in advance (there's probably some error in the code, i wrote it in 5 minutes, sorry [-o< )
example: i have a temporary table and i fill it with two or more loops on the real table. (here's a raw code sample)
Tbitem.setrange("no.",'aaa'); Tbitem.findset; repeat tbitemtemp := Tbitem; if tbitemtemp.insert then; until Tbitem.next = 0;
Tbitem.reset; Tbitem.setrange("description",'*aaa*'); Tbitem.findset; repeat tbitemtemp := Tbitem; if tbitemtemp.insert then; until Tbitem.next = 0;
now, i'm gonna use this table in order to show a lookup in a request page.
moreover, if the user manually writes a value out of the range of this table, i have to give him an error.
My problem is that i still can't find a smart way to give a descriptive error to the user: here's my current version
-onlookup-
if page.runmodal(0,tbitemtemp) = action::lookupok then begin CDMyItemCodeVariable := tbitemptemp."no."; Myvalidatefunctionforitemcodevariable; end;
-onvalidate-
//fill the buffer if the temporary table is still uninitialized Myvalidatefunctionforitemcodevariable;
-Myvalidatefunctionforitemcodevariable-
tbitemtemp.get(CDMyItemCodeVariable); //this instruction gives the error "item no. xxx does not exist" <--a bit confusing for the user, //as the item xxx DOES exist in the real table, but not in the temporary table //other processing...
Thanks in advance (there's probably some error in the code, i wrote it in 5 minutes, sorry [-o< )
0
Answers
-
Something like this?
IF NOT tbitemtemp.GET(CDMyItemCodeVariable) THEN ERROR('Item "%1" is not valid',CDMyItemCodeVariable);
Regards,Alain Krikilion
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!0 -
ok, then i guess that a manual written error is the only way to go...
now, i was using something like what you wrote me, instead of a standard "GET" error: something like:
"item AAA not valid, use the lookup button, instead."
the problem is that the user don't know why its item is not correct, unless i manage every single error that can rise from the temporary table...this is expensive in terms of time of development, so i'll go for the "generic error" solution, that is the "if it was hard to program, it has to be hard to understand!" philosophy :whistle:
thank you!0 -
The GET-error lets the user always think it is a bug. So this must be avoided.
Better put a generic error-message so the user knows it is a wrong item but the error in itself is not a bug.Regards,Alain Krikilion
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!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