Precisely Speaking
May 21, 2012, 06:55:34 PM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News: So what's news with you?  Tell us about it in "Getting To Know You"!
 
   Home   Help Calendar Login Register  
Pages: [1]   Go Down
  Print  
Author Topic: How do you pass values between sub-screens?  (Read 514 times)
DonQuixote
Rock Star
*****
Posts: 108


To Dream the Impossible Dream...


« on: January 06, 2011, 11:54:22 AM »

I have a screen built using (/SD) and a subscreen that I get to using a function key.  Both screens only use WORK variables.  the changes in the subscreen effects the values in the main screen but they don't seem to get back to the main screen.  Should I be using something besides WORK?
Logged
DonQuixote
Rock Star
*****
Posts: 108


To Dream the Impossible Dream...


« Reply #1 on: January 06, 2011, 02:29:19 PM »

I spoke too soon.  @WORK does pass the values I need but for some reason @USERDATA values that I was setting in "Process after accept" in the subscreen were not passing to the main screen.
Logged
Tom Pellitieri
Rock Star
*****
Posts: 171


Tom Pellitieri - Toledo, Ohio


« Reply #2 on: January 07, 2011, 06:41:00 AM »

USERDATA is a "Section 1" variable.  The first note in the help for the COMMON states:

"The first 52 variables (Section 1) are preserved whenever any process calls another process that uses these variables, (all screens, reports, menus). They are restored on exit from the called process. The first four variables (RECORD, KEY, WORK, OTHER.REC) are not restored if the called process is an Input or Output process defined as a sub-screen."

So, any "subscreen" changes have to be made in RECORD, WORK or OTHER.REC.  I wouldn't use OTHER.REC, since that could be overwritten by an internal SB+ process.

Section 2 variables change throughout the session, and Section 3 variables are essentially static.

PARMS(40) is a Section 2 variable, and that array is preserved between process calls.  Depending on your application, some entries may be "reserved".  For example, Prelude will load system parameters in PARMS(3), and uses PARMS(39) to pass information between processes.

--Tom
Logged
precisonline
President/Chief Technologist
Administrator
Rock Star
*****
Posts: 1532



WWW
« Reply #3 on: January 08, 2011, 07:38:27 AM »

The behavior of @USERDATA - as a section 1 variable as Tom has pointed out - is identical to @RECORD, @WORK, @CNT, etc.  It sounds like the /PD.I on the subscreen may not have the "S" option, though I would expect that to affect @WORK as well.

If the "S" option is on the /PD.I all those section 1 variables should pass freely between the main and subscreens.  Now, there is a second possibility; if you're escaping from the subscreen, the original values that were in the main screen at the moment the subscreen was called will be restored.
Logged

-Kevin
Accidents "happen"; success, however, is planned and executed.
Pages: [1]   Go Up
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.7 | SMF © 2006-2008, Simple Machines LLC Valid XHTML 1.0! Valid CSS!