Nothing as Value in a Data Table

Hello,

I’m building a workflow where it is an important difference in my data table if the value of a string is the empty string (“”) or Nothing (Null). First I use the Build Data Table activity where I explicitly checked Allow Null for some string column. Then I use several Add Data Row activities to add my data rows giving the input by using ArrayRow. For example, I would put in something like {“Hello world”, 777, Nothing} as array row if I want the third value (string value) of a 3-value-row to be Nothing. Later in my workflow I want to check with an If activity, if the third value of a certain row is Nothing. I use the condition CurrentRow(2) is Nothing. But even for rows where I put in the Nothing value the condition is evaluated to False. On the other hand, if I check on the empty string with CurrentRow(2).Equals(“”) I also get a False, so it is neither Nothing nor the empty string.

How do I manage to get Nothing into some cell of my data table and be able to check on Nothing with the is Nothing expression?

Best regards
Remo

@Remoo0o

Can you try passing as below for null values

{“Hello world”, 777, “”}

Hope this may help you

Thanks

Hey! Welcome to community!

Try like this

Use Filter DataTable

Mention the column
and the operation “=”
Value “Nothing”

Try this and let me know

Regards,
NaNi

mabye following condition will help

isNothing(row(2)) OrElse String.IsNullorEmpty(row(2).toString().Trim())

Tried but does not work. By entering “” we just enter an empty string that is not Nothing. Thank you anyways :slight_smile:

Best regards
Remo

isNothing(row(2)) does not work unfortunately. String.IsNullorEmpty(row(2).toString().Trim()) throws out True, but it is also evaluated to True if row(2) is the empty string. Furthermore, row(2).toString().Trim() is in fact evaluated to the empty string, if row(2) is Nothing.

Still thank you for your effort!!

Best regards
Remo

Just to clear the statement:

isNothing(row(2)) OrElse String.IsNullorEmpty(row(2).toString().Trim())

when row(2) is nothing Or row(2) is not nothing and after trimming is an empty string

then it will return TRUE

Kindly note the updated OrElse without space

just have a look also here:

we prepared a datatable:
grafik
And add 2 additional rows:
grafik
grafik
grafik

for test case 4 we do see it is not nothin
it will not break, when using is toString() - a null value would do
it let evaluate String.IsNullOrEmpty to true

grafik

Hey Peter,

you have just delivered me the solution in your last picture. IsDBNull(…) is the method that I was looking for. With that method I can test a string, getting True if it is Nothing and False if it is anything else. The Is Nothing method seems not to be working on values from data tables.

Best regards
Remo

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