Topic
IC4NOTICE: developerWorks Community will be offline May 29-30, 2015 while we upgrade to the latest version of IBM Connections. For more information, read our upgrade FAQ.
16 replies Latest Post - ‏2012-12-21T22:10:36Z by SystemAdmin
SystemAdmin
SystemAdmin
6184 Posts
ACCEPTED ANSWER

Pinned topic Absolute Newbie: Must have Simple WTX XForm by EOD

‏2012-12-21T15:08:42Z |
I've been thrown into a project where I must use WTX to make the simplest of transforms, but I have no clue where to start. I have WTX Design Studio 8.4.0.3. The funny thing is, I could write this transform in Java in about 10 minutes, but have been struggling now for two days to get a single intuitive clue in WTX as to what to do. I must use WTX because the transform has to be applied in DataPower.

I need to simply replace a single field in the first line of a file with a hard-coded value, then write out the rest exactly as it is. The first line of the file is a record that takes this form:

MSH|^~\&|SENDINGAPP|SENDINGFAC|RECEVINGAPP|RECEIVINGFAC|201210170905||ORU|0000|P|2.3

I need to change it to this:

MSH|^~\&|SENDINGAPP|SENDINGFAC|RECEVINGAPP|****HARD-CODED-CHANGE***|201210170905||ORU|0000|P|2.3

There can be anything from a few to hundreds of lines of records that follow, but they need to be written out exactly as they are.

I was hoping I could just copy the MSH type from the HL7 pack into my type tree and then work from there, but I can't figure out for the life of me how to do something so simple as copy anything in WTX. I tried exporting, nope. I tried copy/paste... nope. I tried drag and drop... nope. WTF? Are type trees and parts of type trees not reusable?

Like I said, I have no clue as to even how to start this, and the stupid one liner tutorial to turn a single input line into caps is not remotely close to being able to help me here. Just get me started in the right direction.
Updated on 2012-12-21T22:10:36Z at 2012-12-21T22:10:36Z by SystemAdmin
  • SystemAdmin
    SystemAdmin
    6184 Posts
    ACCEPTED ANSWER

    Re: Absolute Newbie: Must have Simple WTX XForm by EOD

    ‏2012-12-21T15:27:49Z  in response to SystemAdmin
    In order to "copy" a group such as an entire record with its included fields, you may be able to do a merge. Both trees must have the same root name though. Work with copies of your original type trees. You right click on the record to be merged, position the cursor in the To: field and click on the appropriate location in the target type tree, making sure to select "Merge sub-tree". Then click on Merge button.

    Alternately, right click on each field to be copied one at a time and select Copy. Position the cursor in the To: field and click on the target location in the target type tree. Do this for each field and finally for the record containing those fields.
    • SystemAdmin
      SystemAdmin
      6184 Posts
      ACCEPTED ANSWER

      Re: Absolute Newbie: Must have Simple WTX XForm by EOD

      ‏2012-12-21T15:43:02Z  in response to SystemAdmin
      Ahh... "Both trees must have the same root name though".... that's what's kicking me. I did figure out I could drag and drop by positioning two type trees side by side then dragging from one to the other. Still didn't build the right tree, though, and I think it's because the roots weren't named the same.

      So.. here's what I'm trying now. I decided to just try to use the existing HL7 2.3 type tree for my input and output cards. Here's what I did:

      Input Card:
      CardName: Incoming
      TypeTree: hl7_v2_3.mtt
      Type: File Protocol HL7 (Because I have a single input file called "original.txt" in the Misc folder of my project

      SourceRule
      GET
      Source
      FilePath: original.txt

      Output Card:
      CardName: Outgoing
      TypeTree: hl7_v2_3.mtt (Same types exactly, right.... only that in a single field in the MSH record, I'm going to hard-code the Receiving Facility)
      Type: File Protocol HLY (Because I want to output a single file)

      TargetRule
      PUT
      Target
      FilePath: converted.txt
      WTX presents me with 3 things in each card:
      FSH Segment (0:1)
      Batch (s)
      FTS Segment (0:1)

      Then, I'm simply dragging everything from input to output.

      At this point, I'd be really happy if I could just write the input exactly as it is to the output, and the above is apparently intuitive enough for what amounts to be an identity transform.

      The map can be built with no errors. But when I run it, I get an empty output.

      So, at this point, I'm utterly dumbfounded and completely lost. Why would it not just simply do a copy of the input to the output. No rules. No fancy nothing. Just take the input, write to output. It ain't doing it.
      • SystemAdmin
        SystemAdmin
        6184 Posts
        ACCEPTED ANSWER

        Re: Absolute Newbie: Must have Simple WTX XForm by EOD

        ‏2012-12-21T16:29:39Z  in response to SystemAdmin
        Same root name is only required for merging, not copying.

        Is your map completing successfully? Just because a map builds OK, doesn't mean it will run OK. Also, a map can run OK, but produce no output. You can turn on the trace file (.mtr) by selecting Map->Map Settings. You may also want to turn on the audit log (.log). Select input and output trace. The log & trace files will default to your map directory.

        Post your map, type tree, and input data and I will take a look.
        • SystemAdmin
          SystemAdmin
          6184 Posts
          ACCEPTED ANSWER

          Re: Absolute Newbie: Must have Simple WTX XForm by EOD

          ‏2012-12-21T17:18:48Z  in response to SystemAdmin
          Here you go. There are currently no input and output cards in the map, because no matter what I do or select or anything, I cannot get what I intuitively think I should see.

          Again, all I need to do is to change a single element in the first line:

          MSH|^~\&|0000|RN|JOETECH|RN|201210170905||ORU|3851|P|2.3

          To

          MSH|^~\&|0000|RN|JOETECH|***HARDCODED-VALUE-HERE****|201210170905||ORU|3851|P|2.3

          And everything else remain exactly the same.

          Attachments

          • SystemAdmin
            SystemAdmin
            6184 Posts
            ACCEPTED ANSWER

            Re: Absolute Newbie: Must have Simple WTX XForm by EOD

            ‏2012-12-21T17:51:49Z  in response to SystemAdmin
            The map is failing because your input data file doesn't match the message type (ORU) I selected. Try the map with some valid data.
            • SystemAdmin
              SystemAdmin
              6184 Posts
              ACCEPTED ANSWER

              Re: Absolute Newbie: Must have Simple WTX XForm by EOD

              ‏2012-12-21T18:24:53Z  in response to SystemAdmin
              Hmmm... I may have mucked it up trying to clean it of PII. So I take it I can focus on just the ORU message type, and not worry about protocol?

              While I'm trying that approach on my actual message, is there a way we take a different approach? What is the simplest way to accomplish what I'm really after? I really don't give a squat if the incoming data doesn't conform to some spec. I need to make the simplest of changes to the first line and basically copy the rest, regardless of its content.

              That is...

              1) Read the first line. Modify the 6th field with a hard-coded value.
              2) Copy all the remaining lines in the file.
              • SystemAdmin
                SystemAdmin
                6184 Posts
                ACCEPTED ANSWER

                Re: Absolute Newbie: Must have Simple WTX XForm by EOD

                ‏2012-12-21T19:16:29Z  in response to SystemAdmin
                I don't know what you mean by "protocol". The file you provided starts with an MSH record as does the ORU object. I haven't worked with HL7 messages and I don't have time to learn today.

                IF WTX cannot read the input file, it doesn't proceed any further. You can turn off some validation by going to Map->MapSettings->Validation. Select Custom from the drop-down list. Expand the Validation property and change the "Validate" values to ignore. The map still may fail.

                Good luck.
                • SystemAdmin
                  SystemAdmin
                  6184 Posts
                  ACCEPTED ANSWER

                  Re: Absolute Newbie: Must have Simple WTX XForm by EOD

                  ‏2012-12-21T19:35:01Z  in response to SystemAdmin
                  No worries about protocol... I got misled in the map because I'm just clueless, and evidently have to get my head around what, exactly, all this stuff in the HL7 type tree means relative to WTX. However, you've actually helped me to begin to roughly get my head around what I'm working with here.

                  But, is the tool so strictly bound to thinking about my input as HL7? I was simply told I needed that HL7 type tree to do this. So, let's forget about the imported type tree from the HL7 pack. Why do we need to know anything about HL7 to do what I'm trying to do here?

                  If you were given the sample file I uploaded, and was told to simply change the 6th field of the first input line to "1234", and then copy the rest identical to the way it is... how would you proceed?
                  • SystemAdmin
                    SystemAdmin
                    6184 Posts
                    ACCEPTED ANSWER

                    Re: Absolute Newbie: Must have Simple WTX XForm by EOD

                    ‏2012-12-21T20:13:41Z  in response to SystemAdmin
                    If you had a complete file you might have to start with the Protocol object but your sample doesn't so I didn't consider it.

                    Your problem is your sample data may not be correct. I found if I add a "Trigger ID Event" value, "O01", to the MSH segment I get output.
                    MSH|^~\&|0000|RN|JOETECH|RN|201210170905||ORU^O01|3851|P|2.3

                    R01 & W01 are also valid.

                    The ZPS segment at the end seems be an issue. WTX doesn't recognize it and I didn't find it in the type tree.
                    • SystemAdmin
                      SystemAdmin
                      6184 Posts
                      ACCEPTED ANSWER

                      Re: Absolute Newbie: Must have Simple WTX XForm by EOD

                      ‏2012-12-21T20:27:15Z  in response to SystemAdmin
                      Cool! So, if I understand you right... I could modify my type tree to not include the Trigger ID Event, and figure out how to add the ZPS segment... and I should be able to get it to go?
                      • SystemAdmin
                        SystemAdmin
                        6184 Posts
                        ACCEPTED ANSWER

                        Re: Absolute Newbie: Must have Simple WTX XForm by EOD

                        ‏2012-12-21T20:56:02Z  in response to SystemAdmin
                        The Trigger Event ID is referenced in component rules the type tree that allow it to differentiate between the three different types of ORU messages. If you delete it from the component rule, it would probably use the first ORU message type which may or may not be a problem.

                        Just copy a segment, renaming it ZPS and delete all the fields in the new record except one and define that field in Properties (right click on the field) as Item Subclass:Text of indeterminate size, i.e., Size=null. Then add the ZPS segment to the message type you use.

                        H7 type trees are extremely complex and not easily sliced and diced.
                        • SystemAdmin
                          SystemAdmin
                          6184 Posts
                          ACCEPTED ANSWER

                          Re: Absolute Newbie: Must have Simple WTX XForm by EOD

                          ‏2012-12-21T21:11:59Z  in response to SystemAdmin
                          OK... (laughing at myself a bit here)... I finally got it to output something. This is what I get:

                          
                          MSH ||||^1234|||||| OBR||||
                          


                          Still not sure what the heck is happening, but I think I'm at least working with the right elements from the type tree. When you added the "^O01", did you get the whole original thing to output, or nothing at all?
                          • SystemAdmin
                            SystemAdmin
                            6184 Posts
                            ACCEPTED ANSWER

                            Re: Absolute Newbie: Must have Simple WTX XForm by EOD

                            ‏2012-12-21T21:15:04Z  in response to SystemAdmin
                            I got the entire input file except for the ZPS record which was treated as unknown data and ignored.
                            • SystemAdmin
                              SystemAdmin
                              6184 Posts
                              ACCEPTED ANSWER

                              Re: Absolute Newbie: Must have Simple WTX XForm by EOD

                              ‏2012-12-21T21:20:38Z  in response to SystemAdmin
                              see attached screen shot of map.
                              • SystemAdmin
                                SystemAdmin
                                6184 Posts
                                ACCEPTED ANSWER

                                Re: Absolute Newbie: Must have Simple WTX XForm by EOD

                                ‏2012-12-21T21:32:03Z  in response to SystemAdmin
                                I'm grinning like a possum eatin' sawbriar...

                                OK... At least I now have a pure copy getting through. I must have mucked up my original map through my foolish trial and error. Rebuilt it pure, and I've got full output now.

                                Geesh!
  • SystemAdmin
    SystemAdmin
    6184 Posts
    ACCEPTED ANSWER

    Re: Absolute Newbie: Must have Simple WTX XForm by EOD

    ‏2012-12-21T22:10:36Z  in response to SystemAdmin
    Thanks... you have no idea how much I actually learned today.