Announcement

Collapse
No announcement yet.

ChannelUtil.getDeployedChannelIds()

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • ChannelUtil.getDeployedChannelIds()

    I have been all over this forum and can't find a way to accomplish what I'm looking to accomplish.

    I want to be able to pull all of the deployed channel ID's and populate a database.

    When using the ChannelUtil.getDeployedChannelIds() in a source or destination transformer like so:

    var guidList = ChannelUtil.getDeployedChannelIds();

    I get this result: guidList: [3a9154ae-eb66-443e-ad82-3e69d1deba7c, 119cdd7d-bc60-457e-8b77-50001f59b177, 5ceafcb6-b259-4d72-93d3-3f85bbbd81b5, a852286a-3894-49c5-9dc4-f4c58c74c48f, 6beb50c4-61f6-4601-bdf3-50a2c244e7cb, 74bce66e-b50a-4b6a-9b35-e401d186e694, 588a90a7-886b-4f4d-93e7-2ed1c61c2687]

    I don't know what this is as I can't use it as an array. I was looking to have an array and iterated through that array into a db.

    Thoughts?

  • #2
    That is a list of the channels (GUID). It is comma delimited. Do you know that there is already a table with all of the channels?

    Comment


    • #3
      Thx Cory... yes, I know of this table. I was wondering how to do it with this ChannelUtil.getDeployedChannelIds() if it would be easier to do some custom reporting that I am interested in.

      My plan was to use the ChannelUtil as versus pulling the XML from the mirthdb, parsing through and capturing my data and then posting it to the custom DB where I was going to do dynamic reporting. I will be capturing other aspects of the ChannelUtil calls. Those are easy tho because they are all a single value.

      I reckon that I would pull that string in and split it on the <comma><space> and put that into an array?

      Not sure how that is all done. I've been trying but I'm not successful.

      Thx!

      Comment


      • #4
        There is also a getChannelById() that will give you name of the channel base on those GUIDs.

        Do keep in mind that if you delete channel and recreate it. Or create a clone and delete the channel, that ID changes.

        Comment


        • #5
          I can use the getChannelById() just fine. I can use any of the get*() when I pass the name through... what I can't seem to handle (insert joke here... I can handle it) is the call to any that return the static List<String>.

          Comment


          • #6
            It's a Java List. https://docs.oracle.com/javase/8/doc...util/List.html

            You can iterate directly over the list like this:

            Code:
            for (var channelId in Iterator(ChannelUtil.getDeployedChannelIds())) {
                logger.info(channelId);
            }
            Or convert to a (Java, not javascript) array by calling:

            Code:
            var guidList = ChannelUtil.getDeployedChannelIds().toArray();

            Comment


            • #7
              Code:
              for (var channelId in Iterator(ChannelUtil.getDeployedChannelIds())) {
                  logger.info(channelId);
              }
              The first set of code WORKED WONDERS!

              The second code you provided returned an object and I am unable to pull the data in.

              Thank you so much! I appreciate your time!

              Comment

              Working...
              X