Caption )User Command?

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

Caption )User Command?

jason
I realize there is no )User syntax to display a username in a table caption of who ran the report.  Does anyone know a way to automatically have an output display username?  I don't really care if it is a Windows username or something each user would have to set within the program.

**I would like for the output to say: "Report generated on 9/1/2010 by Peter Pan." to help differentiate where each output's origin is.

If it isn't possible, I think it would be a good addition to the software.

Thanks.

I'm referring to this from the help file:

The following symbols can be used within any caption, corner text, or title line. Each symbol must be specified by using an opening right parenthesis and all uppercase letters.

)DATE (keyword),)DATE (keyword),)DATE (keyword)
CTABLES command,CTABLES command,CTABLES command
CTABLES (command),CTABLES (command),CTABLES (command)
dates in titles,dates in titles,dates in titles
)TIME (keyword),)TIME (keyword),)TIME (keyword)
CTABLES command,CTABLES command,CTABLES command
)TABLE (keyword),)TABLE (keyword),)TABLE (keyword)
CTABLES command,CTABLES command,CTABLES command
CTABLES (command),CTABLES (command),CTABLES (command)
table description in titles,table description in titles,table description in titles
)DATE Current date. Displays a locale-appropriate date stamp that includes the year, month, and day.
)TIME Current time. Displays a locale-appropriate time stamp.  
)TABLE Table description. Inserts a description of the table, which consists of the table expression stripped of measurement levels, statistics specifications, and /TABLE. If variable labels are available, they are used instead of variable names in the table expression.  

Example
CTABLES /VLABELS VARIABLES=SEX HAPMAR DISPLAY=NONE
  /TABLE SEX > HAPMAR BY CHILDCAT [COLPCT]
  /SLABELS VISIBLE=NO
  /TITLE TITLE = 'Marital Happiness for Men and Women '+
              'by Number of Children'
         CAPTION= 'Report created at )TIME on )DATE' ')TABLE'.

Reply | Threaded
Open this post in threaded view
|

Re: Caption )User Command?

Jon K Peck

There is an extension command called TEXT, downloadable from SPSS Developer Central, that can create a separate text block in the Viewer.  For example,

TEXT "hello, world".

If you want to pick up the user login name and date automatically, the following would do it:

begin program.
import spss, TEXT, time, getpass
TEXT.createText(["User: " + getpass.getuser() + " Time:" + time.asctime()])
end program.

All this requires the Python plugin.

HTH,
Jon Peck
SPSS, an IBM Company
[hidden email]
312-651-3435



From: jason <[hidden email]>
To: [hidden email]
Date: 09/01/2010 02:55 PM
Subject: [SPSSX-L] Caption )User Command?
Sent by: "SPSSX(r) Discussion" <[hidden email]>





I realize there is no )User syntax to display a username in a table caption
of who ran the report.  Does anyone know a way to automatically have an
output display username?  I don't really care if it is a Windows username or
something each user would have to set within the program.

**I would like for the output to say: "Report generated on 9/1/2010 by Peter
Pan." to help differentiate where each output's origin is.

If it isn't possible, I think it would be a good addition to the software.

Thanks.

I'm referring to this from the help file:

The following symbols can be used within any caption, corner text, or title
line. Each symbol must be specified by using an opening right parenthesis
and all uppercase letters.

)DATE (keyword),)DATE (keyword),)DATE (keyword)
CTABLES command,CTABLES command,CTABLES command
CTABLES (command),CTABLES (command),CTABLES (command)
dates in titles,dates in titles,dates in titles
)TIME (keyword),)TIME (keyword),)TIME (keyword)
CTABLES command,CTABLES command,CTABLES command
)TABLE (keyword),)TABLE (keyword),)TABLE (keyword)
CTABLES command,CTABLES command,CTABLES command
CTABLES (command),CTABLES (command),CTABLES (command)
table description in titles,table description in titles,table description in
titles
)DATE Current date. Displays a locale-appropriate date stamp that includes
the year, month, and day.
)TIME Current time. Displays a locale-appropriate time stamp.
)TABLE Table description. Inserts a description of the table, which consists
of the table expression stripped of measurement levels, statistics
specifications, and /TABLE. If variable labels are available, they are used
instead of variable names in the table expression.

Example
CTABLES /VLABELS VARIABLES=SEX HAPMAR DISPLAY=NONE
 /TABLE SEX > HAPMAR BY CHILDCAT [COLPCT]
 /SLABELS VISIBLE=NO
 /TITLE TITLE = 'Marital Happiness for Men and Women '+
             'by Number of Children'
        CAPTION= 'Report created at )TIME on )DATE' ')TABLE'.


--
View this message in context:
http://spssx-discussion.1045642.n5.nabble.com/Caption-User-Command-tp2799869p2799869.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: Caption )User Command?

Jon K Peck

Parameters for the user name and the current date and time seem useful to have built in to the TEXT command, so I added support for these.  Get the latest version from Developer Central to use this.

The text )USER and )CURDATE in the text in the command will be replaced by the appropriate values.

For example,
TEXT "The current date is: )CURDATE, and the current user is )USER".

Note that this command also has a dialog box interface.

And since this command supports html, you could write this:
TEXT "<html>The current date is <b>)CURDATE</b></html>".
to display the date in bold text.

Regards,

Jon Peck
SPSS, an IBM Company
[hidden email]
312-651-3435



From: Jon K Peck/Chicago/IBM@IBMUS
To: [hidden email]
Date: 09/01/2010 03:23 PM
Subject: Re: [SPSSX-L] Caption )User Command?
Sent by: "SPSSX(r) Discussion" <[hidden email]>






There is an extension command called TEXT, downloadable from SPSS Developer Central, that can create a separate text block in the Viewer.  For example,


TEXT "hello, world".


If you want to pick up the user login name and date automatically, the following would do it:


begin program.

import spss, TEXT, time, getpass

TEXT.createText(["User: " + getpass.getuser() + " Time:" + time.asctime()])

end program.


All this requires the Python plugin.


HTH,

Jon Peck
SPSS, an IBM Company
[hidden email]
312-651-3435


From: jason <[hidden email]>
To: [hidden email]
Date: 09/01/2010 02:55 PM
Subject: [SPSSX-L] Caption )User Command?
Sent by: "SPSSX(r) Discussion" <[hidden email]>






I realize there is no )User syntax to display a username in a table caption
of who ran the report.  Does anyone know a way to automatically have an
output display username?  I don't really care if it is a Windows username or
something each user would have to set within the program.

**I would like for the output to say: "Report generated on 9/1/2010 by Peter
Pan." to help differentiate where each output's origin is.

If it isn't possible, I think it would be a good addition to the software.

Thanks.

I'm referring to this from the help file:

The following symbols can be used within any caption, corner text, or title
line. Each symbol must be specified by using an opening right parenthesis
and all uppercase letters.

)DATE (keyword),)DATE (keyword),)DATE (keyword)
CTABLES command,CTABLES command,CTABLES command
CTABLES (command),CTABLES (command),CTABLES (command)
dates in titles,dates in titles,dates in titles
)TIME (keyword),)TIME (keyword),)TIME (keyword)
CTABLES command,CTABLES command,CTABLES command
)TABLE (keyword),)TABLE (keyword),)TABLE (keyword)
CTABLES command,CTABLES command,CTABLES command
CTABLES (command),CTABLES (command),CTABLES (command)
table description in titles,table description in titles,table description in
titles
)DATE Current date. Displays a locale-appropriate date stamp that includes
the year, month, and day.
)TIME Current time. Displays a locale-appropriate time stamp.
)TABLE Table description. Inserts a description of the table, which consists
of the table expression stripped of measurement levels, statistics
specifications, and /TABLE. If variable labels are available, they are used
instead of variable names in the table expression.

Example
CTABLES /VLABELS VARIABLES=SEX HAPMAR DISPLAY=NONE
/TABLE SEX > HAPMAR BY CHILDCAT [COLPCT]
/SLABELS VISIBLE=NO
/TITLE TITLE = 'Marital Happiness for Men and Women '+
            'by Number of Children'
       CAPTION= 'Report created at )TIME on )DATE' ')TABLE'.


--
View this message in context:
http://spssx-discussion.1045642.n5.nabble.com/Caption-User-Command-tp2799869p2799869.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