Refer to .text value of a bound control - InfoPath Dev

InfoPath Dev

Use our Google Custom Search for best site search results.

Refer to .text value of a bound control

Last post 09-23-2004 11:23 AM by Greg Collins. 3 replies.
Page 1 of 1 (4 items)
Sort Posts: Previous Next
  • 09-21-2004 02:28 PM

    Refer to .text value of a bound control

    First, InfoPath absolutely ROCKS! Okay, got that off my chest.

    I have an example template I've worked up that performs the following:

    In the OnLoad for the form:

    1. Uses a WScript.Network object to get your windows login and stuff it to a control (I will later hide all of the controls that I am speaking of).
    2. Uses some code that refers to the value in the text box that holds the login to query a web service that we have that returns employee information (EmplID, Name, Email, ManagerEmplID, etc.).
    3. I have bound several text boxes to the first web service return and they work fine and get populated with the users information.

    I then wish to use the value in the bound text box for ManagerEmplID (which was populated by the first web service call) in another batch of code to go use the same web service (passing it the users ManagerEmplID) to get the manager's information (Name, Email, etc.).

    I notice that the text boxes that are bound to secondary data sources don't appear to show up in the DOM for the main form. How then do I refer to the freshly populated ManagerEmplID value so that I can go get the manager information?

    Thanks for any help!!

    I have found a bit more useful information. Apparently, in the OnLoad event, the fields haven't been layed out on the form yet, so referring to the value in the control that I stuffed (using the Web Service) will simply fail because technically nothing is even in the control yet.

    I therefore need a way to refer to the first web service (and the ManagerEmplID field/node) so that I can pass it to the second web service and get back Manager info.

    Hope that makes sense!

    ooh...getting closer...I can view the DOM of the first web service and it has what I want...but I don't understand how to refer to the correct node or whatever.

    Here's what the DOM looks like when I'm in the script editor in debugging (and I enter: ?objwsUser.DOM):

    xml: "<dfs:myFields xmlns:dfs="""" xmlns:s0="""" xmlns:my="""" xmlns:soap="""" xmlns:xsi="""" xmlns:xsd=""""><dfs:queryFields><s0:getBMIEmployeeWithNetworkID><s0:stNetworkID>ziggy</s0:stNetworkID></s0:getBMIEmployeeWithNetworkID></dfs:queryFields><dfs:dataFields><getBMIEmployeeWithNetworkIDResponse xmlns=""""><getBMIEmployeeWithNetworkIDResult><ROOT xmlns=""""><EMPLOYEE EMPLID=""3A435"" PNNL_PAY_NO=""3A435"" HANFORD_ID=""0005933"" ACTIVE_SW=""Y"" ASGN_CORE_CAPABILITY=""T10"" BUSINESS_TITLE=""Scientist III"" COCS_CD=""S100"" COMPANY=""PNL"" CONTACT_LOCATION=""WARI01"" CONTACT_BLD_NO=""ISB2"" CONTACT_ROOM_NO=""332"" CONTACT_MSIN=""K7-54"" CONTACT_BMI_MSIN=""K7
    -54"" CONTACT_COUNTRY_CD=""USA"" CONTACT_WORK_PHONE=""509/375-6699"" COR_CD=""62"" COR_AMOUNT=""54.8500"" COST_CD=""D9C28"" DEPTID=""116012"" FIRST_NAME=""Kevin"" FULL_PART_TIME=""F"" INTERNET_EMAIL_ADDRESS="""" LAST_NAME=""Selby"" MIDDLE_INITIAL=""B"" NAME=""Selby,Kevin B"" NAME_PREFIX=""Mr"" NETWORK_ID=""ZIGGY"" NETWORK_DOMAIN=""PNL"" OFF_SPACE_OCCUPIED_SW=""N"" PAYGROUP=""M01"" PER_STATUS=""E"" POSITION_NO=""00006013"" PREF_FIRST_NAME=""Kevin"" PREF_LAST_NAME=""Selby"" PREF_MIDDLE_INIT=""B"" PREFERRED_NAME=""Selby,Kevin B"" PREFERRED_NAME_FM=""Selby, Kevin B"" PRIMARY_AREA=""RCHN"" PRIMARY_LOCATION=""WARI01"" PRIMARY_BLD_NO=""ISB2"" PRIMARY_ROOM_NO=""332"" PRIMARY_MSIN=""K7-54"" PRIMARY_BMI_MSIN=""K7-54"" PRIMARY_COUNTRY_CD=""USA"" PRIMARY_WORK_PHONE=""509/375-6699"" REPORTING_MGR_EMPLID=""3C343"" REPORTING_ORG_ID=""A92350000"" TYPE=""S"" SNAP_DATE1=""2004-09-20T20:01:31"" SNAP_DATE2=""2004-09-20T20:57:08""/></ROOT></getBMIEmployeeWithNetworkIDResult></getBMIEmployeeWithNetworkIDResponse>

    So how do I refer to the REPORTING_MGR_EMPLID field in code?

    Sorry for such a silly question, but I can't seem to get that field.

  • 09-21-2004 05:20 PM In reply to

    Re: Refer to .text value of a bound control

    It sounds like what you need is to use XDocument.GetDOM("NameOfWebServiceDOM").selectSingleNode("//REPORTING_MGR_EMPLID"); or something to that effect.

    GetDOM() is used to get a reference to a non-main DOM.

    Does this help?

    Greg Collins [InfoPath MVP]
  • 09-22-2004 10:23 AM In reply to

    Re: Refer to .text value of a bound control

    I got one of my XML buddies to help me. Turns out I should probably invest in XMLSpy (or is there something free out there that will work like XMLSpy??) because I didn't have the XPath correct.

    The correct way to get the value ended up being:

    queryValueManager.text = objwsUser.DOM.selectSingleNode("//EMPLOYEE/@REPORTING_MGR_EMPLID").text

    so you were definitely on's just that the XML itself has attributes and I needed to get down to that level.

    Thanks though!!!

    Gotta go read my XML book now!
  • 09-23-2004 11:23 AM In reply to

    Re: Refer to .text value of a bound control

    XML Spy is definitely useful. They have a free Home Edition, but it lacks the XPath testing capabilities of their $500 Professional version. There are other XPath testers available (try

    You had a learning experience. It is likely you will pay much more attention to whether you are accessing an element or an attribute now. You may do fine in this aspect going forward.

    Glad you got it fixed!

    Greg Collins [InfoPath MVP]
Page 1 of 1 (4 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.