The XMLExchange Plus Help file explains how and why the Edit Engine still expects a flat-format data buffer. Sample C++ code in that help file demonstrates how I process edits from NAACCR XML in the application that CDC/NPCR prepared to help programmers transition to the new data exchange format.
The key to generating the data buffer is to ask the Edit Engine for the structure of the Layout the user selects for running edits; the code demonstrates how EDITS50 functions make that happen.
But my C++ code sample looks up every data item used in the Layout to see if a value has been provided in the XML file. Not every data item is edited by every edit set, so retrieving non-edited items from XML to write to the flat buffer is just a waste of processor cycles.
For example, the last time I saw a v18 metafile, the NAACCR DATA EXCHANGE VS 18 layout had 811 fields. If the user is running the edit set Central: Vs18 State Example – Incoming Abstracts only 376 data items are actually edited. That means for every case record you can ignore trying to populate 435 fields. This can make a real difference to processing time on large data files.
The EDITS50 API provides functions for querying the metafile for pretty much anything you want to know about it. Use this SQL to get a list of the data items from the selected Layout that are edited by the selected edit set(s):
SELECT DISTINCT fld.FieldNumber as naaccrNum,
FROM EE_EditSetEditsPivot piv,
EE_EditSets es, EE_EditFieldsPivot ef,
WHERE piv.EditSetPKey = es.PKey
AND ef.EditPKey = piv.EditPKey
AND ef.FieldPKey = fld.PKey
AND lopiv.FieldPKey = fld.PKey
AND lopiv.LayoutPKey = lo.PKey
AND lo.LayoutTag = 'RL00002' /* the NAACCR DATA EXCHANGE VS 18 layout */
AND es.EditSetTag IN ('NES0150') /* the sample edit set */
ORDER BY 3, 4 DESC;
Prior to the processing loop, load this information into a list of your own objects, as my code suggests in the XMLExchange Plus help file, and where my code iterates std::map FLayoutFields, yours will iterate your list to write data values taken from the XML data file to their proper place in the edits data buffer.
A useful tool for experimenting with SELECT statements is the MetafileBrowser included in the EditWriter v5 installer available from CDC/NPCR. And, as with all of the other EDITS50 tools, it comes with its own help file.