Record count in a data connection... - InfoPath Dev
in

InfoPath Dev

Record count in a data connection...

Last post 04-20-2006 09:15 AM by Karsten Brocksieper. 2 replies.
Page 1 of 1 (3 items)
Sort Posts: Previous Next
  • 03-30-2006 10:05 AM

    Record count in a data connection...

    Hello,

    I have the following code in an "AfterUpdate" event:

    function msoxd_my_cboProdukttyp::OnAfterChange(eventObj)
    {
    var IDProdukttyp = XDocument.DOM.selectSingleNode("//my:cboProdukttyp");

    var adoDataAdapter = XDocument.DataObjects["vReportWebWarenkorb"].QueryAdapter;
    adoDataAdapter.Command = "Select * From vReportWebWarenkorb Where ptID = " + IDProdukttyp.text + " Order by Produkt";
    adoDataAdapter.Query();

    if (eventObj.IsUndoRedo)
    {
    return;
    }

    }
    Is there an easy way to get the recordcount of the "Select" statement?

    Thank you very much for any help.
    Karsten
  • 03-30-2006 05:40 PM In reply to

    Re: Record count in a data connection...

    I think you should be able to do this:

    var recordCount = XDocument.GetDOM( "vReportWebWarenkorb" ).selectNodes( "XPath/To/Nodes" ).length;

    If it gives you an error about namespaces, you will need to setup a reference to the DOM before calling selectNodes() and make sure to use the .setProperty() to add the namespace prefixes.

    Hope this helps!
    Matt Faus / Microsoft InfoPath MVP
    Qdabra® Software / Streamline data gathering to turn process into knowledge
  • 04-20-2006 09:15 AM In reply to

    Re: Record count in a data connection...

    Hello,

    ...for anyone who is interested in...

    In the meantime I have found a way to count any nodes regardless if they are in a primary or a secondary data source.
    And it´s really easy. You just can take an 'expression box' control.
    Within this expression box use the 'count' function of XSD.
    For example if you want to count the elements of a repeating table the expression looks like:

    count(my:groupname/my:fieldname)
    With this you can also count records of a secondary data source even with filter conditions.

    Hope this helps anyone
    Karsten
Page 1 of 1 (3 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.