Extract a integer from an array based in field values

Hello...

I am trying to extract a forex rate from an array based on the year and month fields. I have a array which is like this:

// forexRate =>
// 2017;7;0.0001105093, 2017;8;0.0001116904, 2017;9;0.0001114438, 2017;10;0.0001118130, 2017;11;0.0001110309, 2017;12;0.0001111167, 2018;1;0.0001111290, 2018;2;0.0001113834, 2018;3;0.0001113524;

I have already fields of integer for year and month which are:

// year => 2017
// month => 9

I want to user the year and month to pick the third value

//      grok {
//             match => [ "forexRate" , "%[year];%[month];%{NUMBER:rate}" ]
//             add_field => [ "reportRate" , "%{rate}" ]
//        }

Then use the rate to calculate a newCurrency

// ruby {
      code => 'event.set("newCurrency", event.get("numberCount").to_i * 1 * [rate])
         }

How can I use the fields year and month to pick the third value in the array??

If you use

output { stdout { codec => rubydebug } }

what does the array look like?

Sorry, can't get that to work...

I found an answer from you on a different thread:

code => '
            event.get("[metadata][dtab]").each_with_index do |hash, index|
                event.set("[tire][#{index}]", hash)
            end
        '

No I have each entry from the array as separated fields...

Looking how to loop through all fields into grok match...

Cheers