Set Value depending on View - InfoPath Dev
in

InfoPath Dev

Set Value depending on View

Last post 12-22-2005 02:37 PM by jeanpaul. 4 replies.
Page 1 of 1 (5 items)
Sort Posts: Previous Next
  • 12-22-2005 08:32 AM

    Set Value depending on View

    I would like to set a value of a field depending on the current view..

    Example:

    if current view = "ABC"

    Then [field] = 5
  • 12-22-2005 01:43 PM In reply to

    Re: Set Value depending on View

    Use the OnSwitchView event.

    Then you can do the code below in the event.

    if (XDocument.View.Name == "XXX")
    {
    //do something
    }
    Jason
    http://www.k2distillery.com/
  • 12-22-2005 02:06 PM In reply to

    Re: Set Value depending on View

    OK i did the following on switch view:

    If thisXDocument.View.Name = "SUFFOLK" Then
    thisXDocument.DOM.selectSingleNode("//mstns:LisPendants/mstns:lisPendantslist/mstns:VIEW").text = "SUFFOLK"
    End If

    BUT I am getting the following error:

    System.NullReferenceException
    Object reference not set to an instance of an object.
    at LisPendants.LisPendants.OnSwitchView(DocEvent e) in S:\INFOPATH FORMS\LisPendants\FormCode.vb:line 61
    at Microsoft.Office.Interop.InfoPath.SemiTrust._XDocumentEventSink2_SinkHelper.OnSwitchView(DocEvent pEvent)
  • 12-22-2005 02:23 PM In reply to

    Re: Set Value depending on View

    One more thing...the node is in a repeating element
  • 12-22-2005 02:37 PM In reply to

    Re: Set Value depending on View

    Sorry it is working know...I just had the node value spelled wrong
Page 1 of 1 (5 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.