VBScript to read data from data connection - InfoPath Dev
in

InfoPath Dev

Use our Google Custom Search for best site search results.

VBScript to read data from data connection

Last post 07-13-2011 05:39 AM by VitaKri. 0 replies.
Page 1 of 1 (1 items)
Sort Posts: Previous Next
  • 07-13-2011 05:39 AM

    VBScript to read data from data connection

    I am new to InfoPath. I am using 2003 version.

    I need to create button on my form with code in VBScript for: reading data from some data connection (some library on Sharepoint) and take Maximum value from some field.

    I don't know how to do in VBScript link on this field.

    I am able create Combobox (or Listbox) in Form, where I see this data from this connection (data connection has name: CislaZN, value for Combobox is (taken from external source data): /dfs:myFields/dfs:dataFields/dfs:ZlepsovaciNavrhy/@Cislo_ZN

    I tried to do it by dataField, but then I am not able go on next record or I don't know how to do it (I tried do it the same as in repeating field by [], but here I take error that record [2] doesnt exist). Code on button is:

     

    Sub CTRL56_5_OnClick(eventObj)

    Dim Pom, I, Number, Max

    I=1

    ' We take first record - it is ok

    Pom="/my:ZlepsovakyForm/my:Hlavicka/my:CislaZN["+cstr(I)+"]"

    Number=XDocument.DOM.selectSingleNode(Pom).text

    Max=Number

    do while Number<>""

       ' We take second record - problem = doesn't exist (how to take second record?)

       I=+1

       Pom="/my:ZlepsovakyForm/my:Hlavicka/my:CislaZN["+cstr(I)+"]"

       Number=XDocument.DOM.selectSingleNode(Pom).text '

       if Number>Max then Max=Number

    loop

    XDocument.DOM.selectSingleNode("/my:ZlepsovakyForm/my:Hlavicka/my:CisloZN").text=Max

    End Sub

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