xlateOutVals returns different value than passed to it

Clovertech Forums Read Only Archives Cloverleaf Cloverleaf xlateOutVals returns different value than passed to it

  • Creator
    Topic
  • #53797
    Weston Olmstead
    Participant

      Hi,

      I’m having an

    Viewing 5 reply threads
    • Author
      Replies
      • #78958
        Charlie Bursell
        Participant

          xlateOutVals is also a list

          Try set xlateOutVals

            The first element of XlateOutVals is assigned to the first outbound address,  the second element to the next address and so forth

            Since you have only one outbound address the other elements are discarded

        • #78959
          Weston Olmstead
          Participant

            Thank you for the assistance, that worked.

            If you don’t mind further elaborating so I can fully understand: How did Cloverleaf know where the start and stop of each list element was?

            When I get my input value,”First M” ,  in the TCL I’m doing that by by setting a variable to  lindex of xlateInVals 0. I was under the impression lindex is grabbing the first entry in the list xlateInVals in its entirety and assigning it to my input value.

            Why does the TCL/Cloverleaf then think they are different elements when I assign it back out to xlateOutVals since I grabbed the first element only for my input?

          • #78960
            Charlie Bursell
            Participant

              Tcl does not think they are different they are just lists

              xlateIVals is a list of the input values, one for each input address

              So if you had 3 input addresses, xlateInVals would have 3 elements

              Likewise, xlateOutVals will contain one element for eacH OB address

              So if you had three OB addresses the first element would go to the first address, the second to the second address and the third to the third address.  If there are more elements in the list than output adresses they  will be discarded

              Look at it this way

              xlateInVals is a list that aligns with the list xlateInList

              xlateOutVals is a list that aligns with the list xlateOutList

              I hope it makes sense.  If not perhaps someone else can put it in terms you can understand

            • #78961
              Jim Kosloskey
              Participant

                I will add something.

                When you got the first element from xlateInVals you got ‘First M ‘.

                You then trimmed the right hand space and got ‘First M’.

                At this point this is a string because it is in a Tcl variable which is a string.

                When you place it in xlateOutVals as a string it is there for Cloverleaf to use – BUT because Cloverleaf treats what is xlateOutVals as a LIST before it places the value(s) in a message and since the space is part of the ‘white noise’ character set the LIST functions use to delimit a list, Cloverleaf sees a list of 2 elements in your string and it knows each element goes to different destinations.

                Try using tcl or hcitcl from the command line.

                do this:

                set stuff “First M”  <– this gives you what you have in yout literal after trimming

                Now do this:

                lindex $stuff 0 <– this gets the first element of the list – you will get 'First'

                If you were to use the foreach Tcl command against $stuff and echo out the contents you would get 2 elements ‘First’ and ‘M’.

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

              • #78962
                Robert Kersemakers
                Participant

                  And to further clarify (I always use a lot of echo’s to see what is going on).

                  If you use your

                  Code:

                  set xlateOutVals $outputString
                  echo $xlateOutVals


                  you will see

                  Code:

                  First M

                  However, if you treat xlateOutVals as a list:

                  Code:

                  set xlateOutVals [list $outputString]
                  echo $xlateOutVals


                  you will get

                  Code:

                  {First M}

                  If a list element contains a space, tcl will put it in braces to be able to see it as a separate element. If there is no space in the list element, no brackets are used.

                  Zuyderland Medisch Centrum; Heerlen/Sittard; The Netherlands

                • #78963

                  xlateInVals and xlateOutVals are engine tcl LIST variables. They are not string variables. It is a best practice to use list command and not string commands on list variables.

                  Code:

                  set var1 [lindex $xlateInVals 0]
                  set xlateOutVals [list $var1]

                  -- Max Drown (Infor)

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