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

C# Automation: Get row based on third column

Solved1.00K views28th November 2022Automation
4
Robin Becker [DevOps Advocate]1.40K 11th April 2022 0 Comments

I have two tables, inputs and outputs. The output table contains a column "connected inputs" which contains PKs from the input table.

I want to get all the display keys for outputs connected to a few selected inputs (also based on display keys). At the moment I need to get all the table display keys from from the input table, filter based on the display keys I want, then FindPrimaryKey for those rows. Then I get all the display keys for the output table and since we can't fetch an entire table or a column which isn't PK or DK column I need to do GetParameter on each row in the output table (1700+ rows) to get the Connected Input for each output which is taking a looong time so that I can then filter the outputs to the ones using a specific input.

This is a script that runs when opening the visual overview; right now it takes 20+ seconds to load the visual overview since the script blocks the screen until finished. Is there a way to speed this up?

var prefix = (string) engine.GetScriptParam("Prefix").Value;
var dummy = engine.GetDummy("dummy");

// inputs we want
string[] sourceKeys = dummy.GetTableDisplayKeys(1400)
.Where(dk => dk.StartsWith(prefix + " AUX "))
.OrderBy(dk => dk)
.Select(dk => dummy.FindPrimaryKey(1400, dk))
.ToArray<string>();

// populate dict to speed up filtering
var destinations = new Dictionary<string, List<string>>();

foreach(var dk in dummy.GetTableDisplayKeys(1500))
{
var connectedInput = (string) dummy.GetParameter(1506, dk);
if (!String.IsNullOrEmpty(connectedInput) && Array.Exists(sourceKeys, key => key.Equals(connectedInput))) {
if(!destinations.ContainsKey(connectedInput))
destinations[connectedInput] = new List<string>();
destinations[connectedInput].Add(dk);
}
}

// return outputs connected to each input
for(var i = 0; i< sourceKeys.Length; i++)
{
if (destinations.ContainsKey(sourceKeys[i]))
engine.AddScriptOutput(UIVariables.VisualOverview.CreateKey($"Aux{i+1}"), string.Join(", ", destinations[sourceKeys[i]]));
}

Trong Huynh [DevOps Member] Answered question 4th November 2022

1 Answer

  • Active
  • Voted
  • Newest
  • Oldest
3
Laurens Moutton [SLC] [DevOps Enabler]8.68K Posted 11th April 2022 1 Comment

Hi,

If you have DIS then you can create the automation script solution through DIS and make use of the class library.

The start point for the class library help can be found here .
You'll need to retrieve the IDmsTable object and on that object call the QueryData method with the ColumnFilter that you're trying to filter on (see method info here)

To summarize it will be something like below (note that I didn't verify the syntax) :

-Add the needed references:
using Skyline.DataMiner.Library.Automation;
using Skyline.DataMiner.Library.Common;
-Access the dms object (IDms dms = engine.GetDms(); )
-Get the element (IDmsElement element = dms.GetElement("elementName"); )
-Get the table (IDmsTable table = element.GetTable(tablePid); )
-Construct the filter (List<ColumnFilter> filter = new List<ColumnFilter>
{
new ColumnFilter {Pid=columnPid, Value="filterValue"}
}; )
-Query the table (IEnumerable<object[]> result = table.QueryData(filter); )

Robin Becker [DevOps Advocate] Posted new comment 11th April 2022
Robin Becker [DevOps Advocate] commented 11th April 2022

Thank you! That sped up things significantly.

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

Alarm Dashboard PDF/CSV Export 1 Answer | 0 Votes
Is the Microsoft SharePoint Connector Still Usable 0 Answers | 0 Votes
Is the Microsoft SharePoint Connector Still Usable 0 Answers | 0 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 (108) Correlation (68) Cube (150) Dashboard (194) Dashboards (188) database (83) DataMiner Cube (57) DIS (81) DMS (71) DOM (139) driver (65) DVE (55) Elastic (83) Elasticsearch (115) elements (80) Failover (104) GQI (159) HTTP (76) IDP (74) LCA (151) low code app (166) low code apps (93) lowcodeapps (75) MySQL (53) protocol (203) QAction (83) security (88) services (51) 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