Multiple Records in Struct

Hi,

I am storing multiple records in a structure and store it in a map just like the code below.

    while(resultSet.next())
    {
        structGroup.value('fld1', resultset.getString(1));
        structGroup.value('fld2', resultset.getString(2));
        structGroup.value('fld3', resultset.getString(3));
        structGroup.value('fld4', resultset.getString(4));

        mapGroup.insert(i, structGroup);
        i++;
    }

And when I tried to get the values in map and assign it to a table, there were no records in the table.

    enumGroup = mapGroup.getEnumerator();

    while(enumGroup.moveNext())
    {
        structGroup = enumGroup.currentValue();

        table1.Field1 = structGroup.value(structGroup.fieldName(1));
        table1.Field2 = structGroup.value(structGroup.fieldName(2));
        table1.Field3 = structGroup.value(structGroup.fieldName(3));
        table1.Field4 = structGroup.value(structGroup.fieldName(4));
        table1.insert();
    }

Need your help guys, thanks in advance.

Use the debug to collect more information. Do you get into the while loop? Does enumGroup.currentValue() return a structure with values? Do you see values in fields before calling insert()? This will tell you which steps fails, so you can focus on the right thing and ignore all remaining, irrelevant code.

And by the way, why are you using a struct at all? As you see, it’s not easy to work with.

I tried to perform multiple assert in my code and error occur.

I’m sorry, but if you don’t tell us what code you used and what error you got, we can’t help you.
Also, I meant using the debugger, not adding into your code.