How to set an Array to empty/null

Hi all,

I am trying to set an Array to empty/null in the event the parameter it is searching for is not available. Here is the activity.

image
In this activity, if the column “PL” is empty in the excel sheet, I would like it to continue. But in this case since the array “all_relevantPLFile” is empty, it cannot proceed to run, with the error stating object not set to an instance of an object.

Any way I can bypass this?

Regards

1 Like

Hey @SRoyi ,

I assume u want to create an empty array u have to initialize

4 Likes

Ohhh so that’s how its done. Thanks a lot!

hi @SRoyi

take assign activity place it in then or else as per your need

arrayvariable=new string() {}

@SRoyi

all_relevantPLFile = New String() {} ----->’ Assign an empty array

If you need to work with an array even if it’s empty or null, you can assign a default value to the array

Hi @SRoyi ,

While assigning your array, pass the value New String(){} if It’s type of String or pass New List(Of String) if it’s List[string]

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