FilterbyMask .........and combine the list again

Hi All,

I have two doubts, Apologies if this sound very basic one.

  1. Why in the list i am getting bellow error and how to resolve it ?
  2. In the above list i am trying to filter out the number between a certain range and perform some function on it. But problem is i need to put it in the same list of sequence as it was before filtering after performing division. The location of those filter points in the list are important as it represent a certain alignment station.

Thanks alot for all the help and support.

it’s working for me

Hi @shahid.shaikh_C3D

I think the problem is in the very first node. There is a “Null” value in their.

I would recommend to clean this list before you do everything else.

You can do this with “List.Clean” and put “Preserve indices” on False

1 Like

Thanks for the reply @Joelmick …instead of cleaning list can i replace null with a Zero value so that sequence wont change ? is there a way to replace null by zero ?

Can you please suggest a way to combine it also as per part 2 of above question ?

1 Like

That’s an option or you can change the nulls in the && list to be false. Either way you just need to have a final list of only booleans for your mask.

Yes, you can also replace the nulls if you have to maintain the same number of items. The easiest way to do this is shown below, with the script attached. What Nick suggest is also possible but I wouldn’t recommend that, because it would still give an Warning at the Math.Round Node and you want you script to not give warnings cause it may confuse users.

Replace Nulls.dyn (33.2 KB)

I now see that you asked 2 questions and we all ignored the second one.

You want to apply a certain function on a value based on the fact that they lay between 2 numbers. I would recommend not to filter the number by BooleanMask but use an If Node.

The trick here is to filter the list of Nulls as shown before. Then apply the function you want to apply ON ALL THE ITEMS on the values if they are True. and parallel to this you check if the Value lays between 2 numbers. At the end Use an If node to either take the Modified value or the normal value.

This way you don’t have to split the list, apply the function and combine it again. I hope this makes sense. Picture shows this and I attached an updated version on the script :smiley:

ReplaceNulls+FunctionByCondition.dyn (34.7 KB)

1 Like

@Joelmick Thanks alot …it worked just fine. Didnt thought we could use If function like this also.

1 Like

@Nick_Boyts Thanks for reply