Joao Palma · Aug 13, 2018

Query XML messages by Property Path


I need to query my messages and filter by a XML node.  

In the message viewer it would be Critetion Type = 'VDoc Property Path' and class = 'Enslib.Edi.XML.Document'.


At the moment my query looks like this


FROM EnsLib_EDI_XML.Document

where doctype = 'avc:mydoctype'

I need then to look for 'HeadNode:SubNodeValue'

Anyone who could help me out with this?

Thank you

0 487
Discussion (5)1
Log in or sign up to continue

If I understand your question correctly then I think you'd benefit from defining and using a Search Table.

See from the Documentation -

If you need to query specifically via SQL (and not using the Message Viewer) then see also this answer (though relating to HL7, but relevant in the same way to the XML case) regarding using the Search Table within a query.

Thank you Tani. 

The issue here is Ensemble does not retroactively index messages that were received before you added the search table class. 

I need some information from the Past. I must create a report on the XML received messages since April based on one of the xml nodes values which distinguishes the document types.

The issue of indexing data previously processed (before the Search Table was defined for the Business Service/Operation) is addressable by calling the BuildIndex() method of the relevant SearchTable class.

For example:

Set sc=##class(YourPackage.YourSearchTableClass).BuildIndex()

That's brilliant. Thank you very much.

Happy this helped.

In general (you might be aware of this, but for the benefit of the Community) a good resource about searching Messages (including Search Tables and SQL, and other options), is this Online Course.