Is it possible to Iterate through a Destination Group?

Homepage Clovertech Forums Read Only Archives Cloverleaf Cloverleaf Is it possible to Iterate through a Destination Group?

  • Creator
    Topic
  • #51402
    Ryan Spires
    Participant

    Just curious if anyone has ever found the need or tried iterating through the and outbound set of data…

    For example, I have already copied my data to the outbound, but may want to go back through the data to look for specific data that needs changed as the actual value is calculated (page number for example)

    I attempted to do the following:

    Iterate:

    Type: group

    Basis: ~1(0).1(0).3    (notice the tilde)

    variable %g2

    I was hopeful to be able to reiterate and regsub a value to replace a “placeholder value” in the data, but alas getting

    [0:TEST] Mismatched IR Tags

    in the testing tool…

    Ryan Spires

Viewing 5 reply threads
  • Author
    Replies
    • #70116
      Jim Kosloskey
      Participant

      You cannot ierate over the outbound message – any of it – in the Xlate.

      There are some potentials with a later release when stacking of Xlates will be allowed.

      Some folks will use a post-xlate Tcl proc if needed.

      I have been successful in the past avoiding the need by being very careful how I buiuld the outbound as I iterate through the inbound – I have also deployed multiple iterates over the inbound. The first iterate builds the outbound the second iterate controls the repetitions but actually checks the outbound values and adjusts. This is a little trickier and does not allow for the repetition sets of inbound and outbound to be different in that if there are 10 inbound segments, there are also 10 outbound segments for example.

      I did once a long time ago however, actually check mismatched inbound and outbound occurrences. I recall it was relly pretty tricky and  even with lots of comments was difficult to come back to and follow.

      email: jim.kosloskey@jim-kosloskey.com

    • #70117
      Ryan Spires
      Participant

      Thanks Jim,

      I thought that was the case… but was hopful 🙂

      Ryan

    • #70118
      Chris Williams
      Participant

      Ryan,

      We don’t have much info on exactly what you’re trying to accomplish.  There should be a way to do what you want without trying to use Iterate over the outbound. If it’s something like fixing a page number, just calculate the page number as you iterate over the inbound and use the correct number as you write the outbound. It’s the same principle as adjusting SetID numbers when you’re not sending all of the segments.

      Chris

    • #70119
      Ryan Spires
      Participant

      I can get the current page number by doing so… however, the end users are wanting a “Page x of y”  where y is the total number of pages.   This number is based on a set number of OBX’s where I am inserting details as I go along (header and footer) for each page.

      for example…  Header of 5 lines (or so) then obx’s from inbound until i reach a certain count, then a few lines of footer (with page number details). Then another header of 5 lines, next set of obx’s, etc… until i am done with the obx’s.

      We are doing something similar in a proc to create an ascii based document per se… but we have been asked if we could accomplish similar functionality with the hl7…  

      Granted, I could just simply modify the proc to generate the HL7 also, but was looking to see if it could be done in an Xlate (my preferred method of translation)

      Ryan

    • #70120
      Jim Kosloskey
      Participant

      To get the total and put it in the outbound without much (or maybe no) Tcl you could iterate 2 times once just to count, the second to actually place the data for each repetition and add the count obtained  from the first iterate to the data.

      email: jim.kosloskey@jim-kosloskey.com

    • #70121
      Chris Williams
      Participant

      One possibility could be saving pointers to the segments (subscripts to the outbound OBX segments) that you want to update in a temporary list, and after you’ve written all your segments to the outbound and you have your your ending page number, use those pointers to update the appropriate segments. You don’t have to iterate over the outbound segments because you already know which ones you want to update.

      You can do this all in the xlate with just a few lines of tcl. Initialize the list variable, lappend the segment numbers to it as you process the inbound OBXs, then loop through the list variable to get the segment numbers you are going to write to with the “page x of y” information. Once those segments exist in the outbound, it becomes random access rather than sequential.

      Email me if you’d like to go into specifics.

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

Forum Statistics

Registered Users
4,968
Forums
28
Topics
9,109
Replies
33,637
Topic Tags
248