multiple string commands in one line

Homepage Clovertech Forums Read Only Archives Cloverleaf Cloverleaf multiple string commands in one line

  • Creator
    Topic
  • #51397
    Tim Gobbel
    Participant

    We need to both map a “/” to a “-” and truncate a field to 10 characters.  We have the two string commands to do this (map and range) but were wondering if these can be combined in one line for a pre proc in an xlate using the xlateInVals.  Thanx!

Viewing 3 reply threads
  • Author
    Replies
    • #70106

      Please post your current code and some sample data.

      -- Max Drown (Infor)

    • #70107
      Tom Rioux
      Participant

      Try the following:

      set var [lindex $xlateInVals 0]

      set xlateOutVals [string range [string map “/ -” $var] 0 9]

      I haven’t tested it so you may need to try this for the xlateOutVals

      set xlateOutVals

        0 9]]

        Example from hcitcl:

        hcitcl>set var “MED/OB OUTPATIENT”

        MED/OB OUTPATIENT

        hcitcl>string range [string map “/ -” $var] 0 9

        MED-OB OUT

        Hope this helps…

        Tom Rioux

      1. #70108
        Tim Gobbel
        Participant

        Thanx!  We will put this in the preproc and test.  We will post the results.  Thanx!

      2. #70109
        Tim Gobbel
        Participant

        We put in:

        set var [lindex $xlateInVals 0]

        set xlateOutVals

          0 9]]

          and it is working to exchange the “/” and truncate the field to 10.

          Thanx!

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

      Forum Statistics

      Registered Users
      5,042
      Forums
      28
      Topics
      9,200
      Replies
      34,023
      Topic Tags
      267