I am still not certain what you want to do here, or what you implemented, but I will try to help as best I can.
What I assume is that you want to display items from a sharepoint list that are filtered by a given ID as parameter in the query string and you want to display these items in an infopath form.
First let me say this is probably not the best use of InfoPath, InfoPath's power really comes into play when you use it for the role of forms, not necessarily the best tool for the query of data, reports etc... It does the job but there are other tools better suited when it comes to quering and filtering data in sharepoint.
So I suggest just for a simple filtering on a page from a querystring field. Create a view for your list that has the fields and look you want. Then on the web page you want to display the data you do the following:
- add the list view webpart for your list
- edit the list view webpart and select your view you just created apply and close the editor pane
- add a querystring filter webpart
- edit the query string web part to use a parameter name that is not ID ID is a key word avoid using it
- give it a default value of something you know will not bring back any results eg 0 apply and close the editor pane
- then in the list view web part , from the web part drop downmenu (at the top right corner of the web part) select connections > Get Filter Values From > (your filter web part just added)
- then map your provider field name to the correct Consumer Field Name ie ID
- save page and you're done
Now if you absolutely have to use InfoPath then the way I would do it in InfoPath is this:
- create your form
- add your secondary data source (which I am guessing is a SharePoint list)
- DO NOT check the checkbox for Store a copy of the data in the form template
- I would also not check the checkbox to automatically retrieve data when the form is opened but that's not required
- add those fields to your view ie map your fields in the repeater control to the correct fields in the added data source
- In the Main datasource add a new field for filtering make sure the type is correct
- Then add a new Action rule to that field you just added
- Make sure the condition is None - Rule runs when field changes
- Add to the rule the action to set a field value
- The field to select is the field you want to filter on under queryFields in the secondary datasource
- Set it's value to be a "." ie the current field you are adding the rule to, (your main datasource field)
- Now add another action to query for data from your recently added connection (secondary datasource)
- Save and publish to your sharepoint server make sure to
- Enable this form to be filled out by using a browser is checked
- Add your new field in the Main datasource as a field that will be available as a SharePoint Web Part connection parameter.
Now edit your sharepoint web part page that you want to use to display the form be sure to:
- Add the infopath form web part to the page
- edit the web part to select your recently published infopath document apply and close the editor pane.
- add a querystring filter webpart
- edit the query string web part to use a parameter name that is not ID ID is a key word avoid using it
- give it a default value of something you know will not bring back any results eg 0 apply and close the editor pane
- now in the infopath form web part , from the web part drop downmenu (at the top right corner of the web part) select connections > Get Data From > (your filter web part just added)
- then map your provider field name to the correct Consumer Field Name ie the field added in the infopath form
- save page and you're done
Now you should be able to filter via the query string and not get back values when there is no query string parameter.