We had interesting problem with updating of some data entities' DefaultDimension. Normally for update Connector asks for original data (performs find operation), uses those data as default data and overwrite only those data where values are provided from 3rd party system. It means that any of data defaulted in AX, when create operation was performed, is not overwritten by empty values.
Originally I wanted to write about my problems with Dynamics AX and their solutions. But then I started to play with Dynamics CRM and original purpose of my blog has been changed. Now it is a collection of the problems which I found on my way through my life with AX and CRM .o)
Showing posts with label ax. Show all posts
Showing posts with label ax. Show all posts
Tuesday, 12 May 2015
Wednesday, 11 February 2015
Default Dimensions seem to be just single field of type long instead of dictionary entity in Connector and in VS
There is probably
incorrect Extended Data Type on DefaultDimension field in table. There should
be DimensionDefault. If there is another one (e.g. RefRecId) then correct code
is not generated by AIF wizard to Ax<Table> class and to Data object class.
Ax<Table>
class:
change EDT in parmDefaultDimension method to
"DimensionDefault"
<Service>_<Table>
class:
add method
createDefaultDimension
public AifDimensionAttributeValueSet createDefaultDimension()
{
return this.get_NewContainer(#DefaultDimension);
}
change method
parmDefaultDimension
public
AifDimensionAttributeValueSet
parmDefaultDimension(AifDimensionAttributeValueSet _value = null)
{
if (!prmisDefault(_value))
{
this.set_Container(#DefaultDimension,
_value);
}
return
this.get_Container(#DefaultDimension);
}
Friday, 28 March 2014
Ax 2012: Pass printer settings from class dialog to SSRS report
For one project I needed to create standard runnable class which calls SSRS report in a while loop. The question was how to work with the printer/destination settings.
Solution:
1. Create your runnable class "YourController" from which you will control calls of your report "YourReport".
2. Create your printer setup class "YourPrinterSetup".
class YourPrinterSetup extends RunBase
{
Map mapPrinterSettings;
YourController baseClass;
Args args;
#define.CurrentVersion(1)
#localmacro.CurrentList
mapPrinterSettings
#endmacro
}
void new(Args _args)
{
;
mapPrinterSettings = new Map(Types::Enum, Types::Container);
Args = _args;
}
public container pack()
{
return [#CurrentVersion, [#CurrentList, mapPrinterSettings.pack()]];
}
public boolean unpack(container _packedClass)
{
Version version;
container packedPrinterSettings, packedOutPaymRecordList, packedValues;
version = RunBase::getVersion(_packedClass);
switch (version)
{
case(#CurrentVersion) :
[version, packedValues] = _packedClass;
[#currentList, packedPrinterSettings] = packedValues;
break;
default :
return false;
}
if (packedPrinterSettings)
{
// Recreate the object from the packed values.
mapPrinterSettings = Map::create(packedPrinterSettings);
}
else
{
mapPrinterSettings = new Map(Types::Enum, Types::Container);
}
return true;
}
static void main(Args _args)
{
YourPrinterSetup printSetup = new YourPrinterSetup(_args);
printSetup.run();
}
updatePrinterSettings is used to store chosen settings.
public void updatePrinterSettings(container _printerSettings)
{
mapPrinterSettings.insert("1", _printerSettings);
baseClass.setPrinterSettings(_printerSettings);
}
In run method the standard SRSPrintDestinationSettings class is called.
void run()
{
SrsPrintDestinationSettings printSettings;
FormRun printSettingForm;
boolean ok = true;
Object caller = args.caller();
baseClass = caller.runbase();
printSettings = new SrsPrintDestinationSettings();
printSettings.unpack(this.getPrinterSettings());
printSettings.fromPage(1);
printSettings.toPage(99999999);
args.caller(printSettings);
args.name(formstr(SRSPrintDestinationSettingsForm));
printSettingForm = classfactory.formRunClass(args);
printSettingForm.init();
printSettingForm.run();
printSettingForm.wait(true);
ok = printSettingForm.closedOk();
if (ok)
{
this.updatePrinterSettings(printSettings.pack());
}
}
3. Create Menu item "YourPrinterSetupMenuItem" of type Action. Object type Class, Object "YourPrinterSetup" class.
4. Add "YourPrinterSetupMenuItem" to the dialog of your "YourController" class. Something like this:
dialog.addMenuItemButton(MenuItemType::Action, "YourPrinterSetup", DialogMenuItemGroup::CurrentGrp);
5. Don't forget to implement setPrinterSettings method to your "YourController" class. It is used to pass chosen printer settings to "YourController".
public void setPrinterSettings(container _settings)
{
printerSettings = _settings;
printDestinationSettings = new SRSPrintDestinationSettings();
if (conlen(printerSettings) > 0)
{
printDestinationSettings.unpack(printerSettings);
dialogReportDestination.value(strFmt("%1", printDestinationSettings.printMediumType()));
}
}
6. Pass printer settings to your "YourReport". Use it in that place where you call the report. See example below.
public class YourController extends RunBaseBatch
{
container printerSettings;
}
public void run()
{
SrsReportRunController srsReportRunCont;
SRSPrintDestinationSettings printDestinationSettings;
printDestinationSettings = new SRSPrintDestinationSettings();
if (conlen(printerSettings) > 0)
{
printDestinationSettings.unpack(printerSettings);
}
srsReportRunCont = new SrsReportRunController();
srsReportRunCont.parmReportName('YourReport.Report');
srsReportRunCont.parmReportContract().parmPrintSettings(printDestinationSettings);
}
Hope it will help someone.
Mind that you can modify SrsPrintDestinationSettingsForm to enable/disable possibilities.
Solution:
1. Create your runnable class "YourController" from which you will control calls of your report "YourReport".
2. Create your printer setup class "YourPrinterSetup".
class YourPrinterSetup extends RunBase
{
Map mapPrinterSettings;
YourController baseClass;
Args args;
#define.CurrentVersion(1)
#localmacro.CurrentList
mapPrinterSettings
#endmacro
}
void new(Args _args)
{
;
mapPrinterSettings = new Map(Types::Enum, Types::Container);
Args = _args;
}
public container pack()
{
return [#CurrentVersion, [#CurrentList, mapPrinterSettings.pack()]];
}
public boolean unpack(container _packedClass)
{
Version version;
container packedPrinterSettings, packedOutPaymRecordList, packedValues;
version = RunBase::getVersion(_packedClass);
switch (version)
{
case(#CurrentVersion) :
[version, packedValues] = _packedClass;
[#currentList, packedPrinterSettings] = packedValues;
break;
default :
return false;
}
if (packedPrinterSettings)
{
// Recreate the object from the packed values.
mapPrinterSettings = Map::create(packedPrinterSettings);
}
else
{
mapPrinterSettings = new Map(Types::Enum, Types::Container);
}
return true;
}
static void main(Args _args)
{
YourPrinterSetup printSetup = new YourPrinterSetup(_args);
printSetup.run();
}
updatePrinterSettings is used to store chosen settings.
public void updatePrinterSettings(container _printerSettings)
{
mapPrinterSettings.insert("1", _printerSettings);
baseClass.setPrinterSettings(_printerSettings);
}
In run method the standard SRSPrintDestinationSettings class is called.
void run()
{
SrsPrintDestinationSettings printSettings;
FormRun printSettingForm;
boolean ok = true;
Object caller = args.caller();
baseClass = caller.runbase();
printSettings = new SrsPrintDestinationSettings();
printSettings.unpack(this.getPrinterSettings());
printSettings.fromPage(1);
printSettings.toPage(99999999);
args.caller(printSettings);
args.name(formstr(SRSPrintDestinationSettingsForm));
printSettingForm = classfactory.formRunClass(args);
printSettingForm.init();
printSettingForm.run();
printSettingForm.wait(true);
ok = printSettingForm.closedOk();
if (ok)
{
this.updatePrinterSettings(printSettings.pack());
}
}
3. Create Menu item "YourPrinterSetupMenuItem" of type Action. Object type Class, Object "YourPrinterSetup" class.
4. Add "YourPrinterSetupMenuItem" to the dialog of your "YourController" class. Something like this:
dialog.addMenuItemButton(MenuItemType::Action, "YourPrinterSetup", DialogMenuItemGroup::CurrentGrp);
5. Don't forget to implement setPrinterSettings method to your "YourController" class. It is used to pass chosen printer settings to "YourController".
public void setPrinterSettings(container _settings)
{
printerSettings = _settings;
printDestinationSettings = new SRSPrintDestinationSettings();
if (conlen(printerSettings) > 0)
{
printDestinationSettings.unpack(printerSettings);
dialogReportDestination.value(strFmt("%1", printDestinationSettings.printMediumType()));
}
}
6. Pass printer settings to your "YourReport". Use it in that place where you call the report. See example below.
public class YourController extends RunBaseBatch
{
container printerSettings;
}
public void run()
{
SrsReportRunController srsReportRunCont;
SRSPrintDestinationSettings printDestinationSettings;
printDestinationSettings = new SRSPrintDestinationSettings();
if (conlen(printerSettings) > 0)
{
printDestinationSettings.unpack(printerSettings);
}
srsReportRunCont = new SrsReportRunController();
srsReportRunCont.parmReportName('YourReport.Report');
srsReportRunCont.parmReportContract().parmPrintSettings(printDestinationSettings);
}
Hope it will help someone.
Mind that you can modify SrsPrintDestinationSettingsForm to enable/disable possibilities.
Labels:
2012,
ax,
Ax2012,
destination,
print,
settings,
srsprintdestinationsettings,
SSRS
Subscribe to:
Posts (Atom)