08-02-2011 02:29 PM
Is there an easy way for Not a Number/path/refnum to return a single Boolean to say if the input had NaN/<Not a Path>/<Not a Refnum> anywhere in its structure.
I have a cluster of clusters of references that I want to validate but I can't find an easy way to convert the structure into something I can get a single Boolean out of. If there was only one cluster I would convert the cluster into an array then Or the array elements to see if there were any invalid references.
I did the Examples above with NaN because they are easier to show than references.
Solved! Go to Solution.
08-02-2011 02:40 PM
If I'm not mistaken, the in-memory representation for the data of a cluster of clusters of booleans should be the same as that of a 1D array of booleans, so I think you should be able to type cast it to a 1D array of booleans, which you can then OR.
08-02-2011 02:50 PM - edited 08-02-2011 02:51 PM
Type Cast man to the rescue:
Edit: Too slow, at least I didn't foul it up.
08-02-2011 02:55 PM
@tst wrote:
If I'm not mistaken, the in-memory representation for the data of a cluster of clusters of booleans should be the same as that of a 1D array of booleans, so I think you should be able to type cast it to a 1D array of booleans, which you can then OR.
Thank you I did not know that about the internal representation of the cluster of cluster of booleans.
An addition to the original question. What happens if i have arrays in some of the clusters is their an easy way convert that?
08-02-2011 03:01 PM
@Darin.K wrote:
Type Cast man to the rescue:
Edit: Too slow, at least I didn't foul it up.
I knew that ... well actually no I didn't.
Ben
08-02-2011 03:04 PM - edited 08-02-2011 03:07 PM
@fdinoff wrote:
An addition to the original question. What happens if i have arrays in some of the clusters is their an easy way convert that?
tst is probably typing the answer as we speak, Type Cast man found his Kryptonite and calls in his buddy "Flatten To String"
08-02-2011 03:19 PM
Turns out the Array Size gets shoved in there by the Flatten To String despite the setting on the function so my previous method fails for arrays inside clusters. I'd wager the workarounds to handle that generic of a case would not be worth the trouble...
08-02-2011 03:21 PM - edited 08-02-2011 03:22 PM
@Darin.K wrote:
@fdinoff wrote:
An addition to the original question. What happens if i have arrays in some of the clusters is their an easy way convert that?
tst is probably typing the answer as we speak, Type Cast man found his Kryptonite and calls in his buddy "Flatten To String"
This does not seem to work. I removed the 9 element Array to cluster because that created invalid references. So before the flatten to string the cluster had a false boolean and an array of one false boolean but the the unflatten from string returned true.
Edit: Darin Got there before me.
08-02-2011 03:45 PM
It looks like if you change use the flatten to string in 4.x and convert in 4.x mode it gives the expected result. Can anyone confirm this?