Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (Flatly)
  • No Skin
Collapse
Brand Logo

NetXMS Forum

  1. Home
  2. Support
  3. deleteRow issues

deleteRow issues

Scheduled Pinned Locked Moved Support
2 Posts 1 Posters 24.3k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • T
    T
    Tursiops
    wrote on last edited by
    #1

    Hi,

    I have some SNMP tables I would like to delete rows from. Looks like I should use the deleteRow function for that.
    Unfortunately I can't get it to work.
    I have attached a CSV with actual data from one of the tables. The script I am using is below:

    sub main()
    {
    	idxStatus = $1->getColumnIndex("Status");
    	for (i = 0; i < $1->rowCount; i++)
    	{
    		trace(0,$1->get(i,idxStatus));
    		if ( $1->get(i,idxStatus) == "Unavailable" )
    		{
    			trace(0,"Deleting Row");
    			$1->deleteRow(i);
    		}
    	}
    }
    

    As you can see, I added some debugging output already.
    Here's the result from the logs. Based on that I would have expected the "Unavailable" rows to disappear from the table:

    [29-Jan-2016 21:21:27.892] [INFO ] Healthy
    [29-Jan-2016 21:21:27.892] [INFO ] Healthy
    [29-Jan-2016 21:21:27.892] [INFO ] Healthy
    [29-Jan-2016 21:21:27.892] [INFO ] Healthy
    [29-Jan-2016 21:21:27.892] [INFO ] Healthy
    [29-Jan-2016 21:21:27.892] [INFO ] Healthy
    [29-Jan-2016 21:21:27.892] [INFO ] Healthy
    [29-Jan-2016 21:21:27.892] [INFO ] Healthy
    [29-Jan-2016 21:21:27.892] [INFO ] Healthy
    [29-Jan-2016 21:21:27.893] [INFO ] Healthy
    [29-Jan-2016 21:21:27.893] [INFO ] Healthy
    [29-Jan-2016 21:21:27.893] [INFO ] Healthy
    [29-Jan-2016 21:21:27.893] [INFO ] Healthy
    [29-Jan-2016 21:21:27.893] [INFO ] Healthy
    [29-Jan-2016 21:21:27.893] [INFO ] Unavailable
    [29-Jan-2016 21:21:27.893] [INFO ] Deleting Row
    [29-Jan-2016 21:21:27.893] [INFO ] Unavailable
    [29-Jan-2016 21:21:27.893] [INFO ] Deleting Row
    

    Yet, they are not deleted. Am I using the deleteRow function incorrectly?

    I also found some other oddity in that sometimes the logs return rather strange results:

    [29-Jan-2016 21:51:44.313] [INFO ] ??althy
    [29-Jan-2016 21:51:44.313] [INFO ] ??althy
    [29-Jan-2016 21:51:44.313] [INFO ] w?althy
    [29-Jan-2016 21:51:44.313] [INFO ] ??available
    [29-Jan-2016 21:51:44.313] [INFO ] V?available
    

    Is that an indication of the SNMP packets coming back with corrupt data?


    results.csv

    1 Reply Last reply
    0
    • T
      T
      Tursiops
      wrote on last edited by
      #2

      Hi,

      Answering my own question here, as it turned out to be a rather obvious bug in my script.
      Deleting a row changes the row count, so whenever I delete a row, I also have to decrease "i" again, i.e. run an i--.

      The other issue appears to indeed just be some broken SNMP agent producing rubbish data for that particular set that I was testing my code with. Even without any transformation applied, that particular DCI still produces nonsense more often than not - while all other DCIs on the same system work perfectly fine. Unlucky coincidence. 😐

      Anyway, works as expected now.

      1 Reply Last reply
      0

      Hello! It looks like you're interested in this conversation, but you don't have an account yet.

      Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

      With your input, this post could be even better 💗

      Register Login
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      Powered by NodeBB Contributors
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups