# Need help on arrays... for the below question

need help on thisβ¦

Array1 = {1, 2, 3, 0, 5, 6, 0, 0, 0, 9, 7}

Array2 = {8, 0, 0, 4}

{1, 2, 3, 4, 5, 6, 7, 8, 9}

1 Like

You can join the two arrays as a string, simply by β+β operator

To convert array to string:

String.Join(β,β,array1)

Then after you have ont string with all the values from both array. You can replace β,0β with ββ
newStringCreated.Replace(β, 0β,ββ)

if you need the string to be converted back to array, you can use

newStringCreated.Split(β,β)

similar logic you can do via datatable but this is more cleaner approach.

Hope this helps!

Hi

Letβs go with a single expression in a assign activity like this

arr_final = Array.Sort(Array1.Where(Function(a) NOT a.ToString.Contains(β0β)).ToArray().Concat(Array2.where(Function(b) NOT b.ToString.Contains(β0β))))

In separate

Array1.Where(Function(a) NOT a.ToString.Contains(β0β)).ToArray()

This will delete 0 in a array1

Array2.where(Function(b) NOT b.ToString.Contains(β0β)))

This will delete 0 in array2

Concat() - will add these two arrays

Array.Sort() - this will sort the array

To get that as a string and show in message box

String.Join(β-β,arr_final)

Cheers @Sudheer_Kumar1

1 Like

Hi,

Another solution:

``````result = array1.Union(array2).Where(Function(i) i>0).OrderBy(Function(i) i).ToArray()
``````

Regards,

1 Like

@Yoichi thanks for your reply i am unable to show array result in message box it is showing as System.Int32

Hi

Can you try the following?

``````String.Join(",", intArray)
``````

Regards,

1 Like

I have updated in the previous comment which has the complete step to solve this
@Sudheer_Kumar1

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