Processing multiple rows from a CSV to create a single message

0 votes
asked Jan 10, 2023 by daniel-d-7319 (270 points)
I have a CSV file that I will be using to create ADT and DFT messages.  Each row in the CSV will detail Patient Demographics and a single line item for what may be multiple line items for a patient encounter.

I can read the first row and create an ADT message to send on it's way.  I can then start to generate a DFT message and create the first FT1 segment from data in the first row.  How to I get to the next row in the CSV file to create the next FT1 segment.  

I will know when to complete the DFT file by looking at the next row and seeing that the encounter ID has changed.  IE, Is there a function to read the next row in a CSV file?

1 Answer

+1 vote

You can change the number of rows for each group, which will allow you to access multiple rows in the CSV.

On the Source node, select the CSV Format tab.  In the lower right-hand corner, there is an option called "# of rows to include in each group".  It defaults to 1, but if you set it to a different number, each message will contain that many rows.

You can access the the rows in a group by appending [number] to your message.getNode() calls, i.e. message.getNode('PatientID[2]') will get the second row for the column called "PatientID".  message.getNode(1[3]) will get the first column data from the 3rd row, etc.


If you don't know the number of rows for each patient, but each row has a column with the same data (i.e. a patient ID or other unique identifier tying the rows together), you can use "Column value" in the Group By drop-down.  The right side option changes to "Index of column to monitor for value changes", where you would put the column number of the patient ID or other unique ID.  QIE will create a message with as many rows that have the same data in that specific column.  You can then use message.getRowCount() to find out how many rows you have in each message, and work with those rows as appropriate.


answered Jan 10, 2023 by jon-t-7005 (6,910 points)
edited Jan 10, 2023 by jon-t-7005