Tcl Eval Trouble Calling Namespace

Homepage Clovertech Forums Read Only Archives Cloverleaf Cloverleaf Tcl Eval Trouble Calling Namespace

  • Creator
    Topic
  • #50949
    Jerry Tilsley
    Participant

    All,

    I have the following code


    if {$type == “support”} {
    set result [eval “SCRLibraryEDM_support::WriteEDMHeader” {$doctype $foldertype $foldername $filename $facname $acctno $servdate $mrn $docdescrip $processed}]
    echo “<$result>”
    }
    [/code.

    but would rather do something like this:

    [code]
    set result [eval SCRLibraryEDM_$type::WriteEDMHeader {$doctype $foldertype $foldername $filename $facname $acctno $servdate $mrn $docdescrip $processed}]
    [/code

    But when I do that I get a tcl error saying “type::WriteEDMHeader” is not a valid variable.  Why is the substitution not working here?  Can someone provide me some hints as to the correct syntax?

    Thanks,

    Jerry[/code][code]
    if {$type == “support”} {
    set result [eval “SCRLibraryEDM_support::WriteEDMHeader” {$doctype $foldertype $foldername $filename $facname $acctno $servdate $mrn $docdescrip $processed}]
    echo “<$result>“
    }
    [/code.

    but would rather do something like this:

    [code]
    set result [eval SCRLibraryEDM_$type::WriteEDMHeader {$doctype $foldertype $foldername $filename $facname $acctno $servdate $mrn $docdescrip $processed}]
    [/code

    But when I do that I get a tcl error saying “type::WriteEDMHeader” is not a valid variable.  Why is the substitution not working here?  Can someone provide me some hints as to the correct syntax?

    Thanks,

    Jerry[/code]

Viewing 1 reply thread
  • Author
    Replies
    • #68163
      Ron Archambault
      Participant

      Jerry,

      Try putting { } around type.

      SCRLibraryEDM_${type}::WriteEDMHeader

      That should work for you.

    • #68164
      Jerry Tilsley
      Participant

      Beautiful!  I had tried {$type} before but the brackets would stay.  So your thought of putting the $ outside of the brackets fixed it!

      Thanks!

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

Forum Statistics

Registered Users
5,126
Forums
28
Topics
9,297
Replies
34,440
Topic Tags
287
Empty Topic Tags
10