Sign up on the Revelation Software website to have access to the most current content, and to be able to ask questions and get answers from the Revelation community

At 11 MAR 2004 12:28:25AM Kauko Laurinolli wrote:

I have a create event in a form which uses @ID, @DICT and @RECORD to open a table. I set @USER0, @USER1, @USER2, @RECUR0 etc.

In create event I then call Subroutine which uses @USER0, @USER1, @USER2, @RECUR0 but it also uses @ID, @DICT and @RECORD which are now messed up.

I have tried to set TEMP_ID=@ID; @ID=' etc. and then restore after returning from Subroutine but this is nor working.

How do I get around this?


At 11 MAR 2004 03:37AM Donald Bakke wrote:

Kauko,

Have you tried using Push.Session and Pop.Session as described in this post?

[email protected]

SRP Computer Solutions, Inc.


At 11 MAR 2004 04:27AM The Sprezzatura Group wrote:

Are you suggesting code similar to this:

TempID = @ID

TempRec= @RECORD

Call MySubroutine( Param1, Param2....)

@ID    =TempID

@RECORD=TempRec

and TempID and TempRec are getting cleared?

That shouldn't happen. Can you give some code showing how the call is being made? If the variables themselves are not passed, or global, then they cannot be modified outside the program.

If you are calling a program recursively, you will end up with a new set of variables.

If you are passing the variables into a subroutine, if the parameters are changed, they will return changed back to the calling routines.

The Sprezzatura Group

World Leaders in all things RevSoft


At 11 MAR 2004 05:37AM Kauko Laurinolli wrote:

Yes, my code is exactly as you show.

Problem is that @ID from the calling program shows up in the Subroutine and I don't seems to be able to fix this.


At 11 MAR 2004 08:38AM The Sprezzatura Group wrote:

What do you mean 'shows up'. @ID is global, and will stay set until something resets it to something else.

Sometimes it appears to be window specific, but that's because the semantic logic layer is setting the value before executing the window event layer code.

What do you expect @ID should be in the calling routine?

The Sprezzatura Group

World Leaders in all things RevSoft


At 11 MAR 2004 05:34PM Kauko Laurinolli wrote:

If I just call Subroutine form my form w/o opening any tables during the forms create event the keys (@ID) in subroutine are properly "P1000", "P1001", "P1002" etc. from table "PROJECTS".

When I call the very same Subroutine from my form create event after opening table "COMPANIES" the key (@ID) which shows up during processing table "PROJECTS" is now the key from table "COMPANIES", eg. "SALES".

Of course the process bums out since table "PROJECTS" doesn't have keys like that.


At 12 MAR 2004 03:18AM [url=http://www.sprezzatura.com]The Sprezzatura Group[/url] wrote:

It sounds like you are doing something other than just opening up the table.

Are you getting these keys from a LIST statement? How is @ID being initially assigned to the value you want?

The Sprezzatura Group

World Leaders in all Things RevSoft


At 12 MAR 2004 07:00PM Kauko Laurinolli wrote:

Thanks for responding. Here are code snippets (cleaned from unneded stuff).

RV=Set_Property(@Window, '@ORIG_RECORD', OUTPUT_DEVICE)

Open …..etc

Rlist('SELECT OFFICES_FILE BY @ID',TARGET_ACTIVELIST$,,,) READUSER: READNEXT @ID ELSE LAST_USER=1 END READ @RECORD FROM USER_IN,@ID ELSE GOTO READUSER R_QIN={QIN} USR=Xlate('INITIALS_FILE',R_QIN,3,'X') ;* Name @USER0 =USR Init =Xlate('USERS',USR, 5,'X') @RECUR2=Xlate('INITIALS_FILE',Init,2,'X') @USER1 =Xlate('USERS',USR,10,'X')1,1 Sales=@RECUR0 HOLD_ID =@ID HOLD_DICT=@DICT HOLD_REC =@RECORD @ID =' @DICT =' @RECORD=' Call ACTIVE_PROJECTS_LIST(,) * Then in ACTIVE_PROJECTS_LIST I do: * Sales=@RECUR0 COMMAND=SELECT PROJECTS BY SAL BY LOCATION BY PNUMB WITH SAL ENDING "AUG"' Table=PROJECTS' Open Table TO FILE_IN Then OPEN 'DICT', Table to @DICT ELSE Null End Else Msg("Can't open") Return End Rlist('SELECT PROJECTS WITH X=A"',TARGET_ACTIVELIST$,,,) Rlist(COMMAND,TARGET_ACTIVELIST$,,,) READRECORD: Here I can see wrong @ID in variable ZZ. If In assing USR in my form manually and skip all open and Read stuff all goes OK ZZ=@ID msg('@ID=: ZZ) READNEXT @ID,WHICH_VALUE ELSE LAST_RECORD=1 SAL_BREAK=1 SAL=NEXT_SAL END So here is bumms out w/ both FIRST_PASS=1 AND LAST_RECORD=1 IF FIRST_PASS AND LAST_RECORD THEN $INSERT SOURCE, GASGAUGE_END Msg("ZERO Records Listed, FIRST_PASS=: FIRST_PASS :" LAST_RECORD=: LAST_RECORD) Return END </QUOTE> —- === At 13 MAR 2004 02:02PM The Sprezzatura Group wrote: === <QUOTE>You're problem is in the RLIST call in your second program. RLIST uses @ID for it's own purposes it seems. Try this little routine: @ID=' call rlist( 'SELECT SYSREPOS WITH F1 "A"', 5, , , )

Then check @ID. If you need to hold onto @ID from the calling routines, then either pass it as a parameter, or take the value from @ID before calling RLIST.

The Sprezzatura Group

World Leaders in all Things RevSoft

View this thread on the forum...

  • third_party_content/community/commentary/forums_nonworks/79f86f424104fd4b85256e54001e114d.txt
  • Last modified: 2024/01/04 21:00
  • by 127.0.0.1