Done. I found a different post that helped me put the value into the correct row of the repeating table. I posted the completed code below for anyone else.
function
msoxd__SR_Materials_cs2ID_attr::OnAfterChange(eventObj)
{
// Write code
here to restore the global state.
if (eventObj.IsUndoRedo)
{
// An undo or redo
operation has occurred and the DOM is read-only.
return;
}
var objXMLNodes =
XDocument.View.GetSelectedNodes();
var sID;
if (objXMLNodes.Count > 0)
{
sID = objXMLNodes(0).text; //Grab the value of
the selected dropdown
if (sID == "") //Check for actual value before querying
{
return;
}
//Get to the DOM
var doc =
XDocument.DataObjects("Contract_Sub_Categories2_DC").DOM;
//Add the namespaces for the
secondary data source
doc.setProperty("SelectionNamespaces", "xmlns:d='http://schemas.microsoft.com/office/infopath/2003/ado/dataFields'
xmlns:dfs='http://schemas.microsoft.com/office/infopath/2003/dataFormSolution'");
//Find the node in the
secondary data source
var selectedNode =
doc.selectSingleNode("//dfs:myFields/dfs:dataFields/d:Contract_Sub_Categories2[@cs2ID="
+ sID + "]")
//Grab the value from the node
var struom =
selectedNode.attributes.getNamedItem("cs2UOM").text;
//Put the value on the form
eventObj.Site.selectSingleNode("../@uomCode").text
= struom;
}
}