export multi-instance scriptlet counters

I have a multi-instance flow to verify ssh connections, on failure I need to count the different type of hosts. Host type is retrieved from a database and has 4 different values. I'm using scriptlet code to count the different types by this

flag = new java.lang.String (scriptletContext.get('dbflag');

if (flag.equals('type1') {

    aNumber = scriptletContext.get('cnt_t1');

    if (aNumber != null)

         aNumber ;


        aNumber = 1;

    scriptletContext.put('cnt_t1', aNumber.toString());

} else if (flag.equals('type2') ...


My problem is I'm not able to get the local flow variables cnt_t1, cnt_t2,.. to the environment outside the multi-instance.


I found some documentation in HPOO studio guide that suggested a scriptlet in the multi-instance step to do

v = scriptletContext.get('cnt_t1');

scriptletContext.putGlobal('all_t1', scriptletContext.get('all_t1') v);


However the global flow variable is not incremented, and has it's initial value.