Hi everyone,
I am working on a connector where a table's primary key was changed from index="0" to another column index in <ArrayOptions> (while keeping the existing <ColumnOption idx="..."> order unchanged).
For example, suppose a table (PID 1000) has 4 columns, and the primary key is changed from idx="0" to idx="2":
<ArrayOptions index="2">
<ColumnOption idx="0" pid="1001" type="retrieved" options="" />
<ColumnOption idx="1" pid="1002" type="retrieved" options="" />
<ColumnOption idx="2" pid="1003" type="retrieved" options="" /> <!-- Primary Key -->
<ColumnOption idx="3" pid="1004" type="retrieved" options="" />
</ArrayOptions>
When filling this table using protocol.NotifyProtocol(193 /*NT_FILL_ARRAY*/, new object[] { 1000, true }, tableContent):
What should the tableContent object[] look like so that both the primary key (idx="2", PID 1003) and the column at idx="0" (PID 1001) are populated into their respective columns?
1. If I pass [col1001, col1002, col1003_PK, col1004], NotifyProtocol(193) treats the first element (tableContent[0]) as the primary key (PID 1003), which in the current situation is wrong, as the primary key should be col1003.
2. If I pass [col1003_PK, col1001, col1002, col1004], it also seems incorrect, as the position is wrong right now. (now col1001 is in col1002's position and col1002 is in col1003 position...)
3. Another option will be [col1003_PK, col1001, col1002, col1003_PK, col1004]
I tried the 3rd option, and it seems to work. What is the correct way to fill the table in this situation?
Thanks in advance!
Hi Jason
This question has come up before. Check this out Is it possible to use an ArrayOptions tag with an index different than 0? - DataMiner Dojo
Regards
Hi Tiago,
Thanks for the information. It is kind of contradictory that we have an option to change the primary key to another column, but according to the answer in the other post, it mentioned that the primary key should always be the first column.
To me, this is a check that we are currently missing in our validator.