› Clovertech Forums › Read Only Archives › Cloverleaf › Cloverleaf › Using $% in Translate
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.
Hi Charlie,
Some examples.
First using $% as a counter to fill only certain outbound segments:
https://usspvlclovertch2.infor.com/viewtopic.php?t=2521
Next I use $% to emulate a ‘do-while’ loop when I need to iterate over a dynamic list:
https://usspvlclovertch2.infor.com/viewtopic.php?t=2213
Zuyderland Medisch Centrum; Heerlen/Sittard; The Netherlands
Thanks Robert. These are excellent examples
Look at my last post at the following URL:
<a href="https://usspvlclovertch2.infor.com/viewtopic.php?t=2206&” class=”bbcode_url”>https://usspvlclovertch2.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
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
Hi Charlie,
Here is something that is pretty simple that I used to check a repeating field.
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
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 {
}}
}
}}
}
You guys are just too Good! 😀
I will certainly make reference to this thread in my slides
Thanks
Charlie
Russ: Thanks! I had one bright idea these last 9 years… 😉
Zuyderland Medisch Centrum; Heerlen/Sittard; The Netherlands