Pass Value into Proc

Clovertech Forums Read Only Archives Cloverleaf Cloverleaf Pass Value into Proc

  • Creator
    Topic
  • #51962
    Davin Studer
    Participant

      Ok, so I am new to Cloverleaf.  I am pretty familiar with TCL though.  My question is how do I pass a value into a proc from within Cloverleaf.  Specifically not one of the HL7 values.  I am trying to create a generic proc that will do a lookup to a table.  I want to pass table name into the proc so that we can use different tables based on different circumstances.  The TABLE action will not work in this case because if the value doesn’t exist in the table it either passes a blank back, or a default value.  I want to pass back the original value if it doesn’t exist in the table.  So, if the value is in the table pass back the translation, if not pass back the original.

      Anyway, I want to create a proc that I can pass table name in as a variable so that we can use this is other circumstances … rather than create a new proc for each time we have to do this.  My question is how do I pass in the table name.  Can I set it as some sort of global variable, or it there some way to do it at the action level?

      Thanks for any help.

    Viewing 1 reply thread
    • Author
      Replies
      • #72511
        Jim Kosloskey
        Participant

          This is done differently depending on whether you are doing this with a Tps type proc or an xltp type proc.

          For a Tps type proc you have 2 choices.

          1. add the arguments to the NetConfig where you invoke the proc (I like using keyed lists but this is your preference).

          2. use a table to contain the arguments (you can devine a table name from the information available to you at execuution time so there is no need to specify the table name. I am using this method more and I like it better than specifying the arguments in the NetConfig in general.

          For an xltp type proc (which is what I am guessing you are talking about you can just place the arguments in the Source of the CALl or COPY and then your proc upvars the xlateInVlas, etc. and xlateOutVals, etc. to get the argument.

          If you email me I will send you an xltp type proc that dores what you want and then you can have an example.

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

        • #72512
          Davin Studer
          Participant

            Thanks a ton for the email.  That helped a lot.  I figured out too that you can just pass a value into the proc by just putting the value after the proc name.  for instance if my proc looked like this …

            Code:


            proc myProcName {value} {
            }

            I could do this in my xlt …

            Code:


            myProcName passedInValue

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