NetTalk Central

Author Topic: Function thing - threads  (Read 4098 times)

charl99

  • Full Member
  • ***
  • Posts: 185
    • View Profile
    • Email
Function thing - threads
« on: November 16, 2011, 05:31:45 AM »
Hi,

My understanding is that if I read a record to memory, and I call a function that modify this record, it won't affect other users (or other records) called by other users?

To clarify, because Bruce never understand my questions ;)

ie, I want to call a function and I want 3 parameters to be passed back, C_UWYear, C_InceptionDate and C_RenewalDate.  As I cannot get 3 parameters back unless I put them in a string, is it good enough to load the record, pass the information like Policy Number and Date of Loss to my function, where I then set these values and it will be changed when I get back from my function to NetTalk.

Thanks

Charl

Ubaidullah

  • Full Member
  • ***
  • Posts: 125
    • View Profile
Re: Function thing - threads
« Reply #1 on: November 16, 2011, 06:29:38 AM »
Yes, it will change the record buffer. But, you need to set the session values for the fields after returning from the function. e.g.

   p_web.SSV( 'FIL:Field1', FIL:Field1)
   p_web.SSV( 'FIL:Field2', FIL:Field2)
   etc.

Regards,
Ubaidullah Nubar.



Stu

  • Hero Member
  • *****
  • Posts: 510
    • View Profile
    • Email
Re: Function thing - threads
« Reply #2 on: November 16, 2011, 06:22:06 PM »
Charl,

Hi there.

As Ubaidullah mentioned, Session values are the bomb.

I'd be clearing them first, call you function where you set them, then after that use them.
Cheers,

Stu Andrews

charl99

  • Full Member
  • ***
  • Posts: 185
    • View Profile
    • Email
Re: Function thing - threads
« Reply #3 on: November 17, 2011, 02:57:15 AM »
Thanks guys.

These fields are background things needed for some calculations, ie not on the screen or anything, so I guess I don't have to worry about session values.

Cheers
Charl

Stu

  • Hero Member
  • *****
  • Posts: 510
    • View Profile
    • Email
Re: Function thing - threads
« Reply #4 on: November 17, 2011, 05:56:23 PM »
Nooooo! Always worry about Session Values. Regardless of whether they are on the screen or not, Session Values are extremely important in the structure of a web system.

I'm sure Bruce could chime in with something clearer about now :)
Cheers,

Stu Andrews

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: Function thing - threads
« Reply #5 on: November 17, 2011, 07:38:29 PM »
ha ha - well I've got Stu well trained <g>.
But "normal Clarion" doesn't go away, as long as you're on the same thread - and that's the key - being on the same thread.

So a block of code runs, as always, from top to bottom. Anything you do inside that block is good. Procedure calls, file buffers, it's all ok.

However _IF_ you want to use something in some other block of code, for example when the form opens you prime something, then do something with it when the form closes, well, there Session values are important because (and this is the really important bit to grasp) those two "actions" occur on different threads. A windows program puts all the Form interaction on one thread, the web doesn't.

Cheers
Bruce