OL Designer Data Mapper Javascript

Hi,

I need some help to create a javascript on the datamapper to assign codes to different values. I have codes as part of my CSV file but want to display the corresponding values( for each code) on the template

For eg.

Code Values
01 California
02 New Jersey
03 New York
04 Florida
05 Texas

Thank you!

Dear,

Welcome to our OL Forum community.

You could consider to apply something like this:

var states = {
	"01": "California",
	"02": "New Jersey",
	"03": "New York",
	"04": "Florida",
	"05": "Texas"
};
var codeValue = data.extract("CodeValue", 0);
var state = "";

if (codeValue in states) {
	state = states[codeValue];
}

state;