Performing a Lookup

Hey, with a lookup into a table the user should make his choice. That’s no problem, but i need to choose the second field of a table. But if the user chooses an entry, the system always returns the first field of the shown table. How can i make the system get the second field of the lookup-table ? Stefan Weinreich Billing Analyst

Hi Stefan! I assume, that you are performing the lookup by Table-/Field-properties, not by code: Try setting the property TableRelation of that field like this

<Table>**.<Field>**

So the Field-Value should be returned … Regards, Jörg Joerg A. Stryk Apollo-Optik, IT/ERP

Create your own lookup routine for field (without relation to any tables): LookupFrom.RESET; IF FORM.RUNMODAL(SomeFormBasedOnLookupFrom, LookupFrom) = ACTION::LookupOk THEN BEGIN “Some Field” := LookupFrom.“Field 2”; END; Business Applications Programmer Sertified Navision Developer SIA “Sintegra” Latvia

The way Joerg is suggesting is the correct methid according to Navision, but… Be aware of an odd error that occurs in some versions of Navision. If the second field is not a part of the primary key, then if you ever do a rename on a table that links to the Primary key of that table, Navision will gve you an odd error about not being able to rename the record because XXXX is not a key in table YYYY (or something like that). The error message does not tell you where the error is, and the only solution is to remove the table relation. _________________________ David Singleton Navision Consultant since 1991 dmks22@home.com___________

As an example, if you import this object into a Navision database, you can no longer rename an Item, but the error message does not tell you where the error is. WARNING the object below will cause an error in your database, DO NOT import into anything except a test database. David Singleton Table Relation Error _________________________ David Singleton Navision Consultant since 1991 dmks22@home.com___________

Thanks to all ! I’ve tried what Joerg recommended, and i’ve got the error message David told me. I guess it’s a problem of versione DE2.50, because my navision has gobe astray several times today (and in the past). I didn’t test Alexei’s proposal yet, but it looks as a good idea. Stefan Weinreich Billing Analyst

Stefan: Now would be the time you would close this thread, so i dont have to do it :-). /Soren