VRL Delimiters.

Clovertech Forums Read Only Archives Cloverleaf Cloverleaf VRL Delimiters.

  • Creator
    Topic
  • #54940
    John Hamilton
    Participant

      I have a VRL where the last field may or may not be blank.

      But I need to have the last Delimiter there even if it is blank.

      xxxxxx|Last Field.

      But if Last Field is Null.

      Then I get xxxxxx  But I need xxxxxx|.

      I know this has to be easy to do.

      I’m trying avoid any TCL to do this.

    Viewing 3 reply threads
    • Author
      Replies
      • #83517
        Jim Kosloskey
        Participant

          John,

          Try IF (checking for @null) and if the IB field is null then CONCAT the IB field and the separator.

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

        • #83518
          John Hamilton
          Participant

            Unless I put a space or some other value in the last field it will not append the pipe. I think this is because the engine creates the delimeters post translation.

            Does anyone now how to use no delimeres on subfields  ?

            I tried to put x00 in the global parameters value it just changes it back to x20

          • #83519
            Jim Kosloskey
            Participant

              OK the way I handled this (I checked on a system I did this with) was to define a new last field (I called it Dummy). I then put a space in Dummy unilaterally.

              In this case the receiving system ignored anything following the last expected field so the extra field with a space was not an issue. Perhaps your receiving system will act the same way.

              If not then you will need a little Tcl following the Xlate to trim off the trailing space.

              As for sub-fields I am not sure what you want to accomplish. Maybe a more in-depth description will help.

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

            • #83520
              Robert Kersemakers
              Participant

                Yes, I did it the same way Jim explained.

                And I already have a tcl-script to remove the last field from a VRL:

                Code:

                ######################################################################
                # Name: orbis_VRL_remove_last_field
                # Created by: Robert Kersemakers
                # for: Orbis Medisch en Zorgconcern
                # at: 31-10-2005
                # Purpose: Script om het laatste veld van een VRL-bericht
                # te verwijderen. Meestal om een dummy-veld aan het eind
                # van een regel te verwijderen, zodat alle delimiters getoond worden
                #
                # UPoC type: tps
                # Args: tps keyedlist containing the following keys:
                #       MODE    run mode (”start”, “run” or “time”)
                #       MSGID   message handle
                #       ARGS    user-supplied arguments:
                # DEBUG Debug mode 0 (uit) of 1 (aan); default 0
                # SEP Gebruikte separator; default “;”

                # Returns: tps disposition list:
                #          
                #

                proc orbis_VRL_remove_last_field { args } {
                 

                 keylget args MODE mode               ;# Fetch mode
                 keylget args ARGS uargs
                 set debug 0         ; keylget uargs DEBUG debug
                 set sep “;”          ; keylget uargs SEP sep

                 set dispList {} ;# Nothing to return

                 switch -exact — $mode {
                   start {
                      # Perform special init functions
                      # N.B.: there may or may not be a MSGID key in args
                   }

                   run {
                     # ‘run’ mode always has a MSGID; fetch and process it

                     keylget args MSGID mh
                     set msg [msgget $mh];
                 
                     set fieldlist [split $msg $sep]
                     set lengte [llength $fieldlist]
                     lvarpop fieldlist $lengte-1
                     set msgout [join $fieldlist $sep]

                     msgset $mh $msgout
                     lappend dispList “CONTINUE $mh”

                     return $dispList
                   }

                   time {
                     # Timer-based processing
                     # N.B.: there may or may not be a MSGID key in args
                   }

                   shutdown {
                     # Doing some clean-up work
                   }

                   default {
                     error “Unknown mode ‘$mode’ orbis_VRL_remove_last_field”
                   }
                 }

                 return $dispList
                }

                Zuyderland Medisch Centrum; Heerlen/Sittard; The Netherlands

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