Forcing delimiters in a VRL

Clovertech Forums Read Only Archives Cloverleaf Cloverleaf Forcing delimiters in a VRL

  • Creator
    Topic
  • #50590
    Vidya Sridhar
    Participant

      Hello

      I am creating 7 different CSV files from a HL7 message (ADT). I have set up an output VRL definition for each of these files. I am using the Xlate Config tool to pull out the necessary data from HL7 format and convert to CSV format. All of this runs thru the tester fine.

       

      However, when there is no data to be filled, ie, data is empty, the delimiter is not forced and the output file has only 28 fields and not 31 in the output record..

      For eg, it should be

      data,data,data,,,,,,,,

      for the empty fields but it comes up as

      data,data,data

      Is there a way to force the field seperator (comma) even if no there is no data. I did a search on this topic and did not find an answer to my problem.

      Thanks for any help!

      Vidya Sridhar

    Viewing 4 reply threads
    • Author
      Replies
      • #66711
        Jim Kosloskey
        Participant

          Vidya,

          The csv ‘standard’ whcih VRL is emulating is (as I think you have discovered) a very loose standard.

          It is not definitive that trailing missing fields should have separators present. Some systems require them, some don’t.

          Apparently Cloverleaf(R) has taken the approach that trailing fields that are null don’t get separators (similar to HL/7).

          What I have done as a work around is to define a ‘last field’ which I populate with some value (usually single character) in the Xlate. Then post Xlate I execute a proc before the message is output to eliminate the last field. That gets me my intervening separators.

          It would be nice to have the option to specify whether null fields should still have separators or not in the configurator.

          Go to the Product Enhancement Request form and submit one for this enhancement if you like.

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

        • #66712
          garry r fisher
          Participant

            Hi,

            I’ve had the same problem and have the same/similar solution to Jim. I add an ! to the end of my message to force the delimiters and then on my outbound TPS I strip off the last character leaving the VRL I want.

            Regards

            Garry

          • #66713
            Vidya Sridhar
            Participant

              Thanks for your replies! I think I have to add a xlt post proc to these fields to force the delimiters.

              Jim,

              I am going to fill the product enhancement request form as you have suggested. Thanks for explaining the problem very well.  ðŸ™‚

            • #66714
              Jim Kosloskey
              Participant

                Vidya,

                You will need a post xlate Tcl proc no matter what.

                However, I think it is more ergonomic to define an additional ending field in your VRL and then remove the last field, etc. in a following proc.

                The reason I say that is the proc can work with any VRL – it simply removes the last field, etc. it does not matter how many fields there are supposed to be (the VRL controls that).

                If you have the proc add the delimiters then the proc needs to know how many delimiters there should be. That will likely change with every VRL and thus require either a different proc for each situation or your proc will need to have a number of delimiters argument in order to be reusable.

                The first method makes for a reusable proc that is fairly simple, in order for the second to be reusable, the proc will need to be more complex.

                In any case, I think it is in your best interest to make the proc reusable no matter which way you go.

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

              • #66715
                Vidya Sridhar
                Participant

                  Jim,

                  I did run into the different length VRLs and not knowing where the last field will be as you have mentioned. I am going to do the “last field solution” by adding it to all of my defined VRL’s and then remove it using the post proc in the Xlate. Thanks for helping me with this issue.

                  I am all for ergonomics and re-usable code.  ðŸ˜€

                  Vidya

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