Hi all,
Is there a way in Javascript and ESRI's api to get the fullname column from my Feature layer's column, transform the full names into initials and render it in a marker that would have people's initials?
Thanks,
Alex
Solved! Go to Solution.
Alex,
Sure once you have the name value from the attribute just split the string based on " " (spaces) and then get the first letter using .substring(1, 1); and save that to a new string to concatenate with the other first letters and then use a TextSymbol
Alex,
Sure once you have the name value from the attribute just split the string based on " " (spaces) and then get the first letter using .substring(1, 1); and save that to a new string to concatenate with the other first letters and then use a TextSymbol
I am now getting the initials in a variable but at the end of the loop I get an error:
Here is my code:
queryTaskauto.execute(queryauto, function (results) {
arrayUtil.forEach(results.features, function(value, index){
var arraynew = value.attributes.f3;
var words = arraynew.split(' ');
var text = '';
$.each(words, function () {
text += this.substring(0, 1);
});
console.log(text);
console.log(words);
});
Any idea?
This worked:
if (arraynew === null){
console.log("Dont split");
} else {
var words = arraynew.split(' ');
var text = '';
$.each(words, function () {
text += this.substring(0, 1);
});
console.log(text);
console.log(words);
}