17 Oct 2014

Resource files in AX-2012

Use resource files in AxaptaIn Application Object Tree, you can find resources node.
Select resources node and right click; select Create from File, specify the file location for the new resource file. After that you can use this resource file in Axapta without specifying an absolute file path in your local/server system.

First, pick up the resource node from AOT;

SysResource::getResourceNode();

Then generate a temporary file for this resource file;

SysResource::saveToTempFile()

Finally specify the temporary file path for controls.
Here comes an example to show how to use a resource file as a background image of  a given form.

{
ResourceNode            resourceNode;
FilePath  imagename;
;
resourceNode = SysResource::getResourceNode(resourcestr(ResourceName));
if (resourceNode)
{
resourceNode. AOTload();
imagename =  SysResource::saveToTempFile(resourceNode);
}
else
{
throw Error(“No file exists.”)
}
element.design().imageName(imagename);
}

You can try This also
Add a resource file in Resource node under AOT, Right click on Resource Node -> select "Create From File"



Select a file  from your your local drive.





You can change the label and name of this file as require.






To use this image file in your code just add following code

SysResource::getResourceNodeData(SysResource::getResourceNode('theaxapta_File'));

No comments:

Create number sequence in D365 FO

Create the data type. Add code in the loadModule method of the appropriate NumberSeqModule subclass. Add a method to the module’s paramet...