Problem with lappend

Clovertech Forums Read Only Archives Cloverleaf Tcl Library Problem with lappend

  • Creator
    Topic
  • #50998
    Garrett Fletcher
    Participant

      Hello,

      I am having trouble with the lappend command. I set up a list, then append things to the list. When I try to echo the list later in my code the list is blank.

      Does anyone know what is wrong?

      Thank you,

      Garrett

      Code:



      set newSegmentList [list 0]

      lappend $newSegmentList [lindex $segmentList $loopCountOBR]
      lappend $newSegmentList “NTE|||~*LAB CANCEL REQUEST* ~The test identified as: FE DEF PANEL has been cancelled. Please confirm receipt of the Lab within the EMR and FILE IN ERROR. Note: This cancel request should be removed from the chart.”

    Viewing 1 reply thread
    • Author
      Replies
      • #68352
        James Danley
        Participant

          Garrett,

          If a command argument calls for a variable name then don’t use a dollar sign. So remove the dollar sign from your variable:

          set newSegmentList

        • lappend newSegmentList [lindex $segmentList $loopCountOBR]

          lappend newSegmentList “NTE|||~*LAB CANCEL REQUEST* ~The test identified as: FE DEF PANEL has been cancelled. Please confirm receipt of the Lab within the EMR and FILE IN ERROR. Note: This cancel request should be removed from the chart.”

          That should fix your problem!

          James

        • James Danley | Learning Consultant, Principal
          James.Danley@infor.com | http://www.infor.com

    • #68353
      Garrett Fletcher
      Participant

        Sweet! That did the trick! Thank you James.

        Garrett

      • Viewing 1 reply thread
        • The forum ‘Tcl Library’ is closed to new topics and replies.