Hi Community,
I'm having issues with the method GetPrimaryKeys from the IDmsTable. I'm trying to retrieve the primary keys from the table but I keep getting 0 as the output. I'm not sure if that it is intended use of the method or am I mistaken. Workaround that I did was to call GetData from the IDmsTable which then returned the primary keys correctly.
Thanks.
Hi Geovanny, I cannot put screenshot in the comment on your comment, so I'll start a new comment section. I'm trying to do it through the automation script. This is the way I was trying to do it:
The first approach is the one that is working and actually getting me the primary keys, while the second one is the one I have troubles with. I'm not sure what I could be doing wrong here.
Thanks.
Already did all of that before asking here, I was getting back the correct table and the ID of the table. Also, in regards to the .First();, it is working fine in the above method in the screenshot, so really there is no reason for it not to work few lines below. For the dataminer version, it is 10.4.7.0-14517. Thanks!
Hi Amar,
Could you post a screenshot of your code to see how you are doing it?
Also are you doing this from inside a connector or an automation script?
Regardless no matter from where you are doing it the GetPrimaryKeys() should be returning a string[] with the keys of that table. As long as that table has rows. I'm assuming there is something wrong with your set up of the Idms object.
I just did a small test and for me this code does return the primary keys.
IDms thisDms = engine.GetDms();
var element = thisDms.GetElement(“Dummy 1″);
var table = element.GetTable(100);
var keys = table.GetPrimaryKeys();
engine.GenerateInformation($”Length of keys {keys.Length}”);
In cube information event
Length of keys 10 (Script ‘AutomationScript1’)
Can you check that your elements.First() does have a reference to the element that you are trying to manipulate. Maybe print the element name in a information event, after that i would check the TablePID to make sure its the correct one.
Also what version of dataminer are you using?