Skip to content
DataMiner DoJo

More results...

Generic selectors
Exact matches only
Search in title
Search in content
Post Type Selectors
Search in posts
Search in pages
Search in posts
Search in pages
Log in
Menu
  • Blog
  • Questions
  • Learning
    • E-learning Courses
    • Open Classroom Training
    • Certification
      • DataMiner Fundamentals
      • DataMiner Configurator
      • DataMiner Automation
      • Scripts & Connectors Developer: HTTP Basics
      • Scripts & Connectors Developer: SNMP Basics
      • Visual Overview – Level 1
      • Verify a certificate
    • Tutorials
    • Video Library
    • Books We Like
    • >> Go to DataMiner Docs
  • Expert Center
    • Solutions & Use Cases
      • Solutions
      • Use Case Library
    • Markets & Industries
      • Media production
      • Government & defense
      • Content distribution
      • Service providers
      • Partners
      • OSS/BSS
    • DataMiner Insights
      • Security
      • Integration Studio
      • System Architecture
      • DataMiner Releases & Updates
      • DataMiner Apps
    • Agile
      • Agile Webspace
      • Everything Agile
        • The Agile Manifesto
        • Best Practices
        • Retro Recipes
      • Methodologies
        • The Scrum Framework
        • Kanban
        • Extreme Programming
      • Roles
        • The Product Owner
        • The Agile Coach
        • The Quality & UX Coach (QX)
    • DataMiner DevOps Professional Program
  • Downloads
  • More
    • Feature Suggestions
    • Climb the leaderboard!
    • Swag Shop
    • Contact
      • General Inquiries
      • DataMiner DevOps Support
      • Commercial Requests
    • Global Feedback Survey
  • PARTNERS
    • All Partners
    • Technology Partners
    • Strategic Partner Program
    • Deal Registration
  • >> Go to dataminer.services

GetParameterIndexByKey issue in C#

368 views13th February 2025
1
Dominique Bodart [DevOps Member]693 13th February 2025 0 Comments

Hi,

In a QAction in C#, I try to retrieve a value in a table ID 1000. The parameter is a string called "Subscription ID" and is also the IDX of the table. I use the following command to proceed in a "for {}" loop:

for (int i = 1;i <= row ; i++)
{

string sI = i.ToString();
subscription_ID = Convert.ToString(protocol.GetParameterIndexByKey(1000, sI, 1));

...}

The table is 35 row length but for each of them I receive the following error message:

NT_GET_PARAMETER_INDEX for 1000/1/1 failed. 0x80040221
NT_GET_PARAMETER_INDEX for 1000/2/1 failed. 0x80040221

etc ...

Here follows the header of the table:

<Param id="1000" trending="true">
<Name>Remotes Status</Name>
<Description>Remotes Status</Description>
<Type>array</Type>
<ArrayOptions index="0">
<ColumnOption idx="0" pid="1001" type="retrieved" value="" options="" />
<ColumnOption idx="1" pid="1002" type="r ....

I use the same method to retrieve parameter from another table and it works correctly. Both tables are filled with data. So why would it work fine with one table but not with another?

I will be very grateful for any idea:)

Dominique Bodart [DevOps Member] Answered question 13th February 2025

2 Answers

  • Active
  • Voted
  • Newest
  • Oldest
0
Michiel Oda [SLC] [DevOps Enabler]3.58K Posted 13th February 2025 8 Comments

Hi Dominique

Instead of retrieving cell by cell, you can retrieve the entire column at once with the following call: NT_GET_TABLE_COLUMNS (321) | DataMiner Docs

When using DIS there is also a snippet for this call. This way you reduce the amount of protocol calls (performance) and you get the data all at once.

EDIT: I've included a small code example how to retrieve the PK & the column that contains the subscription ID (you'll have to change it to the matching names from your protocol).

var columnIndexes = new uint[] { Parameter.RemotesStatus.indexColumn, Parameter.RemotesStatus.Idx.remotesStatusSubscriptionId };
var columns = (object[])protocol.NotifyProtocol((int)SLNetMessages.NotifyType.NT_GET_TABLE_COLUMNS, Parameter.RemotesStatus.tablePid, columnIndexes);

var keys = (object[])columns[0];
var values = (object[])columns[1];

for (int i = 0; i < keys.Length; i++)
{
     string key = Convert.ToString(keys[i]);
     string subscriptionId = Convert.ToString(values[i]);

     // Use the subscriptionId to get the remote status via API. Or store in a list to call in bulk later in code
}

frans siew [SLC] [DevOps Advocate] Posted new comment 5th March 2025
Dominique Bodart [DevOps Member] commented 13th February 2025

Thank you Michiel, well noted. However, in this case I need to retrieve each ocurence of that table which in turn will be part of an API call to exctract data from my vendor site. The API string is built in the "sUrl" string variable as follow:
sUrl = "ext/api/v1/whs/services/" + sid + "/subscriptions/";
sUrl += subscription_ID; // Append Subscription ID
sUrl += "/data/rf?time_span_key=12Hours";

But the result is the field between "/subscriptions/" and "/data …" is empty:

"ext/api/v1/whs/services/200396/subscriptions//data/traffic?time_span_key=12Hours"

And in the log, error 0x80040221 appears for each instance.

Michiel Oda [SLC] [DevOps Enabler] commented 13th February 2025

Hi Dominique

I've updated my answer with a small code example on how to use the getcolumn call. As you can see, it's very similar to your original code with the difference it can deal with a variable amount of rows. If extra data is needed, you can extend the call and use it within the same forloop.

Dominique Bodart [DevOps Member] commented 13th February 2025

Hi Michiel,

I am now trying to implement your code. But, as i am not familiar with this method, how do I need to configure the columnIndexes and columns variable compare to my table?

Michiel Oda [SLC] [DevOps Enabler] commented 13th February 2025

You can update the columnIndexes to refer to the column indexes you actually want to retrieve (matches the idx attribute in the XML). I use the Parameter class to give it a readable name instead of numbers, but that is up to you.

For each entry in the columnIndexes, a new object will in the columns variable. As you can see in my example, I retrieve 2 columns (PK + another one). As such I extract the 2 columns after the protocol call to their own object arrays so I can loop over it. If you want to retrieve more or less columns, you can add or remove the 'var xxx = (object[])columns[x];'.

Dominique Bodart [DevOps Member] commented 13th February 2025

Hi Michiel,
In fact I just need to retrieve one parameter per line to build my API request. So the question is why it is not working for my table 1000 but it does work to retrieve individual column? For example,
Terminal_ID = Convert.ToString(protocol.GetParameterIndexByKey(2000, sI, 3)); works fine but
subscription_ID = Convert.ToString(protocol.GetParameterIndexByKey(1000, sI, 1)); doesn't work. However, I don't see any syntax error and both tables exist.
The main difference between table 1000 and table 2000 is that in table 1000 parameter type is "retrieved" and in table 2000, it is "custom"…
Please I just need advice on that 🙂

Show 3 more comments
You are viewing 1 out of 2 answers, click here to view all answers.
Please login to be able to comment or post an answer.

My DevOps rank

DevOps Members get more insights on their profile page.

My user earnings

0 Dojo credits

Spend your credits in our swag shop.

0 Reputation points

Boost your reputation, climb the leaderboard.

Promo banner DataMiner DevOps Professiona Program
DataMiner Integration Studio (DIS)
Empower Katas

Recent questions

Correlation Engine: “Test rule” doesn’t result in a hit, despite functional rule 1 Answer | 1 Vote
When using the Setter = true attribute, will the copy action always be executed first? 1 Answer | 2 Votes
Multiple Set on Table parameters for DVE’s 1 Answer | 2 Votes

Question Tags

adl2099 (115) alarm (62) Alarm Console (82) alarms (100) alarm template (83) Automation (223) automation scipt (111) Automation script (167) backup (71) Cassandra (180) Connector (109) Correlation (69) Correlation rule (52) Cube (150) Dashboard (194) Dashboards (188) database (83) DataMiner Cube (57) DIS (81) DMS (71) DOM (140) driver (65) DVE (56) Elastic (83) Elasticsearch (115) elements (80) Failover (104) GQI (159) HTTP (76) IDP (74) LCA (152) low code app (166) low code apps (93) lowcodeapps (75) MySQL (53) protocol (203) QAction (83) security (88) SNMP (86) SRM (337) table (54) trending (87) upgrade (62) Visio (539) Visual Overview (345)
Privacy Policy • Terms & Conditions • Contact

© 2025 Skyline Communications. All rights reserved.

DOJO Q&A widget

Can't find what you need?

? Explore the Q&A DataMiner Docs

[ Placeholder content for popup link ] WordPress Download Manager - Best Download Management Plugin