Create record structure within CTL2 code

Hi,

I am trying to find the way to create record type within CTL2. Currently, we have following record structure in Ab Initio :

record
decimal(10) abc;
decimal(10) xyz;
end [int] test = allocate;

Here we want to have vector data type with each element being the record type having two decimal fields.

Is this achievable in CTL2. Please help

Please let me know if there is any workaround to create such kind of structure using CTL2.

Hi

If the record type means what we call metadata then it is not possible. You can do it by creating metadata by wizard in the Designer and use it to define a record in CTL2. Also it is not possible to create your own data type (vector), but you may try to use a map data type instead. It is capable to hold two variables (key and value). The value can be any of the primitive data types and the key has to be a string, but you can convert decimal to string and vice versa by toString() and str2decimal() functions of CTL2. I have attached a graph where the use is shown.

And if you find this solution not sufficient, there is also another way. You could split the data stream into two. The metadata for the first one will consist of those two decimals (abc, xyz), integer list and some ID. The metadata for the second one will contain two decimals and ID and it will represent the vector. They will flow separately through the graph and once there is need you can simply join them by the ID.

It’s up to you which solution would suit you better.

Also parts of this documentation could be useful for your issue.

I hope this will help you
Best regards