Alpha Video Training
Results 1 to 8 of 8

Thread: stuck with session variable

  1. #1
    "Certified" Alphaholic richard2007's Avatar
    Real Name
    Richard Harris
    Join Date
    Sep 2007
    Location
    Ashford, Kent, UK
    Posts
    1,091

    Default stuck with session variable

    in the main, i am using a session variable successfully across all of my logged in pages which has taken the value from the ulink value at login.

    i now have a need for a second seession variable for certain pages.

    i have this code so far, but it doesnt filter to the current record.

    Code:
    <%a5
    '==== get case_parent value into a session var
    if eval_valid("session.case_parent")=.f.
     dtbl=table.open("[PathAlias.ADB_Path]\casefile")
      dtbl.fetch_goto(1)
     dim session.case_parent as c = alltrim(dtbl.case_parent_id)
     dtbl.close()
    end if
    %>
    then in the page to be navigated to, i have set a session variable in the grid.

    Code:
    case_parent_id=(:case_parent)
    this isnt working for me and i assume that it is because there is no filter when getting a value from a table.

    i have checked the help files and i can see the section on setting variables, but the help file examples use constant values, where in the main our variables will be more than likely based upon the current record and not a value of 'George' or '000005'.

    so my question is, how can i set a session variable using a value from a field in the currently selected record?

    thanks

    richard

  2. #2
    Moderator Steve Wood's Avatar
    Real Name
    Steve Wood
    Join Date
    Nov 2003
    Location
    Bay Area, California
    Posts
    8,827

    Default Re: stuck with session variable

    More streamlined code to get your value would be:

    session.case_parent = lookupc("F",session.case_parent,"case_parent_id","[PathAlias.ADB_Path]\casefile","yourindexhere")

    Whether you use your code or the above, you need to determine what is in the session.case_parent after the code runs. Use:

    ?session.case_parent somewhere to view the contents in the browser.
    Steve Wood
    Join the ALPHA DEVELOPERS NETWORK
    There is no Cloud. It's just someone else's computer.
    Web - Mobile - Hosting - Products - Frameworks - Developer Resources
    AlphaToGo | IADN (100% Alpha Anywhere Websites)

  3. #3
    "Certified" Alphaholic richard2007's Avatar
    Real Name
    Richard Harris
    Join Date
    Sep 2007
    Location
    Ashford, Kent, UK
    Posts
    1,091

    Default Re: stuck with session variable

    i am using this in my calling page to capture the session variable (i have tried in both the head and the body of the page)

    Code:
    <%a5
    
    dim session.case_parent as c
    
    session.case_parent = lookupc("F",session.case_parent,"case_parent_id","[PathAlias.ADB_Path]\case_parent","case_parent_id")
    %>
    i have then set an argument in a grid and a filter on page 2

    Code:
    l2id=(:case_parent)
    when i navigate to the relevant page, all records are displayed and not those filtered.

    i did try to add this code to a page to test the value but i am getting nothing

    Code:
    <%a5
    ?session.case_parent
    %>
    i have also tried using a computed linking field from the grid on the calling page to the second page, but thats not working either.

    im not really sure where to go next.

  4. #4
    Moderator Steve Wood's Avatar
    Real Name
    Steve Wood
    Join Date
    Nov 2003
    Location
    Bay Area, California
    Posts
    8,827

    Default Re: stuck with session variable

    My fault, The example I gave you has an error. To be sure, I need to know the structure of this case_parent table. I assume it includes a field that matches this ULINK you get at login, and the case_parent_id you want is based on that ULINK value. If so, then the second parameter in the function needs to be that session variable that contains the ULINK value, and the last parameter needs to be the index in the case_parent table for that ULINK field. If my assumption is wrong, the it won't work.
    Steve Wood
    Join the ALPHA DEVELOPERS NETWORK
    There is no Cloud. It's just someone else's computer.
    Web - Mobile - Hosting - Products - Frameworks - Developer Resources
    AlphaToGo | IADN (100% Alpha Anywhere Websites)

  5. #5
    "Certified" Alphaholic richard2007's Avatar
    Real Name
    Richard Harris
    Join Date
    Sep 2007
    Location
    Ashford, Kent, UK
    Posts
    1,091

    Default Re: stuck with session variable

    hi steve,

    the session.case_parent is not the ulink value. which is why i needed to create the session variable.

    i am ok with using the ulink session variable, but really struggled to create a second session variable. i dont even kow if i am going around this the right way or if i can have more than 1 session variable.

    the case parent table can be the u link value if i can do the following

    effectively from the same database i need two seperate web site projects, with 2 logins (creating the 2 different ulink values) but run from the same location. i didnt think i could do this.

    one web site is a lead generation site and the other is our main site.

  6. #6
    Moderator Steve Wood's Avatar
    Real Name
    Steve Wood
    Join Date
    Nov 2003
    Location
    Bay Area, California
    Posts
    8,827

    Default Re: stuck with session variable

    I did not suggest your case_parent_id or session.case_parent was the ulink. I asked if it was "based on it", or if the case_parent table included the ulink value so I could get the case_parent_id by knowing the ulink value.

    But your question is different now, about dual logins.

    You can have as many login dialogs as you want, but they all work against the same Security Framework system. So each person will have the same ulink value regardless of which login dialog they use.

    You can have as many session variables as you want.

    Its also possible that what you call ulink is different than what I call it. Ulink is the matching field between Security Framework and your local User List. It is not what they type in as their username during login.
    Steve Wood
    Join the ALPHA DEVELOPERS NETWORK
    There is no Cloud. It's just someone else's computer.
    Web - Mobile - Hosting - Products - Frameworks - Developer Resources
    AlphaToGo | IADN (100% Alpha Anywhere Websites)

  7. #7
    "Certified" Alphaholic richard2007's Avatar
    Real Name
    Richard Harris
    Join Date
    Sep 2007
    Location
    Ashford, Kent, UK
    Posts
    1,091

    Default Re: stuck with session variable

    sorry steve,

    re-read and now understand. no the ulink value isnt based on the caseparent_id so i couldnt use a seperate login dialog.

    the database structure is as follows

    case_parent table holds just a few fields and is the parent for all of the sales records.

    casefile table is the sales records tables and the ulink is based on the unique field in this table. this is because when a customer logs in they need to log in to the current sales record. this is our main site.

    the second site (lead generation) also handles customer referrals and the case_parent_id is the field that links the referred customers to those who referred them. so this needs to be based upon the case_parent table.

    its a bit complicated.

    i think i need to pursue a second session.variable

    web database is so much harder than desktop. sometimes i wish i had never started it.


    do appreciate your help.

  8. #8
    "Certified" Alphaholic richard2007's Avatar
    Real Name
    Richard Harris
    Join Date
    Sep 2007
    Location
    Ashford, Kent, UK
    Posts
    1,091

    Default Re: stuck with session variable

    i seem to have worked this out and if correct hope it helps others. if not correct, id be happy to hear the right solution.

    all i did to set my second session variable to allow a user to navigate round the many pages of a child record was create a link in the grid component and set the session variable at this point.

    Code:
    summary_orig.a5w?session.Caseref={Caseref}
    it works just fine, i have tested it around the pages and session variable is passed to each page.

    the solution seems so easy but it has taken me months to get here, inc help files, video tutorials, msg board.

Similar Threads

  1. Send javascript variable to a a session.variable
    By ColinJD in forum Application Server Version 8
    Replies: 7
    Last Post: 01-09-2009, 04:05 PM
  2. Session Variable Not Found
    By Phil Rolf in forum Application Server Version 8
    Replies: 4
    Last Post: 08-30-2008, 11:56 PM
  3. Session Variable
    By Phil Rolf in forum Application Server Version 8
    Replies: 2
    Last Post: 03-03-2007, 07:59 PM
  4. filtering on session variable
    By René Stout in forum Web Application Server v6
    Replies: 2
    Last Post: 09-04-2005, 12:30 AM
  5. lookup on a WAS session variable
    By John Haytko in forum Web Application Server v6
    Replies: 2
    Last Post: 09-13-2004, 04:48 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •