Hola, he intentado acceder al valor de uno de los elementos de un Array donde se guarda el resultado de una consulta, sin exito alguno. El código es el siguiente:
Código:
function ObtieneTasasdeSubGiros(GuidsubGiro) {
var DatosGiros = new Array();
var fetchXml = '<fetch mapping="logical" count="50">';
fetchXml += ' <entity name="pt_subgiro">';
fetchXml += ' <attribute name="pt_nombre" />';
fetchXml += ' <filter>';
fetchXml += ' <condition attribute="pt_subgiroid" operator="eq" value="';
fetchXml += GuidsubGiro;
fetchXml += '" />';
fetchXml += ' </filter>';
fetchXml += ' <link-entity name="pt_subindustriaaquirente" from="pt_subindustriaaquirenteid" to="pt_subindustriaid">';
fetchXml += ' <attribute name="pt_mcc" />';
fetchXml += ' <attribute name="pt_subindustriaaquirenteid" />';
fetchXml += ' <attribute name="pt_nombre" />';
fetchXml += ' </link-entity>';
fetchXml += ' </entity>';
fetchXml += '</fetch>';
var FetchResult = Fetch(fetchXml);
//alert(FetchResult.selectSingleNode("//result").text);
var lookupData = new Object();
var lookupRef = new Array();
if (FetchResult.selectSingleNode("//result") != null)// Si devolvio algun resultado lo imprime
{
DatosGiros[0] = FetchResult.selectSingleNode("//pt_nombre").text; // Nombre del Subgiro
DatosGiros[1] = FetchResult.selectSingleNode("//pt_subindustriaid.pt_mcc").text;
DatosGiros[2] = FetchResult.selectSingleNode("//pt_subindustriaid.pt_nombre").text; // Nombre de la industria
}
return DatosGiros;
Concretamente necesito sacar el valor por separado de pt_nombre y pt_subindustriaid. No habia trabajado antes con objetos de XML.