Referencing repeating field

Clovertech Forums Read Only Archives Cloverleaf Cloverleaf Referencing repeating field

  • Creator
    Topic
  • #53672
    John Stafford
    Participant

      Hi all,

      I’ve read through several posts addressing iteration questions and adding/removing repeating segments. I don’t believe that any of them address the question that I have.

      I am looking to iterate through the Consulting Physician field (PV1-8). In this field there can be multiple physicians, and each physician can have multiple physician IDs. For example, consulting physician 1 can have an internal ID, an external ID and a National Provider Index (NPI) ID. Consulting physician 2 can have the same information. I would like to strip out all non-NPI IDs for each physician, leaving only the NPIs for each physician.

      |001^ONE^PHYSICIAN^Internal~010^ONE^PHYSICIAN^External~100^ONE^PHYSICIAN^NPI~002^TWO^PHYSICIAN^Internal~020^TWO^PHYSICIAN^External~200^TWO^PHYSICIAN^NPI|

      I have the logic to iterate through the repeated fields and identify the NPI. My question is simple: can I manipulate a field iteration variable independently? Here is sample tcl code for within an xlate:

      set npi “NPI”

      set providerID $xlateInVals

      if {[lsearch -regexp $providerID $npi]} {

      set xlateOutVals $providerID

      }

      What I would like to do is have some sort of counter within the if statement that would be incremented, and use that in the Destination, i.e. 0(0).PV1.#7([counter]). I want to have PV1.#7(0) be the first physician NPI, and PV1.#7(1) be the second. I do not know if I need to manually increment an iteration variable, or if I can just put a $physCnt in the destination; or if I’m making this unnecessarily complicated, overlooking a more simple solution.

      As always, any insight is appreciated.

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

          John,

          I have done what I think you want to do without any Tcl. just Xlate Actions.

          To the point you can manage your own ITERATion counter for the field level just as with any other ITERATE level (group, segment, etc.).

          You CANNOT use anything besides a number or an ITERATE counter in a field address path – if you do it will be treated as zero thereby defeating the purpose.

          If you would like to discuss in more depth, email me and I will discuss with you.

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

        • #78510
          Russ Ross
          Participant

            I think if you come to understand how to use the $% syntax in an xlate the need for TCL procs will be reduced.

            Overall our observation has been a wider range of people can support a xlate, while supporting TCL procs limits the support staff to more experienced people.

            Here is a URL to show how others have used the $% syntax in a xlate to avoid writing TCL.

            <a href="https://usspvlclovertch2.infor.com/viewtopic.php?t=3706&highlight=in1&#8243; class=”bbcode_url”>https://usspvlclovertch2.infor.com/viewtopic.php?t=3706&highlight=in1

            This will give you some tangible examples to try and gain understanding of how $% syntax can be used for your own counters/pointers within an xlate without resorting to TCL procs.

            Russ Ross
            RussRoss318@gmail.com

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