xInfo.getImportedNode Method
Creates an instance of a tree node from an XPO file but does not import it into the AOT. For example, this allows you to compare it with another version of the same tree node.
Syntax
Note
The syntax of this method varies based on the version of Microsoft Dynamics AX that you are using.
Microsoft Dynamics AX 2012 R3
public TreeNode getImportedNode(
int id,
int utilfiletype,
UtilElementType utiltype,
str name,
int fileposition,
int Flag,
[boolean extraPass])
Microsoft Dynamics AX 2012 R2 (SYS)
public TreeNode getImportedNode(
int id,
int utilfiletype,
UtilElementType utiltype,
str name,
int fileposition,
int Flag)
Microsoft Dynamics AX 2012 Feature Pack (SYS)
public TreeNode getImportedNode(
int id,
int utilfiletype,
UtilElementType utiltype,
str name,
int fileposition,
int Flag)
Microsoft Dynamics AX 2012 (FPK)
public TreeNode getImportedNode(
int id,
int utilfiletype,
UtilElementType utiltype,
str name,
int fileposition,
int Flag)
Microsoft Dynamics AX 2012 (SYS)
public TreeNode getImportedNode(
int id,
int utilfiletype,
UtilElementType utiltype,
str name,
int fileposition,
int Flag)
Run On
Called
Parameters
- id
Type: int
The import context ID that is supplied by the xInfo.startImport Method.
- utilfiletype
Type: int
The type of node unless it is a documentation node.
- utiltype
Type: UtilElementType Enumeration
The type of node if it is a documentation node.
- name
Type: str
The name of the node.
- fileposition
Type: int
The position in the file to start importing from.
- Flag
Type: int
An import flag value.
- extraPass
Type: boolean
Return Value
Type: TreeNode Class
A tree node.
Remarks
The possible values for the utilfiletype parameter are those that are available in the UtilFileType Enumeration.
The possible values for the utiltype parameter are those that are available in the UtilElementType Enumeration.
For a list of the possible values for the Flag parameter, see the AOTExport macro. The values are listed under the System import flags comment.
Examples
The following example uses the getImportedNode method to create a virtual tree node.
public TreeNode getVirtualTreenode(
Filename _filename = this.fileName())
{
#AOT
#AotExport
TmpAotImport tmpImportAot;
SysImportElements sysImportElements = new SysImportElements();
TreeNode treeNodeImport = null;
int exportId;
int flag = (#impGetCompareNode + #impKeepIds);
str name;
;
// Set the filename.
sysImportElements.newFile(_filename);
// Get info from the file
tmpImportAot = sysImportElements.getTmpImportAot();
// Create an import context
exportId = infolog.startImport(_filename, flag);
// Get the right name
// for doc nodes it is the path excl. the first part
switch (tmpImportAot.UtilFileType)
{
case UtilFileType::Application:
name = tmpImportAot.TreeNodeName;
break;
case UtilFileType::ApplicationCodeDocumentation:
name = strdel(tmpImportAot.TreeNodePath, 1, strlen(#ApplicationDeveloperDocPath));
break;
case UtilFileType::ApplicationHelp:
name = strdel(tmpImportAot.TreeNodePath, 1, strlen(#ApplicationDocPath));
break;
case UtilFileType::KernelHelp:
name = strdel(tmpImportAot.TreeNodePath, 1, strlen(#SystemDocPath));
break;
default:
name = tmpImportAot.TreeNodeName;
break;
}
// Import the node in memory
treeNodeImport = infolog.getImportedNode(
exportId,
tmpImportAot.UtilFileType,
tmpImportAot.UtilElementType,
name,
tmpImportAot.FilePos,
flag);
// Close the import context
infolog.endImport(exportId, 1);
return treeNodeImport;
}