populate list box

Hi How can I populate a Text box with values (required column is not a primary key)from a table in the request form a report ? Any help will be appreciated. Regards Joseph Mathew

Say you want to get Country Name in the editbox (Code is primary key). Declare a global variable TheCountry, Record, Country. Make TheCountry.Name source expression of your Editbox. In the OnLookup trigger of the Editbox type this: IF FORM.RUNMODAL(FORM::Countries,TheCountry) = ACTION::LookupOK THEN TheCountry.Name := TheCountry.Name; Enjoy the result! Pelle

Hi Great!! Its working fine. Thanks a lot. I have one more question also. Now the lookup form shows all the columns of the table. But I want to show only one column ie. cityname. What should in write in CA/L to get this. Regards Joseph Mathew

The easiest way is to create a new form for this purpose. Per.Bay@navigera.com Product Manager www.navigera.com

quote:


Originally posted by pelle: Declare a global variable TheCountry, Record, Country. Make TheCountry.Name source expression of your Editbox. In the OnLookup trigger of the Editbox type this: IF FORM.RUNMODAL(FORM::Countries,TheCountry) = ACTION::LookupOK THEN TheCountry.Name := TheCountry.Name;


While the above is entirely correct, I would recommend another approach instead. Providing the the field which should contain the country is a table-field, I would recommend to link it directly to the country table. (Field-Property: Table Relation) This has two main advantages: 1) Lookup to the country table is done by default. You don’t have to write any additional code for it. 2) Once you should decide to rename a country (e.g UK → GB) all occurences of this country code will be changed in all tables which have a link (foreign-key) to the country table. While this doesn’t seem to be important for the country it might definitely be if you are referring to currency or G/L accounts. As a general rule you should never lookup a field in another table which is not primary key. Do not connect a data-field to country.name, connect it to country.code instead. If you need country.name you could still have a second FlowField calculating country.name ------- With best regards from Switzerland Marcus Fabian