Sort structure data by JavaScript

dohproject's picture

Hi, I am a Quartz Composer beginner.

I import a CSV file from "CSV 2 Structure" plugin, but I found the data index are wrong.

So I want to sort it by JavaScript.

The data is like this:

0: "2000" = string

1: "1999" = string

2: "2002" = string

3: "2001" = string

So I create a JavaScript object, but I have no idea how can I do.

The code is like this:

function (__structure output) main (__structure input)

{

var result = new Object();

return result;

}

I guess the CSV structure is a object like Dictionary.

I imagined the code is:

Array keys = input.allKeys();

keys.sort();

Array result = new result[input.count];

for (int i = 0 -> input.count)

{

result[i] = input[keys[i]];

}

But whatever the method name I try, the compiler always return "TypeError:null is not an object".

The compiler of Quartz Composer don't have method suggest, I don't know what the method I can use.

So, can anyone help me?