Yo have to program it on the OnLookup trigger, for example to get the address from the Customer table you would have to do something like this:
Customer -> Record var. table Customer
CustomerList -> Form var. form Customer List
CustomerList.LOOKUPMODE(TRUE)
IF CustomerList.RUNMODAL = ACTION::LOOKUPOK THEN
CustomerList.GETRECORD(Customer)
After running this you will have the record selected on the Customer list, and you can get the field you want, for example the address, that is not the primary key. You can filter the records you see on the list using the property SETTABLEVIEW of the form.
At the risk of sounding religiously strict about these matters: I think in 9 out of 10 cases where you need the sort of functionality you requested, there's a major flaw in the data model. Just a warning...
Jan, I think you are completely right and I'm glad you said
9 of 10, there's a 10% chance for my data model to be correct
I found another situation where I needed to use Sgg's and Estefania's
solution:
- I wan't to lookup a table in a report's request form, but the field
doesn't belong to any of the DataItems in the report.
Could you tell me something about this issue?
Thanks.
Sure! Assuming the primary key that you need to lookup consists of only one field, here's what I would do:
- Create a variable of the same type as the primary key field, and make it the SourceExpr of the textbox you place on the request form;
- Set the textbox' TableRelation to the related table;
- Set the textbox' CaptionML to the appropriate value;
Primary key values consisting of more than one field require some additional programming in the textbox' OnLookup and OnValidate trigger.
Hi,
When we make a PO, on selecting Item as the Type on lookup of Item list in No. field, only those items must be visible those are having a boolean true. How this can be done.
Comments
IF Form.RUNMODAL(form::FormName, LkTable) = ACTION::LookupOK THEN
LkValue := LkTable.LkField;
The Form::FormName should be a Listing or Lookup Form for the Table where you want to pick the Field from.
Put the codes in the OnLookUp Trigger of the TextBox for the Field you have in mind LkValue
Customer -> Record var. table Customer
CustomerList -> Form var. form Customer List
CustomerList.LOOKUPMODE(TRUE)
IF CustomerList.RUNMODAL = ACTION::LOOKUPOK THEN
CustomerList.GETRECORD(Customer)
After running this you will have the record selected on the Customer list, and you can get the field you want, for example the address, that is not the primary key. You can filter the records you see on the list using the property SETTABLEVIEW of the form.
Both of the solutions solve my problem.
Anytime you need help I'll be 100% available.
Jan Hoek
Product Developer
Mprise Products B.V.
9 of 10, there's a 10% chance for my data model to be correct
I found another situation where I needed to use Sgg's and Estefania's
solution:
- I wan't to lookup a table in a report's request form, but the field
doesn't belong to any of the DataItems in the report.
Could you tell me something about this issue?
Thanks.
- Create a variable of the same type as the primary key field, and make it the SourceExpr of the textbox you place on the request form;
- Set the textbox' TableRelation to the related table;
- Set the textbox' CaptionML to the appropriate value;
Primary key values consisting of more than one field require some additional programming in the textbox' OnLookup and OnValidate trigger.
Jan Hoek
Product Developer
Mprise Products B.V.
When we make a PO, on selecting Item as the Type on lookup of Item list in No. field, only those items must be visible those are having a boolean true. How this can be done.
Please start a new thread and also explain what you have tried so far.