Here's a snippet that I have used successfully to assign a value to a field in an EDI 810 document:
n104Path = "/*[local-name()='X12_00401_810']" +
"/*[local-name()='N1Loop1'][3]" +
"/*[local-name()='N1']/*[local-name()='N104']";
xpath(Edi810, n104Path) = Response.myField;
Here's another that I have used to extract the value from the same field in an EDI 810 document (there's a difference in the xpath expression, here I'm using the XPath string() function):
// check n104 element (under "ship to")
n104Path = "string(/*[local-name()='X12_00401_810']" +
"/*[local-name()='N1Loop1'][3]" +
"/*[local-name()='N1']/*[local-name()='N104'])";
n104String = (System.String)xpath(Edi810,n104Path);
n104String = n104String.Trim();
I have seen examples that look like the following, but when I try them the string value is just null:
n104Path = "/*[local-name()='X12_00401_810']" +
"/*[local-name()='N1Loop1'][3]" +
"/*[local-name()='N1']/*[local-name()='N104']/text()";
No comments:
Post a Comment