NetTalk Central

Author Topic: Setting session variable upon clicking row in browse  (Read 5910 times)

kingja

  • Sr. Member
  • ****
  • Posts: 261
    • View Profile
    • Email
Setting session variable upon clicking row in browse
« on: January 13, 2013, 02:02:12 PM »
     I'm trying to set session variables with each click on a browse row.  In the "afterbrowserowclicked" embed, I have the following:

               p_web.SSV('ID_NO', p_web.GSV('dem:ID_NO'))
               p_web.SSV('PatientName', p_web.GSV('dem:FIRSTN')&' '&p_web.GSV('dem:LASTN'))

     The ID_NO variable is getting set but not the other two.  Anyone have any suggestions?

Thanks,

Jeff

kevin plummer

  • Hero Member
  • *****
  • Posts: 1195
    • View Profile
    • Production Accounting and Software Payroll
Re: Setting session variable upon clicking row in browse
« Reply #1 on: January 13, 2013, 05:20:11 PM »

               p_web.SSV('ID_NO', p_web.GSV('dem:ID_NO'))

> you will need to do a file access here to "get" the record based on the above ID and then you should change the next line to:

               p_web.SSV('PatientName', dem:FIRSTN &' '& dem:LASTN)

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: Setting session variable upon clicking row in browse
« Reply #2 on: January 13, 2013, 09:00:03 PM »
correct, only the id of the browse row is moved to the session queue when a row is clicked. Not the whole record. You will need to open the table (important, the table is not opened for you here) and read the record yourself.

cheers
Bruce

kingja

  • Sr. Member
  • ****
  • Posts: 261
    • View Profile
    • Email
Re: Setting session variable upon clicking row in browse
« Reply #3 on: January 14, 2013, 07:53:20 AM »
Bruce and Kevin,

     Got it.  Thanks!

Perkins

  • Newbie
  • *
  • Posts: 8
    • View Profile
    • Email
Re: Setting session variable upon clicking row in browse
« Reply #4 on: January 14, 2013, 08:22:22 AM »
<< (important, the table is not opened for you here) and read the record yourself.>>

From this statement is it safe to assume that putting a table in the datapad for a procedure does not cause the table to be opened like in standard clarion procedures?  For instance If I want to validate a login by accessing a User table, I would need to add it to the datapad and include the Open and Close calls for the table in my source?

Dennis Perkins
Dennis Perkins

terryd

  • Hero Member
  • *****
  • Posts: 759
    • View Profile
    • Davcomm
    • Email
Re: Setting session variable upon clicking row in browse
« Reply #5 on: January 14, 2013, 09:11:12 AM »
Yes!
Terry Davidson
Windows 10 64 bit/Windows7 64bit
Clarion 9.1.11529/Clarion10 12567
Nettalk 913
Nettalk 1015
StringTheory267/Winevent515/XFiles298/MessageBox239/Cryptonite186

kingja

  • Sr. Member
  • ****
  • Posts: 261
    • View Profile
    • Email
Re: Setting session variable upon clicking row in browse
« Reply #6 on: January 14, 2013, 09:50:01 AM »
Bruce,

     That got me part of the way.  I also have a button (type other) at the end of each browse row.  It is to call another browse/form pair, filtered using the session variables set upon selecting the browse row.  If I go to the browse, and don't select a row, but click on the button first, the called browse/form is not filtered.  I find I must still select the row first, before clicking the button.  I have placed the following code in the afterbrowserowclicked embed and the server side code when button pressed embed:

         Access:demo.Open()
         dem:ID_NO = p_web.GSV('dem:ID_NO')
         If Access:demo.Fetch(dem:DEMO) = Level:Benign
              p_web.SSV('ID_NO', Clip(dem:ID_NO))
              p_web.SSV('PatientName', Clip(dem:FIRSTN)&' '&Clip(dem:LASTN))
         END

     Is there a way to cause a row to be selected when a button in that row is clicked?

Thanks,

Jeff

kevin plummer

  • Hero Member
  • *****
  • Posts: 1195
    • View Profile
    • Production Accounting and Software Payroll
Re: Setting session variable upon clicking row in browse
« Reply #7 on: January 14, 2013, 03:27:10 PM »
Hi Jeff,

what does your filter look like?

You may be able to use p_web.GSV('dem:ID_NO') instead of p_web.GSV('ID_NO') in your filter (if you use it) and simplify your previous code.

Kev

kingja

  • Sr. Member
  • ****
  • Posts: 261
    • View Profile
    • Email
Re: Setting session variable upon clicking row in browse
« Reply #8 on: January 14, 2013, 05:23:15 PM »
Kevin,

     Here is my filter:  'CLI:ID_NO=<39>'&p_web.GSV('ID_NO')&'<39>'

I tried your suggestion but no good.  I actually call a form, with a tab that contains the filtered browse (see image clinhist.png).
    
     Perhaps I should explain what I'm trying to accomplish.  I built this app to allow patients to enter medical data on-line, to replace paper forms.  I have a user.tps file that holds user account info such as acct. number, name, user name, password hash, etc.
     Each user logs in and is immediately taken to a filtered browse of their demographic information.  A session variable, 'ID_NO' is set at login time and is used to filter this demographic table.  I also have  a drop menu that has items such as Clinical History, Chemo, etc.  Each of these is also filtered using the session variable 'ID_NO'.  All this works very well as is.
     Now, I'm trying to allow certain "Admin" level users (physicians, etc.), to verify this patient entered data.  Each Admin should be able to to see a list of all patients, search for a specific one, and then view all their demographic and history information.  The Admin user also has their account in the user.tps file, but of course they have no information in the demographic or clinical history files.  
     To do this, I created another shorter version of the browse that displays the demographic information (see patlist.png).  At the end of each row, I have created a button (type other) that calls the original clinical history browse seen above.  Now here is where the issue is.  The account number assigned to users in user.tps is meant to be used as a filter for the demographic and clinical history browses.  When an Admin user logs in, their account number is set in the 'ID_NO' session variable.  But, it won't find any items in the demographic or clinical history browses and this is entirely expected.
     So, I'm attempting to reset the 'ID_NO' session variable with code in the "afterbrowserowclicked" embed of the shorter demographic browse.  This does work, as long as I manually select the row first, before clicking on the corresponding Hx button of the row.  By the way, I use the 'PatientName' session variable and the 'ID_NO' session variable to create a sub-header for each browse and form.
     Hopefully, I explained this well.  Perhaps there is a better approach?

Thanks,

Jeff
 




[attachment deleted by admin]
« Last Edit: January 14, 2013, 05:28:56 PM by kingja »

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: Setting session variable upon clicking row in browse
« Reply #9 on: January 14, 2013, 09:08:31 PM »
>> From this statement is it safe to assume that putting a table in the datapad for a procedure does not cause the table to be opened like in standard clarion procedures?

it opens the files in some cases, but not in others. The "Browse Procedure" or "Form Procedure" consists of many parts that are called separately, on different threads. The files are only opened if it knows they will be needed. So you should assume (if you don't know) that they are closed.

>> Is there a way to cause a row to be selected when a button in that row is clicked?

There is an option on the button to "include Row Id" tick this on.

Cheers
Bruce

kingja

  • Sr. Member
  • ****
  • Posts: 261
    • View Profile
    • Email
Re: Setting session variable upon clicking row in browse
« Reply #10 on: January 15, 2013, 04:36:24 AM »
Bruce,

The "include row I'd" has been ticked on from the start.  I'm checking other embed code to see if I'm setting the session variables elsewhere.

Thanks,

Jeff

kingja

  • Sr. Member
  • ****
  • Posts: 261
    • View Profile
    • Email
Re: Setting session variable upon clicking row in browse
« Reply #11 on: January 15, 2013, 09:09:23 AM »
Bruce,

     After some discussion here, we have decided that the NT app should be for patient use only.  We will not use it to try and do any verification of data.  Instead, we will send all patient data to our main database, but flag it as created by the patient.  We plan to filter this "patient given" data from any use in the main app until it has been verified.  Verification will take place on the desktop app side, where we build reports, etc.  This greatly simplifies things.  I'll let you know how it goes.

Thanks,

Jeff