NetTalk Central

Author Topic: Pass parameter in servercall? (RESOLVED)  (Read 4181 times)

Poul Jensen

  • Full Member
  • ***
  • Posts: 241
    • View Profile
    • Email
Pass parameter in servercall? (RESOLVED)
« on: April 14, 2025, 08:39:08 PM »
Hi,

I would like to pass a parameter to the NT server like this:
https://myntserver.com?a=x

And then read the value x into a session value in the webserver procedure.

How do I do this?

tia
/Poul
« Last Edit: April 19, 2025, 03:47:23 AM by Poul Jensen »

Niels Larsen

  • Sr. Member
  • ****
  • Posts: 446
    • View Profile
    • Email
Re: Pass parameter in servercall?
« Reply #1 on: April 14, 2025, 09:37:01 PM »
p_web.GetValue('a')



Poul Jensen

  • Full Member
  • ***
  • Posts: 241
    • View Profile
    • Email
Re: Pass parameter in servercall?
« Reply #2 on: April 14, 2025, 09:57:53 PM »
Tak Niels.

Niels Larsen

  • Sr. Member
  • ****
  • Posts: 446
    • View Profile
    • Email
Re: Pass parameter in servercall?
« Reply #3 on: April 14, 2025, 11:48:55 PM »
Altid :-)

Poul Jensen

  • Full Member
  • ***
  • Posts: 241
    • View Profile
    • Email
Re: Pass parameter in servercall?
« Reply #4 on: April 15, 2025, 06:53:16 AM »
What is the earliest point in the app, where I should read the parameter, preferably code that is reached once only per user?

/Poul

Poul Jensen

  • Full Member
  • ***
  • Posts: 241
    • View Profile
    • Email
Re: Pass parameter in servercall?
« Reply #5 on: April 15, 2025, 08:21:01 AM »
Let me expand on this:

What I want to achieve, is to call the app with a parameter, read this parameter and change the filenames global variable names, so they point to a specific dataset.
As per the docs re Multiple Data Sets:  https://www.capesoft.com/docs/NetTalk14/NetTalkWebBasic.htm#MultipleDataSets, I have tried the webhandler RequestHostSet embed to read the parameter and save it in a session variable.

But next time through the webhandler this is being reset.

So I need some guidance here for the best approach.

tia

/Poul

Alberto

  • Hero Member
  • *****
  • Posts: 1884
    • MSN Messenger - alberto-michelis@hotmail.com
    • View Profile
    • ARMi software solutions
    • Email
Re: Pass parameter in servercall?
« Reply #6 on: April 15, 2025, 11:46:01 AM »
Use the ProcessLink() WebHandled Method, there you can change the database.
Cheers
-----------
Regards
Alberto

Poul Jensen

  • Full Member
  • ***
  • Posts: 241
    • View Profile
    • Email
Re: Pass parameter in servercall?
« Reply #7 on: April 15, 2025, 10:43:24 PM »
Hi Alberto,

That is what I am using, but at soon as I click the button for the login window, the filename variables are being reset.

Cheers
/Poul

Jane

  • Sr. Member
  • ****
  • Posts: 391
  • Expert on nothing with opinions on everything.
    • View Profile
    • Email
Re: Pass parameter in servercall?
« Reply #8 on: April 16, 2025, 03:22:59 PM »
Works for me, Poul.
How are you storing the parameter?  If you're putting it into a sessionValue, it should be sticky and persist through the login and beyond.

You'll need to set your filename variables EACH TIME your code runs through p_web.ProcessLink in the webhandler (because each pass through there is happening on a new thread), so set the session values the first time (when they're sent as parameters) then use those session values to set the filename variables EACH TIME.

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11298
    • View Profile
Re: Pass parameter in servercall?
« Reply #9 on: April 16, 2025, 06:45:26 PM »
p_web.StoreValue('a')
Is the best way to set a session value to a value, because then if the value doesn't exist (as a parameter) it does not overwrite the session value.
I expect you are just overwriting your session value to blank when the value does not exist.

Poul Jensen

  • Full Member
  • ***
  • Posts: 241
    • View Profile
    • Email
Re: Pass parameter in servercall?
« Reply #10 on: April 17, 2025, 12:32:03 AM »
You'll need to set your filename variables EACH TIME your code runs through p_web.ProcessLink in the webhandler (because each pass through there is happening on a new thread), so set the session values the first time (when they're sent as parameters) then use those session values to set the filename variables EACH TIME.

That was the missing piece :-)

Thanks Jane.

Poul Jensen

  • Full Member
  • ***
  • Posts: 241
    • View Profile
    • Email
Re: Pass parameter in servercall?
« Reply #11 on: April 17, 2025, 12:32:39 AM »
p_web.StoreValue('a')
Is the best way to set a session value to a value, because then if the value doesn't exist (as a parameter) it does not overwrite the session value.
I expect you are just overwriting your session value to blank when the value does not exist.

Thanks Bruce - spot on.