Hi, you have to use some logic called "Becker's method", attributed to Oliver Becker, which looks like this:
concat(
substring($s1, 1, number($condition) * string-length($s1)),
substring($s2, 1, number(not($condition)) * string-length($s2))
)
Which then has to be wrapped into the familiar 'double eval' expression in Infopath for it to work.
Here is an expression I've used previously that ONLY works if one of the input expressions IS Blank (IT WILL NOT WORK IF BOTH EXPRESSIONS CONTAIN DATA!):
xdMath:Eval(xdMath:Eval(../my:FirstArgument, 'concat(substring(../my:FirstArgument, 1, ../my:FirstArgument * string-length(../my:FirstArgument)), substring(../my:SecondArgument, 1, (string-length(../my:SecondArgument) > 1) * string-length(../my:SecondArgument)))'), "..")
So, assuming your field expressions are correct, substituting FirstArgument and SecondArgument with your field expressions and your expression should look something like:
xdMath:Eval(xdMath:Eval(xdXDocument:GetDOM("IMA Tasks Team 1")/dfs:myFields/dfs:dataFields/d:SharePointListItem_RW/d:ID[../d:Title = current()], 'concat(substring(xdXDocument:GetDOM("IMA Tasks Team 1")/dfs:myFields/dfs:dataFields/d:SharePointListItem_RW/d:ID[../d:Title = current()], 1, xdXDocument:GetDOM("IMA Tasks Team 1")/dfs:myFields/dfs:dataFields/d:SharePointListItem_RW/d:ID[../d:Title = current()] * string-length(xdXDocument:GetDOM("IMA Tasks Team 1")/dfs:myFields/dfs:dataFields/d:SharePointListItem_RW/d:ID[../d:Title = current()])), substring(xdXDocument:GetDOM("BSD Second Task List")/dfs:myFields/dfs:dataFields/d:SharePointListItem_RW/d:ID[../d:Title = current()], 1, (string-length(xdXDocument:GetDOM("BSD Second Task List")/dfs:myFields/dfs:dataFields/d:SharePointListItem_RW/d:ID[../d:Title = current()]) > 1) * string-length(xdXDocument:GetDOM("BSD Second Task List")/dfs:myFields/dfs:dataFields/d:SharePointListItem_RW/d:ID[../d:Title = current()])))'), "..")
Maybe my XPath is wrong, but I hope you understand what is supposed to happen. If your first field expression returns an ID it will be returned, if your second field expression returns and ID it will be returned.
Hope this helps
Cheers