Homepage › Clovertech Forums › Read Only Archives › Cloverleaf › Cloverleaf › Using $% in Translate
- This topic has 9 replies, 6 voices, and was last updated 15 years, 3 months ago by Robert Kersemakers.
-
CreatorTopic
-
June 12, 2009 at 9:18 pm #50967Charlie BursellParticipant
The %$ is not something I do a lot since I usually prefer to set Tcl counters and use those. However, I am getting more people asking about the use of the $% paradigm which we are attempting to get better documented by the next release. It would be something worth covering at the next User Conference.
I have used the $% in a context like:
IF $%s1 eq 1
etc.
What I am looking for are examples of successful uses from you guys. Please send me any you have done so I can create some examples.
-
CreatorTopic
-
AuthorReplies
-
-
June 15, 2009 at 1:39 pm #68218Robert KersemakersParticipant
Hi Charlie,
Some examples.
First using $% as a counter to fill only certain outbound segments:
http://clovertech.infor.com/viewtopic.php?t=2521
Next I use $% to emulate a ‘do-while’ loop when I need to iterate over a dynamic list:
http://clovertech.infor.com/viewtopic.php?t=2213
Zuyderland Medisch Centrum; Heerlen/Sittard; The Netherlands
-
June 15, 2009 at 2:10 pm #68219Charlie BursellParticipant
Thanks Robert. These are excellent examples
-
June 15, 2009 at 3:19 pm #68220Russ RossParticipant
Look at my last post at the following URL:
<a href="http://clovertech.infor.com/viewtopic.php?t=2206&” class=”bbcode_url”>http://clovertech.infor.com/viewtopic.php?t=2206&where I posted an example of using just the $%g2 notation in a Xlate that is extermely consice to accomplish the follwoing:
Sort the inbound IN1 groups in one pass using a hashed outbound $%g2 pointer based on a compound decision in only one pass all inside the Xlate with no TCL called.A key concept I utilized in my solution was knowing optional outbound segments that aren’t populated during Xlate are dropped by Cloverleaf (Note: I also don’t use bulk copy.)This key concept coupled with a hash algorithm that spreads out the calculated outbound $%g2 pointers allowed me to perform a complex one pass sort of the inbound segments.
This is one of the slickest tricks I’ve been able to invent.
I had to arrive at it in increments of thought before the light bulb turned on, so it might take more than one reading to comprehend.
I also wish to thank Jim Kosloskey that was my sounding board and brainstorming buddy that was a big part of the discovery process.
Russ Ross
RussRoss318@gmail.com -
June 15, 2009 at 3:22 pm #68221Russ RossParticipant
Robert:
I looked at your URL posts and really enjoyed your slick solution to dynamically process a list of unknown length.
You have contribute to my Cloverleaf growth today, thanks.
Russ Ross
RussRoss318@gmail.com -
June 15, 2009 at 6:15 pm #68222Tom RiouxParticipant
Hi Charlie,
Here is something that is pretty simple that I used to check a repeating field.
-
June 15, 2009 at 8:35 pm #68223Sergey SevastyanovParticipant
Hi Charlie
Here is my xlate for Microbiology results. There are several counters that I use in IF:
$%g1 is used to determine if it’s the 1st OBR in the message (I have different processing for
-
June 15, 2009 at 9:07 pm #68224Victor LigenzaParticipant
Chrlie,
Here is an example where I had to insert a Patient Name and Account number into a report every 60 lines. This was done to assist in allowing our HPF (Electronic Medical Record) to page break results received from Medcon (Cardiology System).
{ { OP BULKCOPY }
{ ERR 0 }
}
{ { OP COPY }
{ ERR 0 }
{ IN =ORU^R01 }
{ OUT {{0(0).MSH.00009.[0]}} }
}
{ { OP COPY }
{ ERR 0 }
{ IN =R01 }
{ OUT {{0(0).EVN.00099.[0]}} }
}
{ { OP ITERATE }
{ BASIS 0(0).OBX }
{ VAR %s1 }
{ TYPE segment }
{ BODY {
{ { OP COMMENT }
{ COMMENT {TODO: Insert new actions here} }
}
{ { OP ADD }
{ ERR 0 }
{ IN {{$%s2} =1} }
{ OUT {{$%s2}} }
{ FUNCTION ADD }
}
{ { OP COPY }
{ ERR 0 }
{ IN {{$%s2}} }
{ OUT 0(0).OBX(%s2).00569 }
}
{ { OP COPY }
{ ERR 0 }
{ IN 0(0).OBX(%s1).00570 }
{ OUT 0(0).OBX(%s2).00570 }
}
{ { OP COPY }
{ ERR 0 }
{ IN 0(0).OBX(%s1).00571 }
{ OUT 0(0).OBX(%s2).00571 }
}
{ { OP COPY }
{ ERR 0 }
{ IN 0(0).OBX(%s1).00572 }
{ OUT 0(0).OBX(%s2).00572 }
}
{ { OP COPY }
{ ERR 0 }
{ IN 0(0).OBX(%s1).00573(0) }
{ OUT 0(0).OBX(%s2).00573(0) }
}
{ { OP COPY }
{ ERR 0 }
{ IN 0(0).OBX(%s1).00574 }
{ OUT 0(0).OBX(%s2).00574 }
}
{ { OP COPY }
{ ERR 0 }
{ IN 0(0).OBX(%s1).00575 }
{ OUT 0(0).OBX(%s2).00575 }
}
{ { OP COPY }
{ ERR 0 }
{ IN 0(0).OBX(%s1).00576(0) }
{ OUT 0(0).OBX(%s2).00576(0) }
}
{ { OP COPY }
{ ERR 0 }
{ IN 0(0).OBX(%s1).00577 }
{ OUT 0(0).OBX(%s2).00577 }
}
{ { OP COPY }
{ ERR 0 }
{ IN 0(0).OBX(%s1).00578(0) }
{ OUT 0(0).OBX(%s2).00578(0) }
}
{ { OP COPY }
{ ERR 0 }
{ IN 0(0).OBX(%s1).00579 }
{ OUT 0(0).OBX(%s2).00579 }
}
{ { OP COPY }
{ ERR 0 }
{ IN 0(0).OBX(%s1).00580 }
{ OUT 0(0).OBX(%s2).00580 }
}
{ { OP COPY }
{ ERR 0 }
{ IN 0(0).OBX(%s1).00581 }
{ OUT 0(0).OBX(%s2).00581 }
}
{ { OP COPY }
{ ERR 0 }
{ IN 0(0).OBX(%s1).00582 }
{ OUT 0(0).OBX(%s2).00582 }
}
{ { OP COPY }
{ ERR 0 }
{ IN 0(0).OBX(%s1).00583 }
{ OUT 0(0).OBX(%s2).00583 }
}
{ { OP COPY }
{ ERR 0 }
{ IN 0(0).OBX(%s1).00584 }
{ OUT 0(0).OBX(%s2).00584 }
}
{ { OP COPY }
{ ERR 0 }
{ IN 0(0).OBX(%s1).00936(0) }
{ OUT 0(0).OBX(%s2).00936(0) }
}
{ { OP IF }
{ ERR 0 }
{ COND {$%s1 == =60 || $%s1 == =120 || $%s1 == =180 || $%s1 == =240} }
{ THENBODY {
{ { OP ADD }
{ ERR 0 }
{ IN {{$%s2} =1} }
{ OUT {{$%s2}} }
{ FUNCTION ADD }
}
{ { OP COMMENT }
{ COMMENT {TODO: Insert new actions here} }
}
{ { OP COPY }
{ ERR 0 }
{ IN {{$%s2}} }
{ OUT 0(0).OBX(%s2).00569 }
}
{ { OP COPY }
{ ERR 0 }
{ IN 0(0).OBX(%s1).00570 }
{ OUT 0(0).OBX(%s2).00570 }
}
{ { OP COPY }
{ ERR 0 }
{ IN 0(0).OBX(%s1).00571 }
{ OUT 0(0).OBX(%s2).00571 }
}
{ { OP COPY }
{ ERR 0 }
{ IN 0(0).OBX(%s1).00572 }
{ OUT 0(0).OBX(%s2).00572 }
}
{ { OP COPY }
{ ERR 0 }
{ IN =%%PAGE }
{ OUT 0(0).OBX(%s2).00573(0) }
}
{ { OP COPY }
{ ERR 0 }
{ IN 0(0).OBX(%s1).00574 }
{ OUT 0(0).OBX(%s2).00574 }
}
{ { OP COPY }
{ ERR 0 }
{ IN 0(0).OBX(%s1).00575 }
{ OUT 0(0).OBX(%s2).00575 }
}
{ { OP COPY }
{ ERR 0 }
{ IN 0(0).OBX(%s1).00576(0) }
{ OUT 0(0).OBX(%s2).00576(0) }
}
{ { OP COPY }
{ ERR 0 }
{ IN 0(0).OBX(%s1).00577 }
{ OUT 0(0).OBX(%s2).00577 }
}
{ { OP COPY }
{ ERR 0 }
{ IN 0(0).OBX(%s1).00578(0) }
{ OUT 0(0).OBX(%s2).00578(0) }
}
{ { OP COPY }
{ ERR 0 }
{ IN 0(0).OBX(%s1).00579 }
{ OUT 0(0).OBX(%s2).00579 }
}
{ { OP COPY }
{ ERR 0 }
{ IN 0(0).OBX(%s1).00580 }
{ OUT 0(0).OBX(%s2).00580 }
}
{ { OP COPY }
{ ERR 0 }
{ IN 0(0).OBX(%s1).00581 }
{ OUT 0(0).OBX(%s2).00581 }
}
{ { OP COPY }
{ ERR 0 }
{ IN 0(0).OBX(%s1).00582 }
{ OUT 0(0).OBX(%s2).00582 }
}
{ { OP COPY }
{ ERR 0 }
{ IN 0(0).OBX(%s1).00583 }
{ OUT 0(0).OBX(%s2).00583 }
}
{ { OP COPY }
{ ERR 0 }
{ IN 0(0).OBX(%s1).00584 }
{ OUT 0(0).OBX(%s2).00584 }
}
{ { OP COPY }
{ ERR 0 }
{ IN 0(0).OBX(%s1).00936(0) }
{ OUT 0(0).OBX(%s2).00936(0) }
}
{ { OP ADD }
{ ERR 0 }
{ IN {{$%s2} =1} }
{ OUT {{$%s2}} }
{ FUNCTION ADD }
}
{ { OP COPY }
{ ERR 0 }
{ IN {{$%s2}} }
{ OUT 0(0).OBX(%s2).00569 }
}
{ { OP COPY }
{ ERR 0 }
{ IN 0(0).OBX(%s1).00570 }
{ OUT 0(0).OBX(%s2).00570 }
}
{ { OP COPY }
{ ERR 0 }
{ IN 0(0).OBX(%s1).00571 }
{ OUT 0(0).OBX(%s2).00571 }
}
{ { OP COPY }
{ ERR 0 }
{ IN 0(0).OBX(%s1).00572 }
{ OUT 0(0).OBX(%s2).00572 }
}
{ { OP COPY }
{ ERR 0 }
{ IN {{=Patient Name:} 0(0).PID.00108(0) @null @null @null @null @null {=Account Number:} 0(0).PID.00121} }
{ OUT 0(0).OBX(%s2).00573(0) }
{ COPYSEP { } }
}
{ { OP COPY }
{ ERR 0 }
{ IN 0(0).OBX(%s1).00574 }
{ OUT 0(0).OBX(%s2).00574 }
}
{ { OP COPY }
{ ERR 0 }
{ IN 0(0).OBX(%s1).00575 }
{ OUT 0(0).OBX(%s2).00575 }
}
{ { OP COPY }
{ ERR 0 }
{ IN 0(0).OBX(%s1).00576(0) }
{ OUT 0(0).OBX(%s2).00576(0) }
}
{ { OP COPY }
{ ERR 0 }
{ IN 0(0).OBX(%s1).00577 }
{ OUT 0(0).OBX(%s2).00577 }
}
{ { OP COPY }
{ ERR 0 }
{ IN 0(0).OBX(%s1).00578(0) }
{ OUT 0(0).OBX(%s2).00578(0) }
}
{ { OP COPY }
{ ERR 0 }
{ IN 0(0).OBX(%s1).00579 }
{ OUT 0(0).OBX(%s2).00579 }
}
{ { OP COPY }
{ ERR 0 }
{ IN 0(0).OBX(%s1).00580 }
{ OUT 0(0).OBX(%s2).00580 }
}
{ { OP COPY }
{ ERR 0 }
{ IN 0(0).OBX(%s1).00581 }
{ OUT 0(0).OBX(%s2).00581 }
}
{ { OP COPY }
{ ERR 0 }
{ IN 0(0).OBX(%s1).00582 }
{ OUT 0(0).OBX(%s2).00582 }
}
{ { OP COPY }
{ ERR 0 }
{ IN 0(0).OBX(%s1).00583 }
{ OUT 0(0).OBX(%s2).00583 }
}
{ { OP COPY }
{ ERR 0 }
{ IN 0(0).OBX(%s1).00584 }
{ OUT 0(0).OBX(%s2).00584 }
}
{ { OP COPY }
{ ERR 0 }
{ IN 0(0).OBX(%s1).00936(0) }
{ OUT 0(0).OBX(%s2).00936(0) }
}
{ { OP ADD }
{ ERR 0 }
{ IN {{$%s2} =1} }
{ OUT {{$%s2}} }
{ FUNCTION ADD }
}
{ { OP COPY }
{ ERR 0 }
{ IN {{$%s2}} }
{ OUT 0(0).OBX(%s2).00569 }
}
{ { OP COPY }
{ ERR 0 }
{ IN 0(0).OBX(%s1).00570 }
{ OUT 0(0).OBX(%s2).00570 }
}
{ { OP COPY }
{ ERR 0 }
{ IN 0(0).OBX(%s1).00571 }
{ OUT 0(0).OBX(%s2).00571 }
}
{ { OP COPY }
{ ERR 0 }
{ IN 0(0).OBX(%s1).00572 }
{ OUT 0(0).OBX(%s2).00572 }
}
{ { OP COPY }
{ ERR 0 }
{ IN @null }
{ OUT 0(0).OBX(%s2).00573(0) }
}
{ { OP COPY }
{ ERR 0 }
{ IN 0(0).OBX(%s1).00574 }
{ OUT 0(0).OBX(%s2).00574 }
}
{ { OP COPY }
{ ERR 0 }
{ IN 0(0).OBX(%s1).00575 }
{ OUT 0(0).OBX(%s2).00575 }
}
{ { OP COPY }
{ ERR 0 }
{ IN 0(0).OBX(%s1).00576(0) }
{ OUT 0(0).OBX(%s2).00576(0) }
}
{ { OP COPY }
{ ERR 0 }
{ IN 0(0).OBX(%s1).00577 }
{ OUT 0(0).OBX(%s2).00577 }
}
{ { OP COPY }
{ ERR 0 }
{ IN 0(0).OBX(%s1).00578(0) }
{ OUT 0(0).OBX(%s2).00578(0) }
}
{ { OP COPY }
{ ERR 0 }
{ IN 0(0).OBX(%s1).00579 }
{ OUT 0(0).OBX(%s2).00579 }
}
{ { OP COPY }
{ ERR 0 }
{ IN 0(0).OBX(%s1).00580 }
{ OUT 0(0).OBX(%s2).00580 }
}
{ { OP COPY }
{ ERR 0 }
{ IN 0(0).OBX(%s1).00581 }
{ OUT 0(0).OBX(%s2).00581 }
}
{ { OP COPY }
{ ERR 0 }
{ IN 0(0).OBX(%s1).00582 }
{ OUT 0(0).OBX(%s2).00582 }
}
{ { OP COPY }
{ ERR 0 }
{ IN 0(0).OBX(%s1).00583 }
{ OUT 0(0).OBX(%s2).00583 }
}
{ { OP COPY }
{ ERR 0 }
{ IN 0(0).OBX(%s1).00584 }
{ OUT 0(0).OBX(%s2).00584 }
}
{ { OP COPY }
{ ERR 0 }
{ IN 0(0).OBX(%s1).00936(0) }
{ OUT 0(0).OBX(%s2).00936(0) }
}
}}
{ ELSEBODY {
}}
}
}}
}
-
June 15, 2009 at 9:44 pm #68225Charlie BursellParticipant
You guys are just too Good! 😀
I will certainly make reference to this thread in my slides
Thanks
Charlie
-
June 16, 2009 at 11:40 am #68226Robert KersemakersParticipant
Russ: Thanks! I had one bright idea these last 9 years… 😉
Zuyderland Medisch Centrum; Heerlen/Sittard; The Netherlands
-
-
AuthorReplies
- The forum ‘Cloverleaf’ is closed to new topics and replies.