How to mimic the AOT Export by layer functionality X++?

我的未来我决定 提交于 2019-12-06 06:33:52

Please have a look on the AOTExport macro.

Then read this:

#AOT
#AOTExport
TreeNode rootNode = infolog.rootNode();
;
rootNode.treeNodeExport(@'c:\fullaot.xpo', #expKeepIds | #expLables | #expLayer);

I am not sure on how to specify the layers, but it is most likely just a logical OR on the flag argument.

If in doubt take a look on the SysElementExport form and related classes.

Update: as expected the layer is specified in the bitmask.

In \Forms\SysExportDialog\Methods\getutilLayer the mask is specified as:

return 1 << layer.selection();

So if you want to export the CUS layer you do:

rootNode.treeNodeExport(@'c:\fullaot.xpo', #export | #expLayer | (1 << (UtilEntryLevel::cus+1)));

There is room for 15 bits for layers as the next flag is:

#define.expKeepIds(0x0100)

You have an example of how to pass flags to the method in the SysTreeNode.toFile() class method

#AOTExport
...
int flags;
...
flags = #expProjectOnly;
...

// This code runs on the client side only
//BP deviation documented
treenodeToExport.treeNodeExport(_filename, #export | #expKeepIds | #expLayer | flags);

...

According to the macro documentation:

// System export flags
#define.noExport(0)                 // Do not export
#define.export(1)                   // Export
#define.expKeepIds(0x0100)          // Export with ID's
#define.expLables(0x0400)           // Export labels
#define.expProjectOnly(0x800)       // Export project only
#define.expLockOnExport(0x1000)     // Lock exported elements
#define.expDefaultValues(0x2000)    // Export default properties values
#define.expLayer(0x4000)            // Export current layer only

you can only export the active layer... what is very strange, as form let you choose a layer from the list. It's a bit more strange when you get inside the SysExportDialog form code, where the list is and the export class is called, and you can't find the layer usage anywhere... so that, may be the macro documentation is right after all.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!