Currently, I'm on HL7 module for my current project. For HL7 project, we need to collect all of patient information and save it into text file. After that, we need to send this text file to another party. So we need to send all patient data by creating list value and separated by "|" as delimiters.
Here is example of MSH segment information.
For this case, we don't know how to check whether all of sequences are correct or not. If we check manually, it will take so long and not efficient for our testers and system analyst. That's why I need to write simple Coldfusion program for that. That's why I wrote the following coding.
<cfloop index="i" list="#MyList#" delimiters="|">
When I render above coding, it output awful result and cannot fulfill what I want. Because, it cannot output sequence number and skipped empty sequence as follow.
Fortunately, @seancorfield pointed me about to use ListToArray instead of ListGetAt here. That's why I don't need to write that much about what I want with ListToArray function. It's kinda useful and save my time. So, I've wrote as following.
<cfset arr1 = listToArray (MyList, "|", false, true)>
And result is as follow. It seems 95% work but skipped empty sequence.
So, I've read the documentation of ListToArray carefully and found that set as "false" if you don't want to skip empty value. That's why I've changed as follow and render it again.
<cfset arr = listToArray (MyList, "|", true, true)>
It works 100% and got what I want. Thanks, God. It can save my time really.