How to use lookup on a textbox
gurleen
Member Posts: 39
I have a textbox which is attached to a table field underneath. I want the user to have 4 fixed options. I have tried everyway but cannot get the textbox to show a dropdown box with the desired values in it. The textbox connects back to a a field that is of type text ( it's not of type option).
0
Comments
-
You can use the OnLookUp event to open a form linked to a table containing only yout four options. When the use makes a selection, simply pass the selection back through the event's TEXT parameter.
It's a bit of a waste of a table ID though.
Why can't you change the field to type Option?0 -
no no no no
. Create a variable with datatype option, and put your option values in the optionstring property of the variable. Then add a text box to your form and set the SourceExpr property of the text box to the new variable.
<edit>
Much better even:
Change the data type of your field to option, and enter the option values there. Then it's just a matter of dragging the field from the field list onto your form.
</edit>0 -
I think I might not have explained properly. T
The form connects to a temporary record type underneath. One of the fields in the table can have only four values . I want the user to have the option of selecting the values from a dropdown rather than remembering them.
If I link the source expresion property to the option field then I wont be able to save the record back to the table ( with minimum code).
Also can I have an option field where I can fill the options at runtime.0 -
Well that's your design decision, but it sounds too complicated to me. If all yo're ever going to get is these 4 options, you need to create an option type field on the table, with only those 4 options as possible selections. It's never ever going to be anything but the selections in the option string, so it doesn't need to be dynamic. It is so much easier to just put your selections in an option field on the table itself. Take a look at the Type field on the Sales Line table for instance.
If you go the way you explained, with temporary records, then you will have to program the form or report or whatever to populate the temporary table.0 -
oh another thing... it is not possible to present a table lookup in a dropdown control, that's just not possible with objects available in the Navision IDE. The best you can do with a table lookup is a lookup button, which is the one with the arrow pointing up.0
-
I worked that one out. Now I load the form with the textbox attached to an option field. When the form closes I set the value of the table-record field from the option and update the record..
What about options at runtime. I have to show an option for all the locations of the company. The locations table does not include the company address, it just shows alternate ones. How do I combine the locations into one dropdown. Right now my dropdown only shows values from the Location table ( ie I am missing the company address )0 -
I don't understand why you have to do it so complicated. You need to update a field with a value out of an option field, why not just make the field an option field and be done with it? That's no programming at all, and you could have been done in two seconds instead of two days.0
-
But how can I have an option field that can keep track of all the locations for the company.
My form has three Textboxes on it.
1. One which has static choices ( I converted the field to option and it works fine)
2. The second and the third textboxes can take any location code for the company. The problem is that the location code comes from two different tables ( Locations & Company Address ) and can change if the user adds or deletes any address.
My question is how to create a dropdown in the second and the third textbox.0 -
That's comparing apples and oranges. A Location is a warehouse location, a storage facility. The company address is the address of the legal entity. If you need to have a storing facility at the same address as the company, why not just enter one in the location table and be done with it? That takes just 15 seconds as opposed to developing a solution where you compine data from two incompatible entities and force the system to treat them the same.
What is going to happen with your on hand quantities? How are you going to do the replenishment? There are many other questions when you try to make these types of changes.
I don't mean to dismiss the issue, maybe I misunderstand it, but there are very easy solutions for the issues that you seem to have.0 -
I need all the locations for some other purposes. A user should be allowed to choose any address related to a company which will include the main adderss and all the locations.This is a buisness requirement which I can't ignore.0
-
Then I suggest you use a different name than Location. This is the name of a very specific piece of Navision functionality, and may cause confusion
.
I still don't understand what you need to do, but here are some general tips:
Before you can display the temp record on any form, you need to fill the temporary Rec variable with information from wherever you want to get the information from.
Then you open the form for the temp variable. If you use the table's lookup form, and you set the lookupmode property to TRUE, then you will see the OK button, and you can do the RUNMODAL and the ACTION::OK thing, and consequently capture the code of the "location" and program the rest of it.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
- 322 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
