Hi Everyone,
Is that possible to store Multi dimensional of a record type?
I have a requirement where i need to store like below
a[1][1]=2,
a[1][2]=3,
something lie this,With CDTs i see it is straight forward but when i am using with record type to save a[1][2]
it is showing below error
.
Am i missing anything?
Can someone please help me on this?
Discussion posts and replies are publicly visible
Hi Hema , Record Types uses "recordtype!" for indexing , Use Index function instead of hard coding. And it seems you are trying to save values at index "2" but length of array is "1"
Hi Venky,
I am not hard coding just as an example I am showing the way I need to store.
By index function we can get the value at a specific index but here I need to store the value at a specific index of multi dimensional array of record type
Sorry I forgot index only returns value . yeah try replacing [1] with record field reference it's working fine for me.
Yes this single dimnesion will work but if i want to store multiple list in the first index it is not working like a[1][1]
A recordtype can be thought of as a map to or an overlay on a database table. So you need to work your way backwards from the table design to the recordtype that maps to it. You could have a a table that has 3 columns. The first column will be the first dimension, the second column the second dimension and the third column the actual value. So example rows for your examples would be:
1, 1, 2
1, 2, 3
If the only attribute you're interested in is 'a' then the whole table could be considered to be a 2-dimensional store for the attribute 'a'.
If you need more attributes you could add another column to store the attribute name in e.g.:
a, 1, 1, 2
a, 1, 2, 3
You could normalize this model and use one table to hold the attribute and the index for the first dimension and then have the second dimension in a separate table and relate the tables using a foreign key.
In short: design your table(s) to meet your needs and then implement your records to map to the tables.
I think this would be the best possible and easiest way to achieve this goal.
Thank You!