# Create record structure within CTL2 code

**URL:** <https://forum.cloverdx.com/t/create-record-structure-within-ctl2-code/1671>\
**Category:** CloverDX Platform\
**Created:** [September 16, 2015, 12:00am UTC](https://forum.cloverdx.com/t/create-record-structure-within-ctl2-code/1671 "2015-09-16T00:00:00Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![etl\_1234](https://avatars.discourse-cdn.com/v4/letter/e/ac91a4/32.png) [@etl\_1234](https://forum.cloverdx.com/u/etl_1234)\
**Post date:** [September 16, 2015, 12:00am UTC](https://forum.cloverdx.com/t/create-record-structure-within-ctl2-code/1671/1 "2015-09-16T00:00:00Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![etl\_1234](https://avatars.discourse-cdn.com/v4/letter/e/ac91a4/32.png) [@etl\_1234](https://forum.cloverdx.com/u/etl_1234)\
**Post date:** [September 18, 2015, 12:50pm UTC](https://forum.cloverdx.com/t/create-record-structure-within-ctl2-code/1671/2 "2015-09-18T12:50:08Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Lukas\_Cholasta](https://yyz1.discourse-cdn.com/flex007/user_avatar/forum.cloverdx.com/lukas_cholasta/32/166_2.png) [@Lukas\_Cholasta](https://forum.cloverdx.com/u/Lukas_Cholasta)\
**Post date:** [September 23, 2015, 1:30pm UTC](https://forum.cloverdx.com/t/create-record-structure-within-ctl2-code/1671/3 "2015-09-23T13:30:34Z")

</div>

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](http://doc.cloveretl.com/documentation/UserGuide/index.jsp?topic=/com.cloveretl.gui.docs/docs/part-tl.html) could be useful for your issue.

I hope this will help you  
Best regards

- [records\_test.grf](https://cdn.cloverdx.com/forum/18108%5F049e981c9084352fad10e3ff656e53af/records%5Ftest.grf)

---

<div class="post-metadata">

**Author:** ![David\_Pavlis2](https://avatars.discourse-cdn.com/v4/letter/d/5e9695/32.png) [@David\_Pavlis2](https://forum.cloverdx.com/u/David_Pavlis2)\
**Post date:** [August 27, 2025, 7:40pm UTC](https://forum.cloverdx.com/t/create-record-structure-within-ctl2-code/1671/4 "2025-08-27T19:40:57Z")

</div>

Since CloverDX version 5.6 new data types are supported in CTL2 language.

One of the flexible types is **variant** , which is capable of storing JSON-like data.

[See more details in CTL documentation.](https://doc.cloverdx.com/latest/developer/language-reference-ctl2.html#id_ctl2_variant).
