Query - InfoPath Dev
in

InfoPath Dev

Query

Last post 10-25-2004 02:01 PM by Greg Collins. 5 replies.
Page 1 of 1 (6 items)
Sort Posts: Previous Next
  • 10-20-2004 12:31 PM

    • BrownR
    • Top 200 Contributor
    • Joined on 08-14-2004
    • USA
    • Posts 54

    Query

    I need to query between 2 text boxs. There both going to have nothing but number in either one. How would i go about doing this? Ive tried to have custom text boxs but i'm not sure how to wuery between the two numbers...
  • 10-20-2004 12:42 PM In reply to

    Please provide more details. I don't understand what you mean by "query between two text boxes".

    Greg Collins [InfoPath MVP]
  • 10-20-2004 12:46 PM In reply to

    • BrownR
    • Top 200 Contributor
    • Joined on 08-14-2004
    • USA
    • Posts 54
    I have a form that i want to retrieve maybe 50- 100 records out of 130,000. each record has a "Case" number. I want to be able to query from a begining case number<text1> to case number <text2>. And have it return the 75-100 records to be amended.
  • 10-21-2004 11:15 AM In reply to

    I'm not much of a SQL person yet, and I'm assuming you are using SQL to store these 130,000 records.

    But it seems to me that if you have the beginning number and ending number for the range you want that you should be able to build your query in code and then call the Query() method to retrieve your records.

    I.E. query = * WHERE CASE >= TEXT1 AND CASE <= TEXT2 (or something to that effect).

    Greg Collins [InfoPath MVP]
  • 10-25-2004 08:28 AM In reply to

    • BrownR
    • Top 200 Contributor
    • Joined on 08-14-2004
    • USA
    • Posts 54
    Heres the code i put behind my search. This takes both numbers that im searching between and displays the records inbetween to be changed.

    function CTRL2_8::OnClick(eventObj)
    {
    // Get the default SQL command for the form.
    var strOrigSQLCommand = XDocument.QueryAdapter.Command;

    var queryCase = XDocument.DOM.selectSingleNode("/dfs:myFields/dfs:queryFields/q:Master");

    var strSearch1 = XDocument.DOM.selectSingleNode("//dfs:myFields/my:Search1").text;
    var strSearch2 = XDocument.DOM.selectSingleNode("//dfs:myFields/my:Search2").text;

    // Ask InfoPath to construct an SQL command that is based on all other field values.
    var strMySQLCommand = XDocument.QueryAdapter.BuildSQLFromXMLNodes(queryCase);

    var strCase = queryCase.selectSingleNode("@Case").text;
    queryCase.selectSingleNode("@Case").text = "";

    // Construct the full query string.
    var strSQLQuery = strOrigSQLCommand;
    strSQLQuery = strSQLQuery + " WHERE ([Case] >= '" + strSearch1 + "') AND ([Case] <='" + strSearch2 + "')";
    var Test = XDocument.DOM.selectSingleNode
    // This is the query.
    //XDocument.UI.Alert(strSQLQuery);

    // Run the query.
    XDocument.QueryAdapter.Command = strSQLQuery;
    XDocument.Query();

    }
  • 10-25-2004 02:01 PM In reply to

    I'm glad you got it working! Thanks for sharing the finished code with us!

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