Lookup forms that allow/disallow editing

bhalpin
Member Posts: 309
Hi.
I had occasion to add the Item."Item Category Code" field to a form, and gotthe expected lookup behaviour for free. But, when the form Item Categories pops up, you can edit the contents, which is (in this case) undesirable. I looked for missing 'magic' in the table and form, but all looked normal. So I checked a few others, like the lookups from the item card fo posting groups, unit of measure. All allowed editing. (I gues I never really noticed before ...)
Anyway, the user wants the category lookup to behave like the item no. on a sale order line, the sell-to customer in the header, etc., etc., - they are all "pure lookups", with no editing.
This was all in 4.0SP3, and I've checked up to 6.0SP1 and it's still the same.
So this boils down to two questions:
1 - Is there a reason they made some lookups "pure" lookups and others are editable? (I mean from an user-inteface design point of view, not a technical one.)
2 - Regardless, am I going to have to hand-code the lookup and set the form to Editable(False) to get the desired behaviour?
I guess there's a 3rd question - where is the "magic" that makes the forms behave differently?
Thanks a bunch!
I had occasion to add the Item."Item Category Code" field to a form, and gotthe expected lookup behaviour for free. But, when the form Item Categories pops up, you can edit the contents, which is (in this case) undesirable. I looked for missing 'magic' in the table and form, but all looked normal. So I checked a few others, like the lookups from the item card fo posting groups, unit of measure. All allowed editing. (I gues I never really noticed before ...)
Anyway, the user wants the category lookup to behave like the item no. on a sale order line, the sell-to customer in the header, etc., etc., - they are all "pure lookups", with no editing.
This was all in 4.0SP3, and I've checked up to 6.0SP1 and it's still the same.
So this boils down to two questions:
1 - Is there a reason they made some lookups "pure" lookups and others are editable? (I mean from an user-inteface design point of view, not a technical one.)
2 - Regardless, am I going to have to hand-code the lookup and set the form to Editable(False) to get the desired behaviour?
I guess there's a 3rd question - where is the "magic" that makes the forms behave differently?
Thanks a bunch!
0
Comments
-
1 - there's two kinds of list forms. The first is a list form for master tables and other tables that you have a 'Card' form for. In those cases you edit the records in the 'Card' form, and the list form should never be editable. Non-editable list forms should always be called "Something List", like "Item List" or "Customer List". The second is a list form that is used for both data entry and selection. In this case, there is no 'Card' form, because the number of fields is usually small enough to be contained on the list form. These list forms are always editable, and are recognized by their name, which is the table name in plural, such as "Default Dimensions", or "Purchase Prices".
2 - There's a property called 'LOOKUPMODE', which you can set if you use a form as a variable. I think you might be able to catch it in OnOpen (you know... IF LOOKUPMODE THEN CurrForm.EDITABLE := FALSE, or CurrForm.EDITABLE(NOT LOOKUPMODE) or something like that). I don't have NAV open so I can't check at the moment, but if I remember I'll see if I can find it for you.0 -
DenSter wrote:IF LOOKUPMODE THEN CurrForm.EDITABLE := FALSE
I think it'sIF CurrForm.LOOKUPMODE THEN CurrForm.EDITABLE := FALSE;
in the OnOpenForm trigger.0 -
Thanks guys.
I can 'hack' it from here.
It's funny that base NAV doesn't have the IF LOOKUPMODE stuff in there already.
Cheers!0 -
bhalpin wrote:It's funny that base NAV doesn't have the IF LOOKUPMODE stuff in there already.0
-
Same here. I always thought that if you wanted to add something you should be going through a setup of some kind. Has never made sense to me.0
-
Maybe they expect you to manage the edit vs. lookup through table permissions.0
-
Like: CurrForm.EDITABLE(NOT CurrForm.LOOKUPMODE); ?0
-
You mean what I said in my first reply:DenSter wrote:2 - There's a property called 'LOOKUPMODE', which you can set if you use a form as a variable. I think you might be able to catch it in OnOpen (you know... IF LOOKUPMODE THEN CurrForm.EDITABLE := FALSE, or CurrForm.EDITABLE(NOT LOOKUPMODE) or something like that). I don't have NAV open so I can't check at the moment, but if I remember I'll see if I can find it for you.0
-
Shedman wrote:If it's a boolean just use it as a boolean
Code: Select all
CurrForm.EDITABLE(NOT CurrForm.LOOKUPMODE);
I could be mistaken, but I believe that that is not correct according to NAV coding standards. If you want to assign a value you are supposed to use := or VALIDATE. I'll be the first to admit, though, that I still sometimes do it that way. Old habits die hard.0 -
I add this code for most of my clients. I think it is definitely an inconstancy and not explained, but one of those things we just know.
Form - OnOpenForm()
// don't allow editing of this form in, lookup mode
IF CurrForm.LOOKUPMODE THEN
CurrForm.EDITABLE(FALSE);David Singleton0 -
Sorry had this open for a loooonnngg time and just replied. It looks like we all agree on this.Shedman wrote:
IF CurrForm.LOOKUPMODE THEN CurrForm.EDITABLE := FALSE;
If it's a boolean just use it as a booleanCurrForm.EDITABLE(NOT CurrForm.LOOKUPMODE);
These are actually very different pieces of code that do different things; they are not the same.David Singleton0 -
Extending this topic a little more, I have a situation where I want to use one form for both data entry as well as displaying the drill-down results of a FlowField. For data entry, this form is used as a subform and should be editable. When looking at the FlowField, which is in a completely different table, i want to be able to drill down and see the entries in a non-editable state.
The only solution I've been able to come up with is to have two identical forms except the subform is editable and the drill-down is not.
Any other ideas?
Thanks in advance!
- Zac0 -
David Singleton wrote:Shedman wrote:
IF CurrForm.LOOKUPMODE THEN CurrForm.EDITABLE := FALSE;
If it's a boolean just use it as a booleanCurrForm.EDITABLE(NOT CurrForm.LOOKUPMODE);
These are actually very different pieces of code that do different things; they are not the same.
What is the differences?Regards,
Andwian0 -
Because you change the state of "editable" regardless of any logic. It will always be set one way or the other...
t0
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