Geoffrey Absalom
Geoffrey Absalom

Reputation: 1895

Remove null from vector

I would like to remove nulls from a vector

      a:(2013.05.20 2013.05.21 2013.05.22 0N 0N 2013.05.23)

I can see how this can be done by creating a table using

      temp:([] a);
      result:exec a from temp where not null a;

but I am curious if there is a quicker way that doesn't involve creating a table.

Thanks

Upvotes: 1

Views: 4031

Answers (2)

nyi
nyi

Reputation: 3229

Another way to get the non-null elements using except :

q)a:(2013.05.20 2013.05.21 2013.05.22 0N 0N 2013.05.23)
q)a except 0N
2013.05.20 2013.05.21 2013.05.22 2013.05.23

Upvotes: 0

mnestor
mnestor

Reputation: 319

Returns the non-null elements

result:a where not null a

Upvotes: 5

Related Questions