An idea, not sure if it fits in your case, if not...disregard it! 😊

1) Get the schema of your HL7 message (for example "2.5")
2) Loop the segments contained in your HL7 message (this should be fairly easy)
3) For each segment get all the fields defined for that segment on the schema it belongs to and check if contains data

To get all the possible fields of a segment, example for 2.5:PID (demo version):
Set rs = ##class(%ResultSet).%New("EnsLib.HL7.Message:EnumerateSegTypes")
Do rs.Execute("2.5:PID", 4, 1)
Do rs.%Display(",")

This way you should get all virtual path for fields with values in your message.

Repeating fields (like PatientIdentifierList()) of course require some extra coding to get/check them all.

P.S.: I think/guess 4 levels (second param in Execute()) is the maximum, otherwise....increase it.

I doubt it can be done with a generic process for any VDOC type.

For HL7 to get Virtual Property Path using names ("symbolic ones") you must know and use the "DocType" (that is the schema category and message structure) of the message.

In HL7, for a given HL7 message, it's not clear to me what you need/want as output, you want to visit all nodes/fields....defined? All possible nodes/fields defined in the schema structure? All nodes/fields that contains values?

If you need all possible nodes/fields for a given DocType, then you can get them from the Schema Definition.

For training and certification you get a corresponding Credly badge that you can add/share in your Developer Community profile or your Linkedin and other social accounts.

When you take an InterSystems training course you get attendance badge, for example:

Building and Managing HL7 Integrations Training

Certification is separate from training, when you pass a certification exam (performed by a third party entity) you get the corresponding certification Credly badge, for example:

InterSystems HL7® Interface Specialist

Hi Scott,

I don't consider 255 as larger than the typical string length and I'm surprised of your issue and I don't fully understand your code, probably because it's not complete (set tSC = rs.Insert(pInput) make no sense to me).

Anyway, my suggestion is to find some more info that may give you some hint.

For example I'd add the following lines in your OnProcessInput() method:

Set colId=pInput.GetColumnID("ExternalName")
$$$LOGINFO("ColumnType is "_pInput.GetColumnType(colId))
$$$LOGINFO("ColumnSQLType is "_pInput.GetColumnSQLType(colId))
$$$LOGINFO("ColumnSize is "_pInput.GetColumnSize(colId))

Please test this using a query that extract a few records to avoid flooding your event log.

I'm curious to see what you get.

InterSystems offers specific training course for Building and Managing HL7 integration periodically available in InterSystems offices, remote/online and on customer site. 

To get detailed info and take advantage of what it's available in InterSystem Learning, click the Learning link on left top of this page.

There you can find plenty of material regarding HL7v2 and MUCH more.

An excellent starting point would be to start with what's freely available for self learning, with a quick search I found couple of Learning Path on HL7v2:

Building Basic HL7 V2 Integrations with InterSystems

Building Advanced HL7 V2 Integrations with InterSystems

In addition to these Learning Paths there are additional more specific resources for specific topics.

In the Developer Community there are many HL7v2 articles you can learn from and maybe browsing HL7v2 related questions and provided answers can help learning.

Last but not least, in Open Exchange (fourth link on top of this page)  also contains many HL7v2 projects you can learn from.

Regarding certification, please check InterSystems Certification Program, link on top of this page.

Enjoy learning! 😊

Hi @Muhammad Waseem , nice and useful article.

Please note that for embedded SQL, since some version 2020.1, when the Universal Query Cache was introduced, it's no longer true that "SQL statements are pre-compiled into the program during development", please check relevant documentation.
 

You can find more details and a discussion of this topic, including comments from @Dan Pascothe initial dynamic SQL developer, in the post A look at Dynamic SQL and Embedded SQL