Assign data in a LookUp

Alkro
Member Posts: 115
Hi,
I've a Form that contain a textbox (the txtbox shows a field of a table), and this textbox have a call to another Form (lookup). I want that, when i select any data in the lookup, this data save in the textbox and the field in the table.
The textbox has LookUpFormID: 50001 and
SolOrigen - OnLookup(VAR Text : Text[1024];) : Boolean
FORM.RUNMODAL(50001);
But i don't know how to say "Save this, here"
I don't find the way...
Regards
I've a Form that contain a textbox (the txtbox shows a field of a table), and this textbox have a call to another Form (lookup). I want that, when i select any data in the lookup, this data save in the textbox and the field in the table.
The textbox has LookUpFormID: 50001 and
SolOrigen - OnLookup(VAR Text : Text[1024];) : Boolean
FORM.RUNMODAL(50001);
But i don't know how to say "Save this, here"
I don't find the way...
Regards
0
Comments
-
-fill in the TableRelation-property of the field in the table (in you case the source table of your form 50001).
-In the table (the sourcetable of your form 50001) where the value is that you want to select, you just have to put property "LookupFormID" to the form of the list (in your case 50001).
An example of this system:
-Table 3 : check the property "LookupFormID"
-Table 36 : field "Payment Terms" : check property "TableRelation"Regards,Alain Krikilion
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!0 -
Well.
i added a field in table "Purchase Header" called DATA.
In a form, i have a textbox that show this data. I want that, when an user wants to change this data, push on the lookup in this textbox and select one record of this field in table Purchase Header.
I,ve tried this you tell me, but doesn`t work.-fill in the TableRelation-property of the field in the table (in you case the source table of your form 50001).-In the table (the sourcetable of your form 50001) where the value is that you want to select, you just have to put property "LookupFormID" to the form of the list (in your case 50001).
Maybe C/AL code?
Can be, in OnPush() the ComandButton to Accept the lookup Form, give the data of the selection to the textbox in Form???
Regards0 -
Common structure of OnLookup trigger:
RecVar.SETRANGE(...); //Setting filters - what I want to see in the list ... if FORM.RUNMODAL(0,RecVar) = Action::LookupOK then begin //The action, which will be performed after user click OK button. //Selected record is returned in RecVar... Rec.VALIDATE(MyField,RecVar.FieldValue); end;
0 -
Lets start from the beginning:
-you have a new table and a new form (your form 50001).
In the table you need to set tableproperty "LookupFormID" to your form. This tells the table to use the form when an lookup-action is done on the form. Your form needs 2 buttons : Ok and Cancel with certain properties set (if you create a new form connected to a table with the form-wizard, this is done automatically).
To view the table-properties of a table, go into design and go to the place to create a new field in the table without creating the field. Then you will see the tableproperties.
-in field of the other table ("Purchase Header".DATA), you just need to set the property TableRelation of the field.
Don't run table "Purchase Header" directly because it is possible the lookup to select a value doesn't work. But put the field on a form and run that form.Regards,Alain Krikilion
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!0 -
Lets start from the beginning
.
I use Form 50 (Purchase Order). I'm created a Textbox where i can saw number of application for a order.
Ex. Order: 11001 ---> Application: 0012
Well for this data (Application) i create in Table 38 a new field, called "OLD APP".
There is cases that one Application maybe create various Orders. Application: 0013 ---> Order:11002, Order:11003. I want the user click on this textbox of Form 50 (ORDER), and select Application number from a new Form where can see all the orders with their applications. When select, aplly this value in Table 38 new field.
Actually i can saw the new form, cliking textbox, but when i select the application, the textbox don't take this value.0 -
Alkro wrote:Lets start from the beginning
.
I use Form 50 (Purchase Order). I'm created a Textbox where i can saw number of application for a order.
Ex. Order: 11001 ---> Application: 0012
Well for this data (Application) i create in Table 38 a new field, called "OLD APP".
There is cases that one Application maybe create various Orders. Application: 0013 ---> Order:11002, Order:11003. I want the user click on this textbox of Form 50 (ORDER), and select Application number from a new Form where can see all the orders with their applications. When select, aplly this value in Table 38 new field.
Actually i can saw the new form, cliking textbox, but when i select the application, the textbox don't take this value.
So, you don't have a new table with the Application-numbers in it? But you show and select a purchase order that has some application number.
This is the code for it: (like kine already wrote).
OnLookup-trigger of the fieldrecPurchaseOrder.RESET; recPurchaseOrder.SETCURRENTKEY(....); recPurchaseOrder.SETRANGE(.....); // put the filters you need IF FORM.RUNMODAL(FORM::"New Form",recPurchaseOrder) = ACTION::LOOKUPOK THEN BEGIN VALIDATE("OLD APP",recPurchaseOrder."OLD APP"); END;
Regards,Alain Krikilion
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!0 -
I'm doing anything wrong
, because no work like i want
In Form 50 (Purchase Order) i have the Textbox with SourceExpression "Purchase Header.OLD APP". The Textbox Properties, in LookUp is YES, and C/AL Code TextBox.LookUp() i put FORM.RUNMODAL(50013);
When i push on LookUp in Textbox, the 50013 Form appears. And now, i want select one field in this Form 50013 (OLD APP one of this) and when i push Accpt in the form, the form close and the Textbox have the "OLD APP" Value.
Last parrafe is only i need.0 -
Alkro wrote:In Form 50 (Purchase Order) i have the Textbox with SourceExpression "Purchase Header.OLD APP". The Textbox Properties, in LookUp is YES, and C/AL Code TextBox.LookUp() i put FORM.RUNMODAL(50013);Alkro wrote:When i push on LookUp in Textbox, the 50013 Form appears. And now, i want select one field in this Form 50013 (OLD APP one of this) and when i push Accpt in the form, the form close and the Textbox have the "OLD APP" Value.Regards,Alain Krikilion
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!0 -
kriki wrote:Best put the code for the lookup of the field in the table, not in the form.
. Table 38, OldApp field, LookUp().
kriki wrote:Once you put the code in the table, post the code you put so I can check it.
Now in the OldApp - LookUp() only have FORM.RUNMODAL(50013);
Regards0 -
Alkro wrote:I don't know the code. This is the problem. I don´t know how can i get the value from Form 50013 pushing "Accept" bottom and save it in OldApp field (Table 38) in the open Order from form 50.
Now in the OldApp - LookUp() only have FORM.RUNMODAL(50013);recPurchaseOrder.RESET; recPurchaseOrder.SETCURRENTKEY(....); recPurchaseOrder.SETRANGE(.....); // put the filters you need IF FORM.RUNMODAL(FORM::"New Form",recPurchaseOrder) = ACTION::LOOKUPOK THEN BEGIN VALIDATE("OLD APP",recPurchaseOrder."OLD APP"); END;
Regards,Alain Krikilion
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!0 -
Ohohoh,
Yes, i put the code (modify for me)and work...
¡¡FINE!!
Thank you kriki0 -
recPurchaseOrder.RESET; recPurchaseOrder.SETCURRENTKEY(....); recPurchaseOrder.SETRANGE(.....); // put the filters you need IF FORM.RUNMODAL(FORM::"New Form",recPurchaseOrder) = ACTION::LOOKUPOK THEN BEGIN VALIDATE("OLD APP",recPurchaseOrder."OLD APP"); END;
This doesn't work if you RUN the table from the Object designer and push F6 and click on OK :shock:
But run a form, push F6 and click OK it works. :?:
I'am using 4.020 -
ajhvdb wrote:
recPurchaseOrder.RESET; recPurchaseOrder.SETCURRENTKEY(....); recPurchaseOrder.SETRANGE(.....); // put the filters you need IF FORM.RUNMODAL(FORM::"New Form",recPurchaseOrder) = ACTION::LOOKUPOK THEN BEGIN VALIDATE("OLD APP",recPurchaseOrder."OLD APP"); END;
This doesn't work if you RUN the table from the Object designer and push F6 and click on OK :shock:
But run a form, push F6 and click OK it works. :?:
I'am using 4.02
In older (I think <=3.7) versions that worked. At least I can't remember having encountered the problem.Regards,Alain Krikilion
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!0 -
Thx for confirming i'm not completely mad :x
I just wanted to change the onlookup in a few minutes and after an hour of disbelieve gave it up and posted this message.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