Newbie - dblookup usage

Hi!

Sorry about this one, but I’m not able to make dblookup work. I found many examples on the forum, but when I try to convert it to my reality, it doesn’t work…

The steps that I did are:

I created a form (fCountry) so the users can store the country name (txtCountryName) and its acronym (txtCountryAcron).

Then I created a view (vCountry) with two columns: txtCountryName and txtCountryAcron. I’m using SELECT Form = “fCountry” in view View Selection.

Everything seems to be working fine. I’m able to create a new document, and after that it’s shown into the view.

So I created a new form (fProduct) and put a field called (cbxCountry). Insied field’s control tab, in Choices, I selected “Use formula for choices”, and used the following formula:

@DbLookup(“”:“NoCache”;“”:“”;“vCountry”;txtCountryName; 1);

I tried many other parameter combinations, with no lucky. I always get “entry not found…”.

What I doing wrong?

TIA,

Bob

Subject: newbie - dblookup usage

I found the error:

I defined a default value to the field CountryName and when I opened the form, the combobox was filled with the acronym of the country.

So, instead a text field, I changed it to another combobox, and now I can do a cascade between the two combobox.

Thank you very much!

Bob

Subject: newbie - dblookup usage

Hi Bob,

please try @DbLookup(“”:“NoCache”;“vCountry”;txtCountryName; 1).

Greetings

Raul

Subject: RE: newbie - dblookup usage

Hi, thanks!

Didn’t work. A dialog appears telling that “the database was not found, please select servers to search”.

I also tried with just “” (instead “”:“”): @DbLookup(“”:“NoCache”;“”;“vCountry”;txtCountryName; 1).

After that I changed, I still receive the following error: “entry not found in index or view’s index not built”

TIA,

Bob

Subject: newbie - dblookup usage

You should use @DbColumn(“”:“NoCache”;“”;“vCountry”;1) if what you whant is displaying the list of country labels.If you got the country name, say in field “CountryName”, and you wish to retrieve the acron, use @DbLookup(“”:“NoCache”;“”;“vCountry”;CountryName;2)

Beware that the 1st column of your “vCountry” view HAS to be sorted for it to work.

Subject: RE: newbie - dblookup usage

Thanks!

The @DbColumn woks fine. But what I’m trying to do is the second scenario.

I did like you wrote: I created another field, called CountryName and changed my formula. It didn’t worked. Same error message.

I checked, and I think that the 1st column is sorted (into the column property, sorting tab, I selected Sort: Ascending). When I open the view, it shows me a gree circle telling that the view is indexed.

I also checked: the options “Refresh fields on document refresh” & “Refresh choices on document refresh” are checked.

I think that I’ll start everything again, if a plain new database… I can’t see what I’m doing wrong…

TIA,

Bob

Subject: RE: newbie - dblookup usage

Okay, say your 1st field (CountryName) presents the user the country label list using the @DbColumn. You want the acron appear in the 2nd field (CountryAcron) once you select the label. CountryAcron has to be of type “computed”. In the “Value” write the formula:

cn:=CountryName;

rc:=@DbLookup(“”:“NoCache”;“”;“vCountry”;cn;2);

@If(@IsError(rc);“”;rc)

That should do the trick.