how to return and ID from a showSelectDialog

Let say the list on the dialog is: (what the user sees)

company1
company2
company3

I want to recive as a parameter not the string companyX but the id for the companyX.

Is it possible ?

Probably what you need is a valuelist like this one:

Company1|1
Company2|2
Company3|3

Then if you use a combobox with this valuelist… Company1/company2/company3 will be displayed and 1 / 2 / 3 will be stored in the field.

Remember to set the field as NOT editable… if you leave it to editable the “companyX” or whatever you type in the field will be stored

hope this was what you were looking for

bye

I have the same issue here.

Enrico, I know how it works with a combobox on a form,

but with the plugins.showSelectDialog, I can’t get it to work.

Is it even possible with the showSelectDialog to give an array, with displayvalues and returnvalues??

As far as I know that is not possible. The dialog will return the String the user selected. You will then have to loop and find the ID yourself. Of course, you could consider using our DialogPro plugin which allows you to do that sort of thing.

oke, Patrick, thanks for the clarification.

I have to create my own dialog than…

Just coming across the same pb…
To me this is a kind of bug as it displays values to be returned instead of values to be displayed.
The temp workaound I am using is to set both id and name to be returned in the list, with a separator character set, then strip the answer of the showSelectDialog to recuperate only the id.

I would love for this to be fixed too!

It says in the example:

plugins.dialogs.showSelectDialog( dialog_title,  msg,  optionArray/option1,  [option2],  [optionN])

But when I treat it to some array values…

ds.getColumnAsArray(1), ds.getColumnAsArray(3)

or

aResult[0], aResult[2]

… I get java errors in return. However, one array value works.

ds.getColumnAsArray(1)

or

aResult[0]