@DbLookup guidance

I created a form with the field, Market, that uses an @DbColumn (which looks at a view, MarketImport) within a dialog list to allow the user to select a Market . The next field is called Submarket. I have a view, SubMarketImport, with the first column being the Market and the second column listing the Submarket of that Market. For example, column 1 can contain three records with Oil and column 2 will be the submarkets of Oil.

Oil > SubOil1

Oil > SubOil2

Oil > SubOil3

I am having a tough time trying to get an @DbLookup to work properly. The Key would need to be the Market field. So within the Submarket field, I have the type as Dialog List and using Formula for choices, I have the following:

tempmkt := Market;

@DbLookup(“”:“NoCache” ; “IPCS1/Neville” : “”; “SubMarketImport”; tempmkt;2)

My thinking is that I need to pull in the value of the Market field (previous field) and save it as a temporary field and use that as the Key. Then use that value to search the SubMarketImport view and look to column 2 as the values to display in the dialog list of the Submarket field. I know that I am missing something because this is not working. Can anyone offer any guidance?

Thank you.

Subject: @DbLookup guidance

Do a couple of things…

  1. in the Market field properties make sure you have “Refresh document on keywords change” checked. This will update the Market value in the doc when you change values.

  2. in the Submarket field properties make sure you have “Refresh choices on document refresh”. This will refresh your Submarket keywords formula with the new Market value.

This should get you started

regards

Subject: RE: @DbLookup guidance

And there’s no reason to use a temporary value for the Market field – use it directly in your lookup.

Subject: RE: @DbLookup guidance

Thank you both for your input. I did use the Market field directly and it made the code neater and easier to work with. I’d forgotten about the Refresh check boxes. Both of your input helped me resolve my problem.

Thank you! Have a good day.

Anita