Hi guys,
The IfElse() operator takes three arguments, the first of which is an
expression. If this expression evaluates to something other than "" or
0, then the operator returns the result of the second argument;
otherwise, it returns the result of the third one.
Bruce, it appears that the second argument of this operator is
evaluated whether or not it is needed (that is, regardless of what the
first argument evaluates to). In some cases, this can lead to a
PowerPro error being displayed, although the function returns the
expected value.
Please consider the following line of script (all one line:)
Local A = IfElse(ValidPath(?"C:\Value.txt"), File.ReadAll(?"C:\Value.txt"), "New
Value")
If a file exists at C:\Value.txt, then A should contain the contents
of this file, and just "New Value" if not.
If this file doesn't exist, then A does indeed result with "New Value"
as its content, but first a PowerPro error is displayed claiming that
it could not read from C:\Value.txt.
To cut a long story short�� should this be regarded as quirky
behaviour or should I just rewrite my code as such:
Local A = "New Value"
If(ValidPath(?"C:\Value.txt"))
A = File.ReadAll(?"C:\Value.txt")
--
Alex Peters / Melbourne, Australia
PowerPro v3.8.18 / Windows XP
------------------------ Yahoo! Groups Sponsor --------------------~-->
Yahoo! Domains - Claim yours for only $14.70
http://us.click.yahoo.com/Z1wmxD/DREIAA/yQLSAA/JV_rlB/TM
--------------------------------------------------------------------~->
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/power-pro/
<*> To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/