Extensions/Custom Dialogs and Macros

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

Extensions/Custom Dialogs and Macros

David Marso
Administrator
2 quick questions:
Say I have a really cool macro with say 10 optional parameters and people love it.
Simplest case:  
INSERT macrofile containing macro called Boom.
Boom . runs the defaults .

Worst case:
Boom param1=x param2=y .... param10=list of stuff .

1. How complicated would it be to build a custom dialog to drive it?
2. How about an extension?  Do I have to wrap python around it to make it work?
I'm ready to dive into the relevant FM's but trying to build code at the moment.
Meanwhile I need to drop some $ numbers to a client re the amount of effort
required to make 1 & 2 happen.
Thanks, David
Please reply to the list and not to my personal email.
Those desiring my consulting or training services please feel free to email me.
---
"Nolite dare sanctum canibus neque mittatis margaritas vestras ante porcos ne forte conculcent eas pedibus suis."
Cum es damnatorum possederunt porcos iens ut salire off sanguinum cliff in abyssum?"
Reply | Threaded
Open this post in threaded view
|

Re: Extensions/Custom Dialogs and Macros

Jon K Peck


Jon Peck (no "h") aka Kim
Senior Software Engineer, IBM
[hidden email]
phone: 720-342-5621




From:        David Marso <[hidden email]>
To:        [hidden email],
Date:        03/22/2013 02:55 PM
Subject:        [SPSSX-L] Extensions/Custom Dialogs and Macros
Sent by:        "SPSSX(r) Discussion" <[hidden email]>




2 quick questions:
Say I have a really cool macro with say 10 optional parameters and people
love it.
Simplest case:
INSERT macrofile containing macro called Boom.
Boom . runs the defaults .

Worst case:
Boom param1=x param2=y .... param10=list of stuff .

1. How complicated would it be to build a custom dialog to drive it?


>>>Custom dialog: piece of cake

2. How about an extension?  Do I have to wrap python around it to make it
work?

>>>Extension commands have to be written in Python, R, or Java, but this can be very simple.  You define the syntax in a simple xml file; use the extension module for the chosen language to interface between the Statistics parser and the Python function that implements this, and wrap the functionality in a little Python code, which can submit the gist of the macro.  It's a good idea to package the pieces as an extension bundle, which takes 3 minutes using the Create Extension Bundle menu in Statistics.  That handles installation and adds it to the catalog of installed extensions.

The first one will take a little longer, but there are 57 extension commands on the SPSS Community site to serve as examples as well as documents there and in the regular help.

I'm ready to dive into the relevant FM's but trying to build code at the
moment.
Meanwhile I need to drop some $ numbers to a client re the amount of effort
required to make 1 & 2 happen.
Thanks, David




-----
Please reply to the list and not to my personal email.
Those desiring my consulting or training services please feel free to email me.
---
"Nolite dare sanctum canibus neque mittatis margaritas vestras ante porcos ne forte conculcent eas pedibus suis."
Cum es damnatorum possederunt porcos iens ut salire off sanguinum cliff in abyssum?"
--
View this message in context:
http://spssx-discussion.1045642.n5.nabble.com/Extensions-Custom-Dialogs-and-Macros-tp5719000.html
Sent from the SPSSX Discussion mailing list archive at Nabble.com.

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD


Reply | Threaded
Open this post in threaded view
|

Re: Extensions/Custom Dialogs and Macros

David Marso
Administrator
Thank You Jon,
That is tremendously helpful.  
David
--
Jon K Peck wrote
Jon Peck (no "h") aka Kim
Senior Software Engineer, IBM
[hidden email]
phone: 720-342-5621




From:   David Marso <[hidden email]>
To:     [hidden email],
Date:   03/22/2013 02:55 PM
Subject:        [SPSSX-L] Extensions/Custom Dialogs and Macros
Sent by:        "SPSSX(r) Discussion" <[hidden email]>



2 quick questions:
Say I have a really cool macro with say 10 optional parameters and people
love it.
Simplest case:
INSERT macrofile containing macro called Boom.
Boom . runs the defaults .

Worst case:
Boom param1=x param2=y .... param10=list of stuff .

1. How complicated would it be to build a custom dialog to drive it?

>>>Custom dialog: piece of cake

2. How about an extension?  Do I have to wrap python around it to make it
work?
>>>Extension commands have to be written in Python, R, or Java, but this
can be very simple.  You define the syntax in a simple xml file; use the
extension module for the chosen language to interface between the
Statistics parser and the Python function that implements this, and wrap
the functionality in a little Python code, which can submit the gist of
the macro.  It's a good idea to package the pieces as an extension bundle,
which takes 3 minutes using the Create Extension Bundle menu in
Statistics.  That handles installation and adds it to the catalog of
installed extensions.

The first one will take a little longer, but there are 57 extension
commands on the SPSS Community site to serve as examples as well as
documents there and in the regular help.

I'm ready to dive into the relevant FM's but trying to build code at the
moment.
Meanwhile I need to drop some $ numbers to a client re the amount of
effort
required to make 1 & 2 happen.
Thanks, David




-----
Please reply to the list and not to my personal email.
Those desiring my consulting or training services please feel free to
email me.
---
"Nolite dare sanctum canibus neque mittatis margaritas vestras ante porcos
ne forte conculcent eas pedibus suis."
Cum es damnatorum possederunt porcos iens ut salire off sanguinum cliff in
abyssum?"
--
View this message in context:
http://spssx-discussion.1045642.n5.nabble.com/Extensions-Custom-Dialogs-and-Macros-tp5719000.html

Sent from the SPSSX Discussion mailing list archive at Nabble.com.

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD
Please reply to the list and not to my personal email.
Those desiring my consulting or training services please feel free to email me.
---
"Nolite dare sanctum canibus neque mittatis margaritas vestras ante porcos ne forte conculcent eas pedibus suis."
Cum es damnatorum possederunt porcos iens ut salire off sanguinum cliff in abyssum?"
Reply | Threaded
Open this post in threaded view
|

Re: Extensions/Custom Dialogs and Macros

Ujjawal
In reply to this post by Jon K Peck
Hi Jon,

Could you please suggest a good manual for Custom Dialog? Can open / save file box be popped up using custom dialog?

Thanks in advance !
Reply | Threaded
Open this post in threaded view
|

Re: Extensions/Custom Dialogs and Macros

David Marso
Administrator
See Ch 19 of Core System Users Guide.
There is a scripting method for Open/Save dialog.  
Don't have time to look it up at the moment.
Ujjawal wrote
Hi Jon,

Could you please suggest a good manual for Custom Dialog? Can open / save file box be popped up using custom dialog?

Thanks in advance !
Please reply to the list and not to my personal email.
Those desiring my consulting or training services please feel free to email me.
---
"Nolite dare sanctum canibus neque mittatis margaritas vestras ante porcos ne forte conculcent eas pedibus suis."
Cum es damnatorum possederunt porcos iens ut salire off sanguinum cliff in abyssum?"
Reply | Threaded
Open this post in threaded view
|

Re: Extensions/Custom Dialogs and Macros

Jon K Peck
In reply to this post by Ujjawal
Best place to start is to open the CDB and go to Help > Tutorial.  Then make a few simple dialogs of your own and try them out.  The code section could be standard SPSS syntax, Python, R, or a mixture.

One of the controls provided in the CDB is a Browse button, so it can generate and validate a file specification.  You could, for example, use that button and insert its value into a GET command to open a sav file.  BUT, one of the most important controls the CDB provides is a source variable list.  That populates with the variables in the current active file (optionally filtered by type), so you can't open a data file, make it active, and display its variables in one step.  Other file types are no problem.

BTW, if your dialog contains a  source list control, its menu item will be automatically disabled if there is no active file - just as regular procedure dialogs are.


Jon Peck (no "h") aka Kim
Senior Software Engineer, IBM
[hidden email]
phone: 720-342-5621




From:        Ujjawal <[hidden email]>
To:        [hidden email],
Date:        03/23/2013 11:26 AM
Subject:        Re: [SPSSX-L] Extensions/Custom Dialogs and Macros
Sent by:        "SPSSX(r) Discussion" <[hidden email]>




Hi Jon,

Could you please suggest a good manual for Custom Dialog? Can open / save
file box be popped up using custom dialog?

Thanks in advance !



--
View this message in context:
http://spssx-discussion.1045642.n5.nabble.com/Extensions-Custom-Dialogs-and-Macros-tp5719000p5719015.html
Sent from the SPSSX Discussion mailing list archive at Nabble.com.

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD


Reply | Threaded
Open this post in threaded view
|

Re: Extensions/Custom Dialogs and Macros

Ujjawal
@ David and Jon : Thanks a ton for the information. That is really helpful :)