If you're only interested in getting a single value from Evaluate, you don't need to Dim a Variant to containt the Array Evaluate (almost) always returns.
Simply implode the evaluate, and you can assign the Evaluate directly.
Dim commonUsername As String
commonUsername = Implode( Evaluate( |@Name( [CN] ; @UserName )| ) )
Monday, October 1, 2007
Subscribe to:
Post Comments (Atom)

6 comments:
Brilliant! I love tips like this and I hate dimming variants just to get one value.
Very nice little trick, Tommy! Thanks for sharing!
I can't believe I never thought of that before. This has bugged me for years. I always wanted to do this instead:
Evaluate(|@Name([CN]; @UserName)|)(0)
Now I don't have to declare that useless temporary Variant variable anymore.
Thanks!
Nice one, Tommy!
I'm curious... why Implode instead of it's shorter alias Join?
I guess because of reading co-workers code, and being influenced by the formula-language, which @Implodes.
I think I'll try to change my habit, since, as one commenter on Codestore said, Join is three letters shorter than Implode, and split/join is also what those "operations" are called in JavaScript.
I also think split/join are better descriptions of what is goin on.
Very very cool. Tried it out and started using it for application which is roll out to production.
Post a Comment