Code to get the Data Type for a Data Source - InfoPath Dev
in

InfoPath Dev

Code to get the Data Type for a Data Source

Last post 05-05-2007 08:43 PM by Matt Faus. 1 replies.
Page 1 of 1 (2 items)
Sort Posts: Previous Next
  • 08-11-2006 08:45 AM

    Code to get the Data Type for a Data Source

    (This is a duplicate of a topic I accidentally posted on the Newbie forum.)

    Using VB.Net, how can I get Data Type of a Data Source.
    It looks like I can do it with the code below, which I adapted from a post on this forum. But for data types other than "string" (boolean, date, etc.), the "node.datatype" returns a null.

    Dim nl As IXMLDOMNodeList
    Dim node As IXMLDOMNode
    Dim str As String
    Dim intCount As Integer
    nl = thisXDocument.DOM.selectNodes("/my:myFields/descendant::*")
    str = "'"
    intCount = 0
    Do While (True)
    ' MsgBox("Doing: nl.nextNode")
    node = nl.nextNode()
    If (IsDBNull(node)) Then
    Exit Do
    End If
    intCount = intCount + 1

    'str += node.xml
    'str += node.text
    If (InStr(node.nodeName, "group") = 0) Then
    str = str & node.nodeName & _
    "-" & node.nodeType & _
    "-" & node.nodeTypeString & _
    "-" & node.dataType & _
    "-" & node.nodeTypedValue & _
    "-" & node.text & vbCrLf
    If (intCount > 50) Then
    Exit Do
    End If
    End If
    Loop

    'XDocument.DOM.selectSingleNode( "//my:field7" ).text = str;
    MsgBox(str)
  • 05-05-2007 08:43 PM In reply to

    Re: Code to get the Data Type for a Data Source

    Hi mfrumer,

    If you have the node in the Data Source taskpane you can discover the dataType by just double-clicking and viewing the properties. Am I missing something?
    Matt Faus / Microsoft InfoPath MVP
    Qdabra® Software / Streamline data gathering to turn process into knowledge
Page 1 of 1 (2 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.