Announcement

Collapse
No announcement yet.

Use SQL query to pull a list of values for a destination filter..

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

  • Use SQL query to pull a list of values for a destination filter..

    Hi team,
    I have a need to query a list of values from a database vs adding the values to the channel filter each time - the list will also be used in other channels so I'd like to keep the data in a table, and just add to the individual table.
    eg - based on the destination MSH-6 (Recieving facility) - I'd like it to take a different path if it matches the list in the database..
    Any ideas the best way to do that?
    Regards
    Matt

  • #2
    Build a list of values in the global map. I’d probably use a JSON array and use JSON array prototype functions to search for values on your filters.
    Diridium Technologies, Inc.
    https://diridium.com

    Comment


    • #3
      I read your question too quickly. So - I wouldn't normally make a DB call for a filter for a list of values that could be cached in the global map or global channel map unless that list of values is very large.

      If you need to query the database in a filter - just change the filter type to javascript and make the db call right there. 'return true' or 'return false' in the javascript based on whatever condition makes sense to you. e.g. that might be as sample as "count (*) from tablename where columnname = 'whatever'" and grabbing the result which will be 0 or not 0 - handy because you always will get a response rather than needing to check for an empty response.

      I don't know what you mean by a "different"path" though in mirth terms. e.g. are you sending to some other channel? Controlling downstream destinations? Simple if..then logic?
      Diridium Technologies, Inc.
      https://diridium.com

      Comment

      Working...
      X