Populating multiple fields with one value

Clovertech Forums Read Only Archives Cloverleaf Cloverleaf Populating multiple fields with one value

  • Creator
    Topic
  • #51577
    madelene mullner
    Participant

      I have a static value that I would like to populate in multiple fields using only one line in my xlate.  I believe there is a way to do this so you don’t have to have multiple lines for each field.  Thanks!

    Viewing 2 reply threads
    • Author
      Replies
      • #70832
        Robert Kersemakers
        Participant

          Hi Madelene,

          There are a few options, depending what you want to achieve.

          If you want to populate several (independent) fields with the same value, then you can either use several COPY statements, or one COPY with several in/outbound fields:

          Code:

          COPY  =hello  ->  0(0).MSH.00003.[0]
               =hello      0(0).MSH.00004.[0]

          If you want to populate all subfields of a field or all fields of a segment, then you can use PATHCOPY:

          Code:

          PATHCOPY @null -> 0(0).MSH.00009


          I use this last one mostly to clear a certain field or segment.

          Zuyderland Medisch Centrum; Heerlen/Sittard; The Netherlands

        • #70833
          Jim Kosloskey
          Participant

            Madelene,

            Just be careful that none of your Destinations are multiple component fields specified at the field level as all of the Source will first be copied to fill as many components as possible.

            For this reason, I use multiple COPYs.

            Let’s say you want to populate PID-5 and PID-6 with something like ‘hello’.

            Source                              Destination

            =hello                               0(0).PID(0).#5(0)

            =hello                               0(0).PID(0).#6(0)

            Note that both destinations are exprssed at the field level but it just so happens both of these fields are multiple component fields.

            Now what you want is something like this:

            PID|||||hello|hello

            What you will get is this:

            PID|||||hello^hello

            Note PID-6 is not populated at all but both of your ‘hello’s went to component 1 and component 2 of the PID-5 field.

            Of course you could use component and/or subcomponent level notation in your destinations and that would be corrected.

            Again, I just perfer to have multiple COPYs. With Copy and Paste that is not so bad.

            email: jim.kosloskey@jim-kosloskey.com 30+ years Cloverleaf, 61 years IT – old fart.

          • #70834
            Rob Abbott
            Keymaster

              Good info Jim.

              Rob Abbott
              Cloverleaf Emeritus

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