Question: I am writing an ETL in kettle pentaho to create a table from various sources including google analytics.

so **Table 1** = All data from website joined to google analytics information
 **Table 2** = All Duplicate data from Table 1 joined to google analytics information

my problem is that some info on table 1 has the google analytics information missing but table 2 shows some data for Google Analytics on the same reference\_number

So what I want to do is lookup [reference\_number] from table 1 to table 2 and populate table 1 where some columns are null from info on table 2

Quick example EDIT\*

```
Table 1 (Main Table) * *This table has an index built in on website_reference number (Unique)*
  website_Reference_number   GA_info_1   GA_info_2 
  A1              null       null
  A2               x           y

Table 2 (Duplicates from Table 1)           
  eventlabel   GA_info_1   GA_info_2
  A1               z            z
  A2               x            y

```

my **output** should be the following

```
Table 1 (Main Table)
Ref_number   GA_info_1   GA_info_2 
A1               z            z
A2               x            y

```

I am using a My\_SQL database

Answer: 
You could use the [filter](http://www.w3schools.com/jsref/jsref_filter.asp) method, as the following:

```
var filteredArray = classes.filter(function(value) {
   return value.level == 4;
));

```

After it, if you want to *pluck* only the name of those items you can do the following:

```
var names = filteredArray.map(function(obj) {
  return obj.name;
}

```

If you are going to do this often, you could write a function that abstracts away the map, this way:

```
function pluck(array, key) {
  return array.map(function(item) {
    return item[key]; 
  }); 
}

```
I think, you overwrite you param "name"

```
info['name']= classes[i].name;

```

If you want collection, you should 

```
var info = [];
info.push(classes[i].name)

```