Xlate check partial string

Clovertech Forums Read Only Archives Cloverleaf Cloverleaf Xlate check partial string

  • Creator
    Topic
  • #55518
    Lina Patel
    Participant

      Is there a way to check partial strings in an Xlate

      1(0).0(0).FT1(0).#23(0).[0] eq=EP-

      ELSE

      SURPRESS

      Sample FT1-23 is: EP-2017-72^^^HNA_ACCN

      Thank you!

    Viewing 19 reply threads
    • Author
      Replies
      • #85605
        Robert Milfajt
        Participant

          Try ct (contains) instead of eq (equal).

          Robert Milfajt
          Northwestern Medicine
          Chicago, IL

        • #85606
          Lina Patel
          Participant

            Thank you will try ct=EP-

            Lina

          • #85607
            Robert Milfajt
            Participant

              There should be a space between ct and =EP-, which you may have here, but my 50+ year old eyes aren’t seeing it.

              Code:

              ct =EP-

              Robert Milfajt
              Northwestern Medicine
              Chicago, IL

            • #85608
              Lina Patel
              Participant

                Yes – thank you!

              • #85609
                Lina Patel
                Participant

                  FT1|1|10583830426|5698830|20171011084300|20171024212632|CR|5070063^

                  FT1|2|10583830426|5698830|20171011084300|20171024212632|CR|5070063^

                  FT1|3|10583830426|5698830|20171011084300|20171024212632|CR|6630063^

                  FT1|4|10583830426|5698830|20171011084300|20171024212632|CR|5070063^

                  FT1|5|10583829565|5698830|20171023085600|20171024212628|DR|6630534

                  FT1-7 (first four digits) are equal to 5070 route otherwise bypass

                  What is a good condition check for first 4 digits please for multiple FT records?

                  Thank you!

                • #85610
                  Jim Kosloskey
                  Participant

                    Are you asking how to only create the FT1 segments where the first 4 characters of FT1-7 is equal to 5070?

                    Or do you want to KILL a message where the first 4 characters of any FT1-7 is not equal to 5070?

                    email: jim.kosloskey@jim-kosloskey.com 29+ years Cloverleaf, 59 years IT - old fart.

                  • #85611
                    Lina Patel
                    Participant

                      Skip  FT1-7  record where first four digits are not equal to 5070 – continue to next FT1-7 checking in same message

                      Would SUPRESS – suppress the whole message?

                    • #85612
                      Jim Kosloskey
                      Participant

                        ITERATE through the FT1 group or segment set (depends on variant construct).

                        If you are on Cloverleaf 6.1 or later:

                          inside the ITERATE use the Xlate STRING Action (I don’t recall the function but it is obvious) to get the first 4 characters of the FT1-7 field place that result in a temp variable. IF NOT Cloverleaf 6.1 or later, you will need some Tcl to get the first 4 characters.

                           Use the IF Action to check the temp variable populated above against 5070.

                           IF True – COPY the FT1 segment information to the outbound (you will need to use your own counter variable for the outbound repetitions because you will not end up with a one for one match). If you do not know how to maintain your own counter there are a number of posts on the forum regarding that topic or you can email me and I will assist.

                        I think the above covers it.

                        email: jim.kosloskey@jim-kosloskey.com 29+ years Cloverleaf, 59 years IT - old fart.

                      • #85613
                        Lina Patel
                        Participant

                          The attached works for one record only.

                          1) What is the correct syntax for repeating destination using variable in attached example.

                          2) I have initialized Copy =0   $%f99

                             before and after the ITERATE.

                          Thank you in advance.

                          Lina

                        • #85614
                          Robert Kersemakers
                          Participant

                            You should be using the %f99 somewhere in the output message. However your output message format is an FRL, which means it has only one occurrence: no repetition of records.

                            Two ways to tackle this:

                            1) Instead of the FRL, define an HRL that contains a repetition of the FRL you’re using now. Now you should be able to use %f99 (in fact, you need to use %s99) to repeat the FRL.

                            2) Send out the FRL after you meet your criteria. So just change your MATH: ADD command into a CONTINUE. Be aware that every outbound message only contains only record this way.

                            Method 2 is obviously the easiest, but it all depends on what you need as your outbound message.

                            Zuyderland Medisch Centrum; Heerlen/Sittard; The Netherlands

                          • #85615
                            Lina Patel
                            Participant

                              I have to check all instances of FT1 in each message….

                              Ok to generate separate output records.

                              If I change MATH:ADD to CONTINUE (option #2) above, will Xlate logic

                            • #85616
                              Jim Kosloskey
                              Participant

                                Place an unconditional SUPRESS at the beginning of your Xlate.

                                That will take care of the spurious last FT1 you are experiencing.

                                email: jim.kosloskey@jim-kosloskey.com 29+ years Cloverleaf, 59 years IT - old fart.

                              • #85617
                                Lina Patel
                                Participant

                                  Will be testing attached -once again continue learning and growing from everyone.

                                  Thank you!

                                  Lina

                                • #85618
                                  Jim Kosloskey
                                  Participant

                                    Based on your description of the challenge, I am not sure using ct in your IF will give you want you want all of the time.

                                    If it is possible for the field being checked to contain 5070 anywhere in the field you would get a true result.

                                    If indeed the specification is any FT1 occurrence where the field in question leads with 5070 then I think it would be better to use a Xlate STRING Action with the appropriate function to extract the leading 4 characters, store those in a temp variable then compare that temp variable == =5070.

                                    If you are not on Cloverleaf 6.1 or later, then the STRING Xlate Action does not exist and you would use Tcl to extract the leading 4 characters.

                                    email: jim.kosloskey@jim-kosloskey.com 29+ years Cloverleaf, 59 years IT - old fart.

                                  • #85619
                                    Lina Patel
                                    Participant

                                      I am currently using v6.1.1

                                      xlateStrTrimLeft is the closest match.

                                      Is there any documentation for the String actions?

                                    • #85620
                                      Jim Kosloskey
                                      Participant

                                        I believe there is some documentation in the Help.

                                        However, the functions are fairly self documenting. If you select the function and hover over it you will be shown the format.

                                        If you need further assistance, email me an I will assist.

                                        email: jim.kosloskey@jim-kosloskey.com 29+ years Cloverleaf, 59 years IT - old fart.

                                      • #85621
                                        Lina Patel
                                        Participant

                                          I am not getting a match (5070) in Xlate with attached logic.

                                        • #85622
                                          Lina Patel
                                          Participant

                                            Thank you Mr. Jim Kosloskey for taking time and discussing string functions over the phone.

                                            Much appreciated.

                                            Lina

                                          • #85623
                                            Robert Milfajt
                                            Participant

                                              I see in your document that you have:

                                              Code:

                                              IF @EP == =5070

                                              If that is working for you, great, and disregard the rest of this.  Since you set @EP based off a string function, you may want to use eq (string equal) instead of == (numeric equal).  I’ve run into issues with that before.  I don’t remember specifics and older version of Cloverleaf for sure, but if you find during testing it doesn’t work all the time, try that first.

                                              Robert Milfajt
                                              Northwestern Medicine
                                              Chicago, IL

                                            • #85624
                                              Lina Patel
                                              Participant

                                                I have changed it to below and works as well…

                                                Code:

                                                IF @EP  eq =5070

                                                Thank you.

                                            Viewing 19 reply threads
                                            • The forum ‘Cloverleaf’ is closed to new topics and replies.