My customer has two folders for hyperlinked documents for one field in a layer. I have added code to IdentifyWidget.mxml as follows:
I have included existing code before and after mine to show where it's placed. (I don't know why it's indented so much here - it isn't in the original file.) The code uses a different linkprefix value depending on a substring in the link field value (the document name).
The problem is that it always uses the path designated for else if. ( I have reversed the code within if and else if to confirm.) In other words, it works for substring2 but not substring1 (or the revese when I have switched their places). I have debugged and seen that substring values are both being read.
I originally used two <link> entries - one for each prefix. But both links showed up and only one worked - if that, probably because the link field was the same for both entries.
Any help is appreciated.
Mark
Code:
//concatenate
if(val != "" && val != "Null"){
linkicon = identLinks[a].iconpre + val + identLinks[a].iconsuf;
}else if(identLinks[a].iconpre != "" || identLinks[a].iconsuf != ""){
linkicon = identLinks[a].iconpre + val + identLinks[a].iconsuf;
};
};
};
//My code
if (title == "Layer Name from XML")
{
if (val != "" && val != "Null")
{
if (val.indexOf("substring1") != -1 )
{
identLinks[a].pre = "http://VirtualDirectoryPath1";
}
else (val.indexOf("substring2") != -1 )
{
identLinks[a].pre = "http://VirtualDirectoryPath2";
}
}
}
//End my code
};
var lObj:Object ={
link: link,
icon: (linkicon == "")?null:linkicon,
alias: alias,
tooltip: ltooltip
};
lyrIdLinks.push(lObj);
The problem is that it always uses the path designated for else if. ( I have reversed the code within if and else if to confirm.) In other words, it works for substring2 but not substring1 (or the revese when I have switched their places). I have debugged and seen that substring values are both being read.
I originally used two <link> entries - one for each prefix. But both links showed up and only one worked - if that, probably because the link field was the same for both entries.
Any help is appreciated.
Mark