PDA

View Full Version : Comparing two macros


jblocksom
08-05-2005, 02:17 PM
I have two macros, call them A and B, with strings in them and I want a group to run only if they are not equal. I can't figure out how to get that right. In the conditional build rule, I have the macro/expression field set to
%A% <> %B%
and the condition set to is true. This skips it every time. If I enclose the expression in square brackets, it gives a macro error. What is the trick to this?

jblocksom
08-05-2005, 02:24 PM
OK, I've narrowed down the problem a bit more. When I do
["%A%" = "%B%"]
as the expression, it works, but only if A and B do not have multiple lines. The real data I need to compare has multiple lines. Anybody have a way to compare multi line strings or strip the newlines before the compare?

kevina
08-05-2005, 03:15 PM
Quoting a macro like this: "%MACRONAME%" when the macro contains multiple lines is the equivalent of "some value
" which is not valid vbscript.

You need to do something like this instead: [vbld_AllMacros()("A").Value = vbld_AllMacros()("B").Value] which uses vbld_AllMacros() to evaluate the macro and provide access to the entire value as a string.