R
Ravi
Hi All:
I want to write a script to do name mapping. The argument "internal" is
the name to be mapped and the return value is the mapped name i.e. if
"apple" is the input "Xapple" is the output. However the argument may
not have an entry in the associative array. for e.g. if the argument is
"strawberry" the output should be "strawberry" as there is no mapping
for "strawberry". I wrote the following script but it does not work.
function GetExternal(internal)
{
var my_cars= new Array()
my_cars["apple"]="Xapple";
my_cars["peach"]="Xpeach";
my_cars["orange"]="Xorange";
my_cars["banana"]="Xbanana";
my_cars["plum"]="Xplum";
if(my_cars[internal]!="")
return my_cars[internal];
else
return internal;
}
Can someone kindly point out what might be wrong?
TIA.
I want to write a script to do name mapping. The argument "internal" is
the name to be mapped and the return value is the mapped name i.e. if
"apple" is the input "Xapple" is the output. However the argument may
not have an entry in the associative array. for e.g. if the argument is
"strawberry" the output should be "strawberry" as there is no mapping
for "strawberry". I wrote the following script but it does not work.
function GetExternal(internal)
{
var my_cars= new Array()
my_cars["apple"]="Xapple";
my_cars["peach"]="Xpeach";
my_cars["orange"]="Xorange";
my_cars["banana"]="Xbanana";
my_cars["plum"]="Xplum";
if(my_cars[internal]!="")
return my_cars[internal];
else
return internal;
}
Can someone kindly point out what might be wrong?
TIA.