I am trying to use the following if/then/else statement and it is failing. Any insight would be appreciated:
Thanks,
-Mac
if ((exists true whose (if true then (exists (computer name) whose (it as string as lowercase contains “bos” as lowercase)) else false)) AND (exists true whose (if true then (exists (computer name) whose (it as string as lowercase contains “dr” as lowercase)) else false)))
In ActionScript you need to enclose the relevance substitution in curly brackets. Try
if {((exists true whose (if true then (exists (computer name) whose (it as string as lowercase contains “bos” as lowercase)) else false)) AND (exists true whose (if true then (exists (computer name) whose (it as string as lowercase contains “dr” as lowercase)) else false)))}
Invalid action content: the action script contains a syntax error.
This action has been applied 1 time and will not be applied again.
If I take out the IF,THEN,ELSE, the script works. I test the script in the fixlet debugger, it fails if I have the { in , but passed if I don’t. I have tried both ways in my actual action script and they both fail.
The script is below, I just took out the servername. If we get this right, I would like have a second computer name conditional of “dr”… so, the server name contains “bos” or “dr”.
Thanks for any help.
-Mac
if {((exists true whose (if true then (exists (computer name) whose (it as string as lowercase contains “bos” as lowercase))}
Is this the entire script? If so, we’ll also need an endif at least:
if {((exists true whose (if true then (exists (computer name) whose (it as string as lowercase contains "bos" as lowercase))}
prefetch e1f87e437da42bbd1f873a38adad3a9df4635d28 sha1:e1f87e437da42bbd1f873a38adad3a9df4635d28 size:4772505 http://servername:52311/Uploads/e1f87e437da42bbd1f873a38adad3a9df4635d28/Bos-RubrikBackupService.tmp sha256:3a086307b70d07c9efd6fccb9bc28da4be3bc5c36f1e4c03857fdc1f1a6a7683
extract e1f87e437da42bbd1f873a38adad3a9df4635d28
wait "{pathname of system folder & "\msiexec.exe"}" /i "{(pathname of client folder of current site) & "__Download\RubrikBackupService.msi"}" /qn
endif
I didn’t check it earlier (though I should have), but it appears that the syntax error may be within the relevance defined for the if statement. Let’s try a simplified version:
if {(computer name) as lowercase contains "bos" as lowercase}
prefetch e1f87e437da42bbd1f873a38adad3a9df4635d28 sha1:e1f87e437da42bbd1f873a38adad3a9df4635d28 size:4772505 http://servername:52311/Uploads/e1f87e437da42bbd1f873a38adad3a9df4635d28/Bos-RubrikBackupService.tmp sha256:3a086307b70d07c9efd6fccb9bc28da4be3bc5c36f1e4c03857fdc1f1a6a7683
extract e1f87e437da42bbd1f873a38adad3a9df4635d28
wait "{pathname of system folder & "\msiexec.exe"}" /i "{(pathname of client folder of current site) & "__Download\RubrikBackupService.msi"}" /qn
endif
Yes, I believe there is an error in the relevance condition. An ‘if’ statement requires both a ‘then’ and ‘else’ clause. This one has no ‘else’. I believe the form you will need is
if {exists true whose(if true then (conditions) else false)}
Yes, for the flow control within actionscript, that’s correct. However, I believe Jason was referring to the conditional within the relevance statement being used in the relevance substitution
The previous logic was the following:
if {((exists true whose (if true then (exists (computer name) whose (it as string as lowercase contains "bos" as lowercase))}
When we look at the relevance within the curly braces (the substitution), there are at least two issues:
There are unmatched parens
The if statement contains a then but not an else
In such cases, to troubleshoot, it’s useful to evaluate the portion within the curly braces within Fixlet Debugger (particularly the single clause tab, and depending on your preference, with indentation formatting via CTRL-D) to showcase these: