Results 1 to 9 of 9

Thread: Default Startup View Different For Level Of User?

  1. #1

    Default Default Startup View Different For Level Of User?

    Is there a way to change the default startup view, based on the user level ("rights" column) in the WebAppUser table?


    Code:
    Delegate Set phoDefaultView to Self
    


    The above code will automatically load this view when starting the webapp -- but what if I want it to change, based on a column in a table?

  2. #2
    Join Date
    Feb 2009
    Location
    Hengelo (NL)
    Posts
    1,891

    Default Re: Default Startup View Different For Level Of User?

    You'd augment 'defaultView', say

    Code:
        Function GetDefaultView Returns Handle
            Handle  hoDefault
            Integer iRights
    
    
            Get piUserRights of oSessionManager to iRights
    
    
            If (iRights 1) Move oDashboard to hoDefault
            Else              Move oAnotherView to hoDefault
    
    
            Function_Return hoDefault
        End_Function

  3. #3
    Join Date
    Feb 2009
    Location
    Brazil
    Posts
    5,447

    Thumbs up Re: Default Startup View Different For Level Of User?

    phoDefaultView is not a web-property. So I am not sure if this will work, for further logins after the webapp has been loaded already. You can set it once the webapp is starting up. but it was not designed to be changed after that.

    But, the class allows you to change the default View, by implementing GetDefaultView function in your cWebApp object

    Code:
    Function GetDefaultView Returns Handle
        Handle hoView 
    
        If (condition 1) ; 
              Move  oMyView1 to hoView 
    
       if (condition 2) ; 
            Move oMyView2 to hoView
        Function_Return hoView
    End_Function
    Regards
    Samuel Pizarro

  4. #4

    Default Re: Default Startup View Different For Level Of User?

    I'm not following you on this Samuel. When the webapp is starting up, that's when I want to check to see what view should be loaded. After that, I don't know why I would want to change it.

    The webapp is started up for each user after they log in, right?

  5. #5

    Default Re: Default Startup View Different For Level Of User?

    Thanks Evertjan. I'm a bit confused by your function sample.

    Where do I put that function? How do I call it? What do I do with the handle that is returned by the function?

  6. #6
    Join Date
    Feb 2009
    Location
    Queens, NY, NY
    Posts
    7,429

    Default Re: Default Startup View Different For Level Of User?

    Actually no, the EXE is started an running just once, every time a client connects to the server whatever webapp.exe happens to be free takes care of the request. If the request is "Log in" then the next thing that happens is the system calls the function "getdefaultview" (or whatever it's called in the other posts here, I'm not on my PC)

    when you write the code you already have the Object id (oCustoemrView, or oSalespersonView) and you can decide which name to pass based on the web properties from the login.

    ***danger Wil Robinson*** the second thing that will trip you up in webapps is how different they are at runtime, with multiple users. Everything that you need to know about the user of this session needs to be a web property, so the server can check with the client that it actually has the right information handy. If you only test int the studio, with one open session you can miss all sorts of bad things. Stop the webapp in the studio, then open two or six different users with different rights either in incognito mode, or in entirely different browsers.

    fun times ahead.
    Michael Mullan.
    Danes Bridge Enterprises.

    ++++++++++++++++++++++++++++
    There is just today. Tomorrow is a concept
    that is mostly theoretical. -- GM Wylie
    ++++++++++++++++++++++++++++

  7. #7
    Join Date
    Feb 2009
    Location
    Brazil
    Posts
    5,447

    Default Re: Default Startup View Different For Level Of User?

    The webapp is started up for each user after they log in, right?
    Simple answer. No!

    WebApps behaves pretty different than, regular windows desktop apps.

    You may have 100 hundreds users, using your webapp simultaneously (active sessions) , but only 10 webapp processes running in your server, serving the users (client browsers) requests
    They are not started every time a new user opens a new session. this would be to slow. the process are already started by that time and they are constantly re-used to serve other users requests, in a round-robin fashion.

    It's not easy to explain here, and I my English skill are not good enough for trying it.. Best I can do I ask you to read the help documentation, as it explains this way better than me.

    https://docs.dataaccess.com/dataflex...ss_Pooling.htm

    https://docs.dataaccess.com/dataflex...ation_flow.htm

    Regards
    Samuel Pizarro

  8. #8
    Join Date
    Feb 2009
    Location
    Hengelo (NL)
    Posts
    1,891

    Default Re: Default Startup View Different For Level Of User?

    Hello Guy,

    You put it in oWebapp (webapp.src) - I should have mentioned that. It automatically gets called, similar to an event. It is just to tell the webapp what handle to use for the default view, you do not anything with it really, you just specify what the default view is.

  9. #9
    Join Date
    Apr 2009
    Location
    Wilmington NC, USA or Oaxaca Mexico
    Posts
    919

    Default Re: Default Startup View Different For Level Of User?

    If both views are dashboard style, you could look into using dynamic objects. Use the rights property to trigger the creation of the appropriate Tile objects.

Posting Permissions

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