Using table to output multiple values

Clovertech Forums Read Only Archives Cloverleaf Cloverleaf Using table to output multiple values

  • Creator
    Topic
  • #53248
    John Stafford
    Participant

      We appear to have a number of patients that are parts of grants and therefore do not have IN1 segments generated. We have been sending this information out from our registration system to our AS400 backend, where they are performing a lookup on the Guarantor ID (GT1.3) to populate the UB and Financial Class fields (this was all done before I came into this position).

      This information goes to a second system that does not have the ability to do the translation. Therefore, I have built a table with the left column being the Guarantor # and the right column containing the UB and Financial Class designations, separated by a space. I am looking to put a small snip of tcl code to take the two values from the table conversion and assign them to the two fields.

      If I put a post proc on the action in the xlate, what would I use to grab the output from the table? Once I have the output, I could split the 2 values up and send them out to the xlateOutVals.

      Thanks.

    Viewing 9 reply threads
    • Author
      Replies
      • #77039
        Jim Kosloskey
        Participant

          John,

          If I understand correctly, here is what I would do:

          1. Use the Xlate Table Lookup Action to do the Table Lookup placing the result in a temp variable.

          2. I would use a reusable proc we have that splits a list into multiple Destinations. The source would be the tempvariable from above and the Destinations would be the two fields you are wanting filled.

          If you would like that proc, let me know via email and I will send it tou you.

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

        • #77040
          Chris Williams
          Participant

            Code:

            set tableOutput [tbllookup $tableName $guarId]
            set ub [lindex $tableOutput 0]
            set fc [lindex $tableOutput 1]

          • #77041
            John Stafford
            Participant

              Thanks for the responses, guys.

              Lets say that @var1 holds “17 S”, and that the output is two fields. Would xlateInVals make that a list that is 17 and S?

              If so, I’m wondering if doing the assignment wouldn’t be as simple as using @var1 as the Input, having the two destination fields as the output, and using this little snip of code:

              Code:

              set xlateOutVals [list $xlateInVals]

              Or would I have to split it and output them separately?

              Code:

              set ub [lindex $xlateInVals 0]
              set fc [lindex $xlateInVals 1]

              set xlateOutVals [list $ub $fc]

              I’m still getting used to tcl and Cloverleaf, and I’m not certain of the behavior of certain commands and the xlateInVals/xlateOutVals. Thanks, again!

            • #77042
              John Stafford
              Participant

                I did some messing around with the tcl command line, and by my estimation xlateInVals is going to be a single member list with {17 S} as the only member.

                If I understand the way that xlateInVals and xlateOutVals work, I will then have to pass a 2 member list to xlateOutVals to assign it to two different fields.

                What I am wondering, though, is if this can all be done in the ‘Table’ xlate action as a post proc. Does the value that comes out of the table get assigned to an intermediate variable, like xlateTableOut?

              • #77043
                Jim Kosloskey
                Participant

                  John,

                  I believe you cannot affect the xlateOutVals in the post proc.

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

                • #77044
                  Daniel Lee
                  Participant

                    Can’t he just use a TABLE action with the GT1.3 as the source and then have both the UB and Financial Class as the destination?  If what’s coming out of his table is a list then the first element should populate the first field designated in the Destination and the second element should populate the second field in the Destination.

                  • #77045
                    John Stafford
                    Participant

                      Jim,

                      Thanks again for the swift response. I am speaking of the pre and post proc sections within the Table action. In the bottom frame, where you specify input and output fields, the middle tcl section has pre and post tabs.

                      My assumption is that the pre proc tab is for transformations to happen to the input before it gets checked by the table, whereas the post proc tab is for things to happen before it gets assigned to the output variable.

                      Unfortunately, I cannot find much about it within the ‘Help’. I suppose I’ll just do some testing to feel it out!

                    • #77046
                      John Stafford
                      Participant

                        Daniel Lee wrote:

                        Can’t he just use a TABLE action with the GT1.3 as the source and then have both the UB and Financial Class as the destination?

                      • #77047
                        Jim Kosloskey
                        Participant

                          John and Daniel,

                          No that won’t work because the value from the retrieved side of the Table lookup is a single list element in xlateOutVals which is in itself a list (like this {stuff junk} (in this case separated by a space as I think John Indicated).

                          So if the Destination of the Table lookup were two fields or two components only the first element in the Destination would get the entire retrieved value (stuff junk).

                          You will need a tcl proc to split those entries out into the target fields following the lookup (or you can do it all in one).

                          We prefer using the builtin Table Xlate Action then following with a generic proc which splits fileds regardless of the source.

                          Once again, if you would like that proc even as an example email me and I will send it to you.

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

                        • #77048
                          Russ Ross
                          Participant

                            Jim:

                            I have an old post on Cloverlertech with the source code for xlt_splitflds.tcl you are talking about and an example of screen shots showing how to use it at this URL:

                            <a href="https://usspvlclovertch2.infor.com/viewtopic.php?t=1570&&#8221; class=”bbcode_url”>https://usspvlclovertch2.infor.com/viewtopic.php?t=1570&amp;

                            Russ Ross
                            RussRoss318@gmail.com

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