I’m working on a HL7 translation that has me stumped. Here’s a pseudo code of, what I’m attempting to accomplish:
Copy all components starting from the source’s OBX.#5.[1] to the destination, starting at the destination’s OBX.#5.[0]
Here are examples of how that should look:
|=^20.2| would copy as |20.2|
|=^1^+| would copy as |1^+|
|=^20^:^06| would copy as |20^:^06|
In other words, I don’t want to erase or @null the data in OBX.#5.[0], rather I need to shift the data… So OBX.#5.[1] becomes .[0], .[2] becomes .[1], .[3] becomes .[2], and so on.
The issue I’m struggling against is, I don’t necessarily know how many components will be in the source field. But since xlateOutVals is a list, I have to specify multiple destinations, right? Do I just guess by putting .[0] through .[99] in the destination, and hope for the best?
It just feels like there should be a more efficient and reliable way of doing this.
Any help or suggestions are greatly appreciated.