Dialog list

Hi,

I have two forms, one for customers and another one for countries. Country document has 2 text fields: a country code and a country name.

On customer document, I choose the customer’s countries with a dialog list field ( multiple values allowed, separator is ;). Dialog list is populated with a @dbcolumn formula based on a view that shows country code and country name ( single column with an alias, ex.: United States|USA ).

The advantage of the alias is that I can retrieve country code on form customer.

When I select a country (or more) - in the dialog list - for my customer, I also populate another text field with country codes. This can be useful later.

The problem is when I change country name in a country document, I want to reflect this change on the customer document. I know the country code, the new name for the country and all the customers that share this country.

So, with Lotusscript, I can build a string like this: “New United States|USA” and replace the old one in the dialog list. I apply ReplaceItemValue on dialog list field but the results are strange.

When I display my customer document, the dialog field shows “New United States|USA”, not only “New United States”. So it shows the name and the code of the country, not only the name as it works when I choose country in the list.

What’s the problem ?

Subject: Dialog list

When you store a field value with a synonym (blah|blah) in a normal dialog list, only the synonym is actually stored in the document (check this by looking at document properties in a view and looking at the field values held by the document)Therefore I’d recommend you only store the synonym in your document ‘USA’.

If you need to show the full name as well you can create a computed for display field that does a lookup and translates the synonym to the ‘full’ value.

Subject: RE: Dialog list

Storing country code in the customer document, that’s I wanted to do. But when user types in first letters of the country name, the dialog list shows entire name. That’s an advantage.

Subject: RE: Dialog list

in which case I suggest using a different method.if you want to store both code and country in separate fields in your customer document, then use a button formula containing @picklist to do a view lookup, and bring back a hidden column with the country|code layout.

Then in the button formula you can force a population of the two separate country and code fields using @Left(xxx; “|”) and @Right(xxx; “|”);

e.g. in the button formula:

T := @picklist([custom]; server; db; whatevercheckitoutindesignerhelp; hiddencolumn);

FIELD Country := @Left(T; “|”);

FIELD Code := @Right(T; “|”);

This should also allow multi values in these lists…

Subject: RE: Dialog list

Thx for your suggestion.In the meantime, I tried another approach for this problem.

Remember, my dialog list is populated with a @DbColumn formula based on a view (only one column: “United States|USA”).

My dialog list shows “United States”.

What happens when I modify “United States” in country document ? The view changes of course. Then, if I refresh the view in Onsubmit event of customer form ( with lotusscript ) and after that I open customer document, the country name changed in my dialog list field. Miracle !!!

The solution was so simple that I didn’t see it.

Thx for your advice.

Subject: RE: Dialog list

be wary of refreshing a view in onsubmit.

This means that the view index is refreshed every time a document is submitted to the system, and will maybe take a long time to save documents in future when the views get bigger.

I’d recommend using “NoCache” option in the lookup instead. That will mean that the lookup will access the view when it is needed, and you won’t be wasting time on refreshing views when you don’t need to.