2

UPDATE:

I initially agreed that the answer provided in the "duplicate" question helped, but it didn't. This isn't a duplicate question because I am trying to convert the string into a column name to use with d as in using dynamic and multiple data. The answer provided still uses a string and references data statically as in Data[0]["myString"] but what I am looking for is d.MyColumnWhichUsedToBeAString

ORIGINAL:

I would like to take a string from an array and then use that value to find the corresponding csv data.

Is this possible? If so, how:

Example:

//Ultimately, I want to return d.one

var myArray = ["one", "two", "three"}

//Is there a a way to get d.one from the array. For example

d.myArray[0]
auto
  • 1,062
  • 2
  • 17
  • 41

1 Answers1

1

In Javascript you need to use the [] property accessor syntax for variable index names:

var theValue = d[myArray[0]]
Sebastian
  • 7,729
  • 2
  • 37
  • 69