It is possible - but can be a little tricky. Since you are using a repeating table bound to the secondary data source, as long as you are willing to submit one row at a time (i.e. put a Save button in the repeating table) and as long as you aren't on Office 365 (which restricts some SharePoint web service data connections) you can use CAML. Here's a long thread on that - http://www.infopathdev.com/forums/t/12872.aspx
For your second question, you may need to repurpose some fields you aren't using in your secondary ds as "helper" fields. Like, you may not be displaying or using Version, or ID - you could add rules to the ID field to set the Version field to the URL value you need, and on load, after your data sources are queried, set ID to "0" (since it won't ever be 0, this changes the field and fires your rules). Then your link (under Insert > Hyperlink) can use that repurposed Version field for the "Link" field. Hope that makes sense...