|
Not sure a daemon with a sleep routine will solve the problem - which seems
to be that the macro is executing when the page that is the UI for whatever
the macro does is being generated.
Elvind, if you want to have the macro executed in response to an onClick
event you need to cause the onClick event to make a round-trip to the server
to create a new page. That means running another Stored Process. Richard
DeVenezia suggested one way to do this which I have converted from
pseudo-code for the Application Server to pseudo-code for the Stored Process
Server (aka STP):
onClick="location.href=/SASStoredProcess/do?_program=[name in the SMC for a
stored process that calls you macro]
And with respect to my book, not sure when/if it will be on Amazon, but it
will be available from the SAS Press site at:
http://support.sas.com/publishing/bbu/companion_site/60282.html
once we get closer to February of 2007 (expected/hoped-for publication
date). The book is primarily about the SAS/IntrNet Application Dispatcher,
but many of the techniques and examples also work with the Stored Process
Server.
HTH,
-don Henderson
> -----Original Message-----
> From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of Gary
> McQuown
> Sent: Tuesday, December 19, 2006 9:11 AM
> To: SAS-L@LISTSERV.UGA.EDU
> Subject: Re: Calling SAS Macro from HTML onClick() event
>
> Eivind,
> You can create a simple daemon by adding a sleep routine followed by an
> examination of the parm. If the parm has a value, it processes normally.
> If the parm is empty it goes back to sleep to try again when it wakes. In
> your case a 3-5 second routine should be fine. Also set the max number of
> sleep cycles so the process eventually terminates without user input.
>
> hth;
> Gary
>
> Gary McQuown
> Data and Analytic Solutions, Inc.
> www.DASconsultants.com
> 703.628.5681
>
> This e-mail, including any attached files, may contain confidential and
> privileged information for the sole use of the intended recipient. Any
> review, use, distribution, or disclosure by others is strictly prohibited.
> If you are not the intended recipient (or authorized to receive
> information for the intended recipient), please contact the sender by
> reply e-mail and delete all copies of this message.
>
>
>
> > -------- Original Message --------
> > Subject: Re: Calling SAS Macro from HTML onClick() event
> > From: Eivind Heioghaa <x47x@CODANMARINE.NO>
> > Date: Tue, December 19, 2006 1:16 am
> > To: SAS-L@LISTSERV.UGA.EDU
> >
> > Thanks for good feedback!
> >
> > You're right Don, I'm using the Stored Process Server. I have a Stored
> > Process holding not only the job to be run, but also the code for
> > generating a web GUI. This works just fine, and I'm building a GUI with
> > chained/dependent drop down menus and various other inputs. Each section
> of
> > the GUI is wrapped up in a macro, so that I can better control when and
> in
> > which cases to display the specific parts of the GUI.
> >
> > Similarly the job that is taking this input as parameters, is also
> wrapped
> > up in a macro. This job also runs without errors. The only problem is
> that
> > I can't make it wait until the user is done performing the input, so
> it's
> > only running for the default values provided in the GUI. As soon as my
> > Stored Process sees the macro call that I've placed in the HTML for a
> > button, it goes ahead and performs the work. Hence the user doesn't get
> to
> > provide any inputs before my overly eager job is executing.
> >
> > As you pointed out, the macro is run as the HTML is generated. It seems
> > like SAS finds the macro call which I've put inside the onClick event,
> and
> > executes it as soon as it's working on that section of the SAS code
> > (without waiting for an actual onClick event to occcur).
> >
> > It seems like all the pieces of the puzzle are working together as
> > intended, but I just can't seem to find a way for the user to tell the
> > Stored Process when to execute.
> >
> > Any pointers on how to let the users kick of the macro in the Stored
> > Process would me much appreciated!
> >
> > Looking at the title of your upcoming book, I'll be heading to amazon to
> > preorder it :-)
> >
> > Cheers,
> > Eivind
|