XPages: How to save a ComboBox alias as a number?

Hi,

I’m experimenting with XPages and sometimes I’m having a hard time making something that used to be easy in “standard” Notes Development works with XPages.

Here’s what I used to have:

  • One typical form with a Dialog List field (visible only when the document is being edited).

  • This Dialog List uses a @DbColumn to feed its list.

  • The @DbColumn retrieves the first column of a view that is like this “NAME|ALIAS” (ex: Orlando|1)

  • The Dialog List also has an Input Translation with this formula: @TextToNumber(@ThisValue) (to save the field as a Number)

  • I also have a CFD Text field, which its value is set in the WQO agent based on the Dialog List value (the CFG field is visible only when the document is in read mode).

Now, I’m trying to achieve the same in a XPage.

  • I created a basic form with my field as a Number field.

  • I set this form to open document with a XPage instead.

  • I set a ComboBox on my XPage that uses a @DbColumn to feed its list the same way I did before.

  • I binded this ComboBox on the XPage to my Number field on the form, but obviously, one is a string and the other is a number… so it doesn’t work.

Without Input Translation and WebQueryOpen, I’m a bit confused as to how I could achieve the same thing.

My value really needs to be saved as an integer… and I want to display a list of all offices to the user (and not a list of IDs).

Can someone help me on this?

Thanks!

Subject: Re: Combobox value saved as number

If you go to the All Properties tab for your Cstom Control or XPage, against the Data element for the relevant form, you can set properties for computeWithForm, which will run InputTranslation and InputValidation formulas. That may work on its own, or you may need to use your input translation formula to set a different field with the @TextToNumber() value.

Regards

Paul

Subject: Combobox value saved as number

Thanks for your answer.

However, I’ve already tried that… and it doesn’t work. I have no error on the browser or on the server console, but the form is not saved (nothing happens). I have enabled “default error message” for my XPages, but I still see no error.

But, even if this worked, I’m wondering how could I select the right item in the list based on the currently saved alias (to present to the user when he wants to edit that document)?

I’m trying to do something very simple here… and I’ve been working on this for hours.

Thanks again!