How to replace null with some value ? i have tried with multiple logics, can anyone help me please?

{“xxxxxxxx”,
“Y”,
“Y”,
“”,
“Y”,
“”,
“”,
“Y”,
“”,
“”,
“Y”,
“”,
“Y”,
“Y”
}

Can you please elaborate on this

Hi @Veera_Raj

I think this link should help you.

use try catch,

in exception handler, if the value is null, use assign activity to replace null with anything.

image

image

arr.Where(Function(x) Not String.IsNullOrWhiteSpace(x)).ToArray

how i replace null with “N” in this logic ?. can you help me out please?

i want yo replace null value in array with “N”, not in exception

i have array like {“xxxxx”,“”,“y”,“”,“y”}.want to replace Null with “N”
expected output is {“xxxxx”,“n”,“y”,“n”,“y”}

Hi @Veera_Raj

Try with this Expression

Dt.AsEnumerable().Select(Function(row) row(“Column Name”).ToString.Replace(“”,“N”)).ToArray

Regards
Gokul

this is array only i dont have column name

or else i need query for replace all cell in datatable

Hi @Veera_Raj

Have a look on the query

Replace Nulls With Specified Values in SQL Server.

Regards
Gokul

You can replace it like this
Index is an output variable of For each loop activity

Hope this helps,

Regards,
Saloni

this is for only specified column , can we make into dynamic ? means all column and row

Hi @Veera_Raj

For an array you can try as below

arr_usernames.Select(Function(x) x.Replace(" ", “N”)).ToArray()

how to pass the array index?

this logic not giving result

You can pass it in properties of for each loop activity as output index of for each loop.

Regards,
Saloni

Please mark it as solution if its works out for you.

Thanks,

Regards,
Saloni

Hi @Veera_Raj

Use the expression below!

Assign LHS =arrayVar

RHS= arrayList.Select(Function (e) If(isNothing(e) OrElse String.IsNullOrEmpty(e.toString), “yourReplace Value”, e)).toArray

Refer to the screenshots below!

Regards

1 Like

It’s working thank you