SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Evangelist
    Join Date
    Jun 2004
    Location
    ny
    Posts
    560
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Struct and Session

    Hi all, i need to store all the screen_code and APP_PRIVILEGES into session struct...but somehow when i dumped "session.AdminPrivStruct" I only get one key instead of getting 17 keys and values? Any reason for that?



    ---------

    <cfquery datasource="#application.orc#" name="GetAdminPriv">
    Select
    p.APP_PRIVILEGES,
    p.SCREEN_CODE,
    sc.SCREEN_NAME
    from
    OPS$RMS.REF_LOGIN a,
    OPS$RMS.LOGIN_PRIVILEGE p,
    OPS$RMS.REF_SCREEN sc
    where
    a.EID = p.EID
    And p.screen_code = sc.screen_code
    And upper(a.EID) = upper('#GetAdminLogin.EID#')
    </cfquery>



    <cfoutput query="GetAdminPriv">
    <cfscript>
    session.AdminPrivStruct = structnew();
    session.AdminPrivStruct["#SCREEN_Code#"] = SCREEN_code;
    session.AdminPrivStruct["#SCREEN_code#_Priv"] = APP_PRIVILEGES;
    </cfscript>
    #SCREEN_code#
    </cfoutput>

  2. #2
    SitePoint Enthusiast
    Join Date
    Apr 2009
    Location
    Wallingford, CT
    Posts
    92
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by emmim44 View Post
    Hi all, i need to store all the screen_code and APP_PRIVILEGES into session struct...but somehow when i dumped "session.AdminPrivStruct" I only get one key instead of getting 17 keys and values? Any reason for that?



    ---------

    <cfquery datasource="#application.orc#" name="GetAdminPriv">
    Select
    p.APP_PRIVILEGES,
    p.SCREEN_CODE,
    sc.SCREEN_NAME
    from
    OPS$RMS.REF_LOGIN a,
    OPS$RMS.LOGIN_PRIVILEGE p,
    OPS$RMS.REF_SCREEN sc
    where
    a.EID = p.EID
    And p.screen_code = sc.screen_code
    And upper(a.EID) = upper('#GetAdminLogin.EID#')
    </cfquery>



    <cfoutput query="GetAdminPriv">
    <cfscript>
    session.AdminPrivStruct = structnew();
    session.AdminPrivStruct["#SCREEN_Code#"] = SCREEN_code;
    session.AdminPrivStruct["#SCREEN_code#_Priv"] = APP_PRIVILEGES;
    </cfscript>
    #SCREEN_code#
    </cfoutput>
    Instead of doing an output of the query try looping over the query.

    Code:
    <cfloop query="GetAdminPriv">
        <cfscript>
        session.AdminPrivStruct   = structnew();
        session.AdminPrivStruct["#SCREEN_Code#"] = SCREEN_code;
        session.AdminPrivStruct["#SCREEN_code#_Priv"] = APP_PRIVILEGES;
          </cfscript>
         <cfoutput>
          #SCREEN_code#
         </cfoutput>
    </cfloop>

  3. #3
    SitePoint Evangelist
    Join Date
    Jun 2004
    Location
    ny
    Posts
    560
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    How will I retrieve the value of lets say, " session.AdminPrivStruct["Admin"] "

  4. #4
    SitePoint Enthusiast
    Join Date
    Apr 2009
    Location
    Wallingford, CT
    Posts
    92
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by emmim44 View Post
    How will I retrieve the value of lets say, " session.AdminPrivStruct["Admin"] "
    You would just have to do an output there then. But do a loop to put it into the struct.

  5. #5
    SitePoint Evangelist
    Join Date
    Jun 2004
    Location
    ny
    Posts
    560
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thank you all


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
  •