Facility Control

 View Only
  • 1.  unshift param Array (Newest Message First)

    Posted 11-15-2018 03:19
    Hey there,

    So I'm working on a feed from a third party that is sending me regular updates and I would like to add it as the first item in a param array instead of the end. In javascript, unshift will do this. Is there a way for me to push to the top of a param array? Like params.unShiftValue('oid', 'This text'); Right now I'm adding to the array by using params.getElementCount and using that as the element id when adding a value. This obviously puts it at the end. I'm experimenting with getAllValues, then using the javascript unshift then setAllValues to put it back but that seems really inefficient when I'm expecting multiple message in a second in some cases.

    An alternative would be just a way to reverse sort a table widget. The goal is just to show the newest message at the top of the list.

    Thanks!


  • 2.  RE: unshift param Array (Newest Message First)

    Posted 11-28-2018 20:19
    I don't know of any commands to push something to the top of a param array. I think your getAllValues and setAllValues is the way I would go, although as you say, it feels inefficient.
    #DashBoard


  • 3.  RE: unshift param Array (Newest Message First)

    Posted 11-28-2018 22:16
    I've done this the "hard way"...
    However it works!

    What you do is take first go through each entry of your parameter array, add those to an array in your code.

    Then you add your new entry to another array in your code.
    Then you iterate through each entry in your first array, push those into the second array, and then use a "setAllValues" with the first array created.

    That will give you the new value at the top...
    It's not pretty, but it works...
    #DashBoard