Auto-view selection on upload or similar - InfoPath Dev
in

InfoPath Dev

Use our Google Custom Search for best site search results.

Auto-view selection on upload or similar

Last post 10-02-2007 06:34 PM by carlosthejackal. 4 replies.
Page 1 of 1 (5 items)
Sort Posts: Previous Next
  • 10-01-2007 11:13 PM

    Auto-view selection on upload or similar

     Hi Guys,

    I know this old chestnut I know but I can not seem to find a post that explains easily how to do this....

     
    Ideally I need this to be done without the use of code (as I am not that good at it)...

    Ok here goes:

    I have a field in the default view called UserName this has a formula inserted UserName()....this captures the user id, this is ok and is populated when the form is displayed.

    In Tools> Form Options>  Open and Save and Default Behaviour I have an entry that states if  UserName  is equal to (the users name)  switch view to a specific view.

    Problem is it doesn't - any idea's?

    Am I being to simplistic with this approach?

    Thanks in advance.

    Carl

     


     

  • 10-02-2007 12:06 AM In reply to

    Re: Auto-view selection on upload or similar

    Hello

    Try this article and the logic in that

    http://www.kbalertz.com/Q826997/Programmatically.Change.Default.Microsoft.Office.InfoPath.aspx

    I hope this is simple and will help you.

    Kalyan G Reddy
    Infopath MVP 2007 and 2008
  • 10-02-2007 02:43 AM In reply to

    Re: Auto-view selection on upload or similar

     

    Thanks for the prompt response, I'll have a go it does look fairly straight forward.

    Once again cheers for the helping hand.

    Carl 

     

  • 10-02-2007 05:56 AM In reply to

    Re: Auto-view selection on upload or similar

    Hello

    Will be glad if it helps you

    Kalyan G Reddy
    Infopath MVP 2007 and 2008
  • 10-02-2007 06:34 PM In reply to

    Re: Auto-view selection on upload or similar

    It would seem that this is for changing from one view to another with static data - my scenario is that I have 41 users that need to complete the form. They need to complete 14 fields on a line and save it.

    I am proposing 41 views for them of several lines each (not much screen rendering).

    I wanted to detect the UserName and from that switch to one of the 41 views, as initially mentioned I can set a field value to detect the UserName but can not get the code to trigger in the onload event (my bad programming no doubt).

    Any ideas in theory should be simple if only I knew the syntax (some sample code would help me sleep at night)!

    So my thoughts are:

    Detect the UserName and if it equals a view in our instance Admin-location so they are Admin-Longreach etc. Once it detects this switch to that view onload.

    If not equal to any of the 41 views then display the default (full page view).....sounds simple eh!

    Help again!

    I have been trying to use this simple peice of code in the onload section but to no avail - any idea's?

    switch (System.Environment.UserName)
                {
                    case "Administrator": XDocument.View.SwitchView("Cornetts Group View");
                    case "Admin-Banksia": XDocument.View.SwitchView("Admin-Banksia");
                    case "Admin-Longreach": XDocument.View.SwitchView("Admin-Longreach");


                }
            }

     

     

    Thanks

    Carl

     

     

Page 1 of 1 (5 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.