Getting node data w/in node template

I’m trying to get node data or rather model data from w/in the node template.

in the template, i’m calling a function that returns a picture.
depending on the value passed to this function will determine what picture is returned.

passing static data for testing proved this logic and works.

but i need the actual data from the node to be passed to this function. how should i go about doing this?

i have tried new go.Binding(“text”, “YQN”) but this passes nothing for the level

i even tried passing:
$(go.TextBlock, //YQN
{ row:1, column: 0, font: “9pt sans-serif”, stroke: “black” },
new go.Binding(“text”, “YQN”)).text
but this resulted in an empty string being passed

my code looks like this:
…template
getLevelPicture(“Y”, 1, 0),
…template

function getLevelPicture(level, row, column){
var returnValue;
//create level pictures
var level1 = $(go.Picture, { source: “images/1level.gif”} );
var level2 = $(go.Picture, { source: “images/2level.gif”} );
var level3 = $(go.Picture, { source: “images/3level.gif”} );
var level4 = $(go.Picture, { source: “images/4level.gif”} );
var level5 = $(go.Picture, { source: “images/5level.gif”} );
var level6 = $(go.Picture, { source: “images/6level.gif”} );
var levelY = $(go.Picture, { source: “images/Ylevel.gif”} );
var levelQ = $(go.Picture, { source: “images/Qlevel.gif”} );
var levelN = $(go.Picture, { source: “images/Nlevel.gif”} );
var levelBlank = $(go.Picture, { source: “images/nolevel.gif”} );

if(level == "1"){
    returnValue = level1;
} else if(level == "2"){
    returnValue = level2;
} else if(level == "3"){
    returnValue = level3;
} else if(level == "4"){
    returnValue = level4;
} else if(level == "5"){
    returnValue = level5;
} else if(level == "6"){
    returnValue = level6;
} else if(level == "Y"){
    returnValue = levelY;
} else if(level == "Q"){
    returnValue = levelQ;
} else if(level == "N"){
    returnValue = levelN;
} else if(level == ""){
    returnValue = levelBlank;
} else if(level == " "){
    returnValue = levelBlank;
} else if(level == "-"){
    returnValue = levelBlank;
}

returnValue.row = row;
returnValue.column = column;

return returnValue;

}

thanks for the help

Instead of trying to substitute a whole go.Picture, why not just parameterize the Picture.source property? That’s what the samples do.

You can even use a converter function to convert the data property value to a URI, as the http://gojs.net/latest/samples/beatPaths.html sample does. See how the convertKeyImage function is used and defined in that sample.

Walter,
thank you for pointing me to that sample and function.
this worked perfectly and does exactly what i need it to.

thanks for the help