Forum Discussion

TAM's avatar
TAM
New Contributor
5 years ago

Having issue with .contains

Here is what I have $message.contains(‘successful’) ? 1 : 0 . This should give me a count of “1” if the Stored Procedure executing correctly. I then have a UNION, AGGREGATE and a ROUTER to count the SQL EXEC snaps, however it is only counting the first one and not the rest. At the end I have an email if $cnt == 10 then Success email, if $cnt < 10 then Failure email. Since the counts are not happening the emails are not generating. Any help is appreciated.

14 Replies

  • David_Wang's avatar
    David_Wang
    New Contributor II

    Hi Tlikarish,

    Thanks a lot for your help, this is definitely what I’m looking for, I really appreciate your help and the community.
    It’s still a new tool for me, so a lot of thing need to learn.

    Thanks,
    David

  • David_Wang's avatar
    David_Wang
    New Contributor II

    Hi Tlikarish,

    Just one more question, since snaplogic is case sensitive, when I loading the excel file, it will fail due to excel header using mixed upper and lower case, but actually column name in my destination is full upper case. Mapper can definitely fix it, but if I’m trying to make the pipeline dynamic, and reusable, I will need some method can read the excel header row and upper case the whole header dynamically. If there is not possible being done by regular snap, I will try script. Thanks again.

    Thanks,
    David

    • tlikarish's avatar
      tlikarish
      Employee

      Mapper can definitely fix it, but if I’m trying to make the pipeline dynamic, and reusable, I will need some method can read the excel header row and upper case the whole header dynamically.

      You can use an expression in the mapper like

      $.mapKeys((value, key) => key.toUpperCase())
      

      That should work for any header you want. Here’s more information on the mapKeys function.

      EDIT: In the mapper you’ll want to set the Target Path for that expression to $. Here’s the configuration I used in my test.

      • David_Wang's avatar
        David_Wang
        New Contributor II

        It’s great!!! never thought I have anyway to keep re-usability or avoid script.
        Your guys light my day.