Array of {T}

I’m trying to store 12 quantities into a new variable that I named “Quantities” and fill it up into a web form, however, the system says that I can’t store 12 strings into an array of {t}. May I know how to solve this?

HI @Janelle_Tan

Try like this

New String(){"Qut1","Qut2","Qut3"}

Regards
Gokul

1 Like

Change Datatype into Array of String

Hi @Janelle_Tan ,

The Complete requirement is not explained, However, we assume that you would want to store the Qty9, Qty10, Qty11,… variable values into an Array/Collection type. For this, you would need to change the Datatype of Quantities variable to Array Of String.

Next, for Initialising the Quantities array variable with the individual variable values, you would need to use an Assign Activity and initialise the Quantities variable.
Something in the below manner :

Quantities = {Qty1,Qty2,Qty3,Qty4}

We cannot use/assign variables to other variables in the Default value of variables Panel.

hi, I have tried what you said but still unable to resolve it :confused:

as told above:

ArrString = String Array Default Value: new String(){Qty1,Qty2,Qty3,Qty4}

So you stored many strings within an array

For the type Into you will need a string
Depending on how the different items from the array are to separate we do need a flat string done with String.Join
String.Join(", " ArrString) ← here each item from the array will be separated by comma space

HI @Janelle_Tan

  1. In the type into you need to give the index/ Range of the array
ArrString(0)

Output  -> Apple

If you need to all the value in the Array String.Join("," ArrString)

  1. If you need to concatenate all the values try like this
Qty1.Tostring+Qty2.Tostring+Qty3.Tostring+Qty4.Tostring+Qty5.Tostring

Regards
Gokul

@Janelle_Tan ,

As mentioned already we do not know what is the end goal required. Are you trying to Add/Sum all the Quantities together and then type the value into the Field ? Or Are you trying to add each quantity one by one in different fields ? Or Do we need to concatenate the Qty values and type the concatenated value in the field ?

Do provide the requirement as to what should be the expected output in order to avoid open questions and for us to help you better.

i’m trying to paste each of the quantity in different fields of the form

Hi, yes I am trying to add each quantity one by one in different field on the web form.

HI @Janelle_Tan

In this case you need to create Type into activity for all the field that you need to enter

If you Assign it as Array of String like this New String(){"Qty1","Qty3","Qty3"}

Like this below you need to add all the value in the Type into activity

Qty1(0)
Qty2(1)
Qty3(2)

Regards
Gokul

Hi @Janelle_Tan

Type into accepts only string variables as input.

If you want to type into different fields then use each element of array separately using arrString(0) , arrstring(1) etc in multiple type into activities with each field that you want the data to be types into.

If those fields are similar fields or those look alike then use for each ui element and inside pass the current element to typeinto and use index variable to loop the array like this arrstring(index)

Cheers

hi i dont understand this part

Hi @Janelle_Tan

Open the properties of for loop you will find index there…that index is the loop count …so for first loop value will be zero, second loop value will increment to 2 and so on…so if you use arrstring(index) …then string gets changed for every loop

Cheers