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:
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.
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…
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: