How to get the selected array index in input dialog

Hi definitely a rookie here.
I have an array Prn{“Printer 1”,“Printer 2”, “Printer 3”} and I used it in an input dialog. Now when I select Printer 2, how do I store the selected index? Printer 2 is index 1.
thanks in advance

Like below,

intIndexValue = Array.IndexOf(Prn, "Printer 2")

If not found, returns -1.

Regards,
Karthik Byggari

1 Like

Hi @Japs,
You can use for example Assign activity to store selected index item.
image

Thank you @KarthikByggari and @Pablito for your quick reply. I think I did not make myself clear, so please bear with me.

I want to get the row of the selected array element.

varChosenPrinter = Prn(index of selected printer).

No hardcoding, as I will use the selected array row/element later in the workflow

The following statement returns the selected printer index

strSelectedPrinter = InputDialog Output
intSelectedPrinterIndex = Array.IndexOf(Prn, strSelectedPrinter)

If Printer 2 is selected,

intSelectedPrinterIndex contains value “1”.

1 Like

Thank you @KarthikByggari. I think this should do the trick. I will try it out!

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.