Matt,
Thanks for the advice. That might work if I were using a secondary data souce but I'm working with the primary data source.
For all those like me who searched through posting after posting throughout the many sources here's what worked...
After getting some pointers from our web developer on how to debug my code I came up with the following...
function modQuery::OnClick(eventObj)
{
// Retrieve the field in the InfoPath form whose value will be used in the
//WHERE clause
var node = XDocument.DOM.selectSingleNode("/dfs:myFields/my:trueText").text;
// Retrieve and store the SQL statement of the main data source
var strSQL = XDocument.QueryAdapter.Command;
// Generate the new SQL statement with WHERE clause
// Populate the command with the new SQL statement
XDocument.QueryAdapter.Command = strSQL + " where [praxaResponseOpen] = " + node;
//Run the query
XDocument.Query();
//Reset SQL Query statement to origonal string of the main data source
XDocument.QueryAdapter.Command = strSQL
}
I've fully tested this and it works perfectly. I later realized this could also be done with a set of rules....
1) Set a fields value: @praxaResponseOpen (from the query fields) = trueText (trueText="True" which is its default value)
2) Query using a data connection: (select your main data source connection)
This returned all records with my selected field set to the value I was looking for. What can I say...I'm an old school programmer who likes to see whats going on so I'm not used to thinking in a gui environment. This was just too easy to even occur to me.
Since I'm using this as a check to clear any flags (boolean variables) that may still be set in the database I went on with the following rules...
3) Set a fields value: @praxaResponseOpen (from the data fields) = falseText
(falseText="False" by default so this field is set to false in all records returned by the query)
4) Submit using a data connection: (select your main data source)
5) Set a fields valus: @praxaResponseOpen (from the query fields) = "" (clear the query field set earlier)
Maybe this will prevent the next person from spending a week tracking down a resolution for a similar problem...