Having seen your form now, I'll paste in part of the reply I sent in email:
I understand a bit better now what you are trying to do – use a formula as a default value in XML that is a secondary data source. The problem is that InfoPath is not going to process that as a formula (as you’ve seen).
Instead, yes, I believe you could use SetValue for this.
You'd want to add a rule on the Qdabra Rules data source finishedLoading node (with the condition that finishedLoading = true).
That rule should set the Qdabra Rules data source Command field. Use a formula (that is, click the fx button next to the value field) and use a concat statement to create the SetValue command. You'll need to use a filtered XPath for the field you want to set (which is the main reason we created SetValue) and then another concat statement to create the value. You'll also need to include the dsname parameter to set the value in a secondary data source.