How do you determine which view you are on? - InfoPath Dev
in

InfoPath Dev

How do you determine which view you are on?

Last post 10-20-2011 09:15 AM by Scott Rooke. 5 replies.
Page 1 of 1 (6 items)
Sort Posts: Previous Next
  • 10-19-2011 04:15 PM

    How do you determine which view you are on?

    I have 3 views. I want set a flag if I am on a print view form. I want to archive only the opened print view form. What's the code I need to write in the onLoad event to determine the view?
  • 10-19-2011 06:23 PM In reply to

    Re: How do you determine which view you are on?

    Kathleen -

    I would recommend looking at this Microsoft KB article. http://support.microsoft.com/kb/826997 Hopefully it will get you started.

    Another approach you might take is to create a rule on button click to get to the next View would be to "set a fields value" on button click to a field in the Main Datasource and then display that field on your form somewhere.

    If I have misunderstood your question please provide more details and I'll see if I can help.

    Best

    Scott
  • 10-20-2011 06:47 AM In reply to

    Re: How do you determine which view you are on?

    Let me explain further. I have 3 form libraries with the same form but different views based on if it is new, then it moves to a processed form library once it is approved. Within the Processed library they are in a print view. I needed to batch print these, since I couldn't find a way to do this without buying a product. I decided to put the print form in a repeating section. If the user pulls up anyone of the forms within this library ( I will have to assume it will be printed). I need to know if the view is a print view on load event so I can set a variable because later I need to check that variable and based on it all the forms in the processed library will then be moved to an archive library. How can I check which view I am in. I can't just set this variable on load of any view.

  • 10-20-2011 07:22 AM In reply to

    Re: How do you determine which view you are on?

    Okay, if I understand it correctly, you might be looking for this reference http://msdn.microsoft.com/en-us/library/aa946070.aspx.
    Does this help?

    Scott
  • 10-20-2011 09:02 AM In reply to

    Re: How do you determine which view you are on?

    Actually, the link Scott mentions is great for info on the Views class - but there is a note at the top:

    The methods and properties of the View class are not available during the Loading event.

    And it seems you are looking for something from the loading event.

    Perhaps the CurrentView property will help you? http://msdn.microsoft.com/en-us/library/microsoft.office.infopath.xmlform.currentview.aspx 

    Hilary Stoupa

  • 10-20-2011 09:15 AM In reply to

    Re: How do you determine which view you are on?

    Good catch Hilary - Thanks!
Page 1 of 1 (6 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.