s-news
[Top] [All Lists]

Child Script Problem - Solved

To: "s-news@lists.biostat.wustl.edu" <s-news@lists.biostat.wustl.edu>
Subject: Child Script Problem - Solved
From: Bill Osburn <bosburn@sjrwmd.com>
Date: Tue, 6 Jan 2009 07:29:40 -0500
Accept-language: en-US
Acceptlanguage: en-US
Thread-index: Aclv+nJBSNwKrg2jQnux1ST2xU2mHg==
Thread-topic: Child Script Problem - Solved

My problem with the Child Script has been resolved. Thanks all who send me suggestions. The solution was very interesting.

 

1)      The script was originally written by a consultant to be run in a script window and later adapted by me to run as a child.

2)      The child script was not being parsed correctly in an if else statement.

3)      The original script did not put the {} in the if else. I had noticed this and put them in but it made no difference. I am a novice so I must have placed the {} incorrectly

4)      After carefully following Bill Dunlap’s previous explanation about the {} in an if else statement the problem was solved.

5)      Be explicit (unambiguous) in your scripting – below is why it worked in the script window and not as a child.

 

THE ANSWER from Bill.

By running 'stand-alone' you must mean in a script window, for in a commands window

in the Windows GUI for S+ I get:

   > if(TRUE)
   +    cat("yes\n")
   yes
   > else
   +    cat("no\n")
   Problem: Syntax error: illegal name ("cat") after "else" on input line 2

 

Executing a script in the script window wraps a set of braces around the

whole script, which causes the same wait-until-I-read-everything-before-deciding-

I'm-at-the-end-of-an-_expression_ behavior.

 

In the commands Window the current behavior is essential if we are to allow an

else-less if statement and source() behaves as the commands window does.

(I think it was a mistake to have the script window add the braces.)

Bill Dunlap
TIBCO Software Inc - Spotfire Division
wdunlap tibco.com

 

<Prev in Thread] Current Thread [Next in Thread>
  • Child Script Problem - Solved, Bill Osburn <=