Page 1 of 1

add global procedural section

Posted: January 19th, 2012, 11:48 pm
by Guest
Hi all,

My request for Cspro is, to add global procedural section, so it will have :

global_preproc_first
global_preproc_end

global_postproc_first
global_postproc_end

global_killfocus_first
global_killfocus_end

global_onfocus_first
global_onfocus_end

All script on global procedural section will be applied into all variables and section in the application, *_first will be executed before current procedural section, and *_end will be executed after current procedural section, for example:

global_preproc_first
script1-------

global_preproc_end
script2-------


PROC MYVAR
preproc
<-----------------script1 will be executed here
current-script
<-----------------script2 will be executed here
postproc


Thanks to develepor for developing CSpro.

:)
Best,

-iip-

Re: add global procedural section

Posted: January 20th, 2012, 8:26 am
by Gregory Martin
This is an intriguing idea that I have not thought of before. What are some kinds of scripts that you would put in a preproc/postproc?

If implemented, perhaps these scripts could be implemented similar to the OnKey and OnStop functions, which are default functions that can be overridden.

Re: add global procedural section

Posted: January 20th, 2012, 9:32 am
by iip
Hi Greg,

The scripts can be anything that treat our variable generally, right now I'm working with CSpro for CAPI method, using this global procedural I want to change the interface, so we can customize the whole screen using external application, so maybe we can also use it for CASI (self interview) because the screen are looks now better to users.

Re: add global procedural section

Posted: February 7th, 2012, 1:36 pm
by Gregory Martin
One thing you might be interested in is an undocumented function in CSPro that you can override like OnKey and OnStop. On_Focus gets called after the OnFocus of each field on your form, so you can put some global stuff there. This means that the order of execution of a field is:
Field PreProc
Field OnFocus
Global Function On_Focus()
...
Field KillFocus
Field PostProc

Re: add global procedural section

Posted: March 19th, 2012, 5:45 am
by Guest
ahh..thanks Greg, that is usefull information for me, I will try it soon, I think it will be usefull for my CAPI.

-iip-
Gregory Martin wrote:One thing you might be interested in is an undocumented function in CSPro that you can override like OnKey and OnStop. On_Focus gets called after the OnFocus of each field on your form, so you can put some global stuff there. This means that the order of execution of a field is:
Field PreProc
Field OnFocus
Global Function On_Focus()
...
Field KillFocus
Field PostProc

Re: add global procedural section

Posted: June 16th, 2012, 8:07 pm
by noel
Thank you for this forum, it's very helpfull.

I have used Global Function On_focus() in a CAPI application with CSPro 5 (the last Beta version). this is my syntax:

PROC GLOBAL
set explicit
alpha(256) qlabel;
function on_focus();
qlabel = getlabel();
end;

For the the first field I had the correct label. For the others, I had the label of the previous field.
Where is the problem?

Is it possible to have documentation about Crosstab, I want to learn more about producing tables with CSBatch ?

Re: add global procedural section

Posted: July 12th, 2012, 7:08 pm
by Gregory Martin
I created a test application and on my testing, both getlabel and getsymbol return the correct values. Can you send me an application where they don't: gregory.martin@census.gov

The Census Bureau doesn't promote using batch mode to create tables. We suggest that most users use the interface. From the interface, you can press Control+L to view the logic that is being generated to create the tables.

One reason we don't promote batch mode is that there is scarce documentation about the syntax. However, ICFI Macro does use that mode, so you might consider contacting either of these guys:

http://www.linkedin.com/pub/guillermo-rojas/2a/649/979

http://www.linkedin.com/pub/trevor-croft/11/a4/796