I've tried it but result of the Hash function is empty. This is what I can see in output:
"result" => [ [ 0] {}, [ 1] {}, [ 2] {}, [ 3] {}, [ 4] {}, [ 5] {}, [ 6] {}, [ 7] {}, [ 8] {}, [ 9] {}, [10] {}, [11] {}, [12] {}, [13] {}, [14] {}, [15] {}, [16] {}, [17] {}, [18] {}, [19] {} ]
The hash value seem to be OK. When I've added event['result_without_hash']<<[values]
this was the result:
"result_without_hash=> [ [ 0] [ [0] [ [0] "Offset(V)", [1] 33333738026449876432 ] ], [ 1] [ [0] [ [0] "Name", [1] "System" ] ], ...
Do you know why the result of Hash[values]
is empty?
I've tried to achieve something similar with this ruby script and it was working:
event['processes'] = event['rows'].collect.collect { |process| { event['columns'][0]=>process[0], event['columns'][1]=>process[1], event['columns'][2]=>process[2], event['columns'][3]=>process[3] } }
You can see the resulting "processes" object in my previous post. The problem is that I had to use indexes 0, 1, 2 etc. to access the field elements. The better option would be to use for loop and use loop variable as index like this, but it is not working:
event['processes'] = event['rows'].collect.collect { |process| { for i in 0..9 event['columns'][i]=>process[i] end } }
Is there any possibility how to iterate through the arrays using index?