March 4, 2014 at 23:50
filed under Dynamics AX
Tagged 2012, Book, Dynamics AX, Fun, Services
Hi everyone!
I’m very happy to announce Microsoft Dynamics AX 2012 R2 Services, published by Packt Publishing and authored by Kenny and myself. It is the successor of Microsoft Dynamics AX 2012 Services which was very well received. Based on the feedback you had, we started working on an update in September 2013. We have gone through all existing content, updated and improved it, and added a lot of new content. We are really happy with the result and are excited to hear your reactions.
We are working hard on the book at the moment, the expected release date is May 2014 but you can already pre-order it.
Read on if you want to know what to expect and have a chance to win a copy of Microsoft Dynamics AX 2012 R2 Services.
We have challenged ourself to create a book that we ourself would want to read. Because of that, instead of only providing a small update, we have also added a lot of new content. To reader of the first book, it can be summarized as follows:
For new readers, we will make a chapter freely available on the Packt Publishing article network so you get a glimpse of what is in the book (I will update this page when the article is online).
To celebrate this new release, we are giving away a number of copies of the Microsoft Dynamics AX 2012 R2 Services book:
That’s 14 copies of the book and a PackLib subscription. Here’s what you need to do to win:
Announcing new book: Microsoft Dynamics AX 2012 R2 Services: http://t.co/QzkkEhSZhP Retweet to win a free copy! (See link for details)
— Klaas Deforche (@DynamicsAxDev) March 4, 2014
A big thanks to Packt Publishing for sponsoring this giveaway, and good luck to you all. The contest will close on the 21st of March 2014 and I will contact you if you win (so use your real email address when commenting).
Please check the shipping info on the website of Packt Publishing to see whether they ship to you region before entering this contest and also read their terms and conditions. Some kind of disclaimer: Keep in mind that this contest is intended to a fun experience (both for me and you). Understand that I can not make any commitments regarding the delivery of the prizes. Oh, and if I know you personally you will not win a prize :-). You can both comment and retweet by the way. Comments will have to be approved by me (so it might take some time to show up) but that’s only to avoid spam.
Good luck and I hope you like the book!
Update March 27: Contest closed, I will contact the lucky winners shortly (and update this post again).
Update: All codes have been given away, thanks for your comments!
Klaas Deforche
on March 4, 2014 at 23:55
To format you code use the following syntax:
[cc lang=XPP]// your code goes here[/cc]
It wiill look like this:
pradeep Itnal
on March 5, 2014 at 00:12
{
TmpBankTotal banktotal;
ttsBegin;
try
{
banktotal.AccountId = '123';
banktotal.Balance = 2345;
ttsAbort;
banktotal.insert();
}
catch
{
throw error('operation aborated');
}
info(strFmt('%1',banktotal.AccountId));
ttscommit;
}
pradeep Itnal
on March 5, 2014 at 00:15
{
TaxTmpWorkTransForm taxTmpWorkTransForm;
PurchTotals purchTotals;
TaxPurch taxPurch;
purchTotals = PurchTotals::newPurchTable(PurchTable::find(‘PO0000004CA’)); //purchase order number in find method.
purchTotals.calc();
taxPurch = purchTotals.tax();
taxTmpWorkTransForm = TaxTmpWorkTransForm::construct();
taxTmpWorkTransForm.parmTaxObject(taxPurch);
taxTmpWorkTransForm.updateTaxShowTaxesSourceSingleLine(tableNum(PurchLine), PurchLine::find(‘PO0000004CA’,2,false).RecId, true);
info(strFmt(‘%1′,taxTmpWorkTransForm.parmTaxAmountCurTotal()));
}
Muhammad Haroon
on March 5, 2014 at 09:17
{
GiveAwayParticipants giveAwayParticipants;
giveAwayParticipants = GiveAwayParticipants::randomFind();
if(GiveAwayParticipants::find(giveAwayParticipants.emailId,mode::Twitter))
{
giveAwayParticipants.winner = NoYes::Yes;
info(strfmt("Winner %1",giveAwayParticipants.name));
}
}
Outcome: Winner: Klaas Deforche
Come on Klass, you do not need book. Give chance to others. :p
Manu
on March 5, 2014 at 09:38
{
FormRun formRun;
Args args = new Args();
;
args.name(formstr(tutorial_tetris));
formRun = ClassFactory.formRunClass(args);
formRun.init();
formRun.run();
formRun.wait();
}
Lasse
on March 5, 2014 at 11:34
Low tech – quick hack = fun :)
{
int rows = 40, cols = 80;
int maxIter = 256;
real fVRct = -2.5, fVRctImg=-1.00,fMagLevel=0.05,fCImg=0,fC,fZ,fZImg,fZSqr,fZImgSqr;
int X = 1,Y = 1,N = 0;
str chars = "▓▒▒░¤ghijklmnoprstuvwxyz123456▒890!#╧%/()=@£$?{[]}*ABCDE█GHIJ█LMNOPQRSTUVXY@";
str printLine;
;
window cols, rows at 50,20;
Y = 1;
while(Y < rows)
{
fcImg = fVRctImg + Y * fMagLevel;
printLine = "";
X = 1;
while(X < cols)
{
fC = fVRct + X * fMagLevel;
fZ = fC;
fZImg = fCImg;
N = 0;
while(N < maxIter)
{
fZSqr = fZ * fZ;
fZImgSqr = fZImg * fZImg;
fZImg = 2 * fZ * fZImg + fCImg;
fZ = fZSqr - fZImgSqr + fC;
if(fZImgSqr+fZImgSqr > 4)
{
break;
}
n++;
}
if( N > StrLen(Chars))
{
n = StrLen(Chars);
}
printLine += subStr(chars, N, 1);
x++;
}
print printLine;
y++;
}
pause;
}
If things look a bit strange, you might have to adjust the “chars” string a bit to make it look right! :)
Robesz
on March 5, 2014 at 11:55
Lasse! You killed my joke :-)
{
container textCont;
int i, printWindowHeight = 21, printWindowWidth = 77, firstLines = 5;
str line;
Random random = new Random();
#xppTexts
#File
;
textCont = ["A long time ago, in a galaxy far, far away....",
"",
"It is a period of civil war. Rebel",
"spaceships, striking from a hidden",
"base, have won their first victory",
"against the evil Galactic Empire.",
"",
"During the battle, Rebel spies managed",
"to steal secret plans to the Empire's",
"ultimate weapon, the Death Star, an",
"armored space station with enough",
"power to destroy an entire planet.",
"",
"Pursued by the Empire's sinister agents,",
"Princess Leia races home aboard her",
"starship, custodian of the stolen plans",
"that can save her people and restore",
"freedom to the galaxy..."];
do
{
i++;
line = "";
if(i <= firstLines || i > (firstLines + conLen(textCont)))
{
do
{
line += strRep(#space, 1 + random.nextInt() MOD printWindowWidth/4) + #AllFilesName;
}
while (strLen(line) < printWindowWidth);
}
else
{
line = conPeek(textCont, i - firstLines);
line = StrRep(#space, real2int((printWindowWidth - strLen(line))/2)) + line;
}
print(line);
sleep(500);
}
while (i < (conLen(textCont) + printWindowHeight + firstLines));
}
FH-Inway
on March 5, 2014 at 13:56
Hi,
nice job with the first book, would love to get my hands on the updated R2 version.
Best regards
FH-Inway
Jo
on March 5, 2014 at 17:27
info(conPeek(new HeapCheck().createAContainer(), 4));
Niet getest in 2012! :-)
Klaas Deforche
on March 5, 2014 at 17:58
Lol okay, didn’t know that. I tested it and it says “buffer buffer buffer buffer ” in AX 2012 so it seems they changed it.
Jo
on March 5, 2014 at 19:19
It took them long enough!
ET
on March 6, 2014 at 01:05
static void DictAllTables(Args _args)
{
ExtendedTypeId dictTypeId;
DictTable dictTable;
Dictionary dictionary;
counter cnt;
TableId tableId;
dictionary = new Dictionary();
tableId = dictionary.tableNext(0);
info(“Name;Field count;Index count;Table group;Has RecId Index;Has Surrogate key;Is SQL;Cache lookup”);
for (tableId = dictionary.tableNext(0); tableId; tableId = dictionary.tableNext(tableId))
{
dictTable = new dictTable(tableId);
info(strfmt(“%1;%2;%3;%4;%5;%6;%7;%8”, dictTable.name(), dictTable.fieldCnt(), dictTable.indexCnt(), dictTable.tableGroup(), dictTable.hasRecidIdx(), dictTable.hasSurrogateKey(),
dictTable.isSql(), dictTable.cacheLookup()));
}
}
ET
on March 6, 2014 at 01:11
Should have read the comment on code formatting :-)
{
ExtendedTypeId dictTypeId;
DictTable dictTable;
Dictionary dictionary;
counter cnt;
TableId tableId;
;
dictionary = new Dictionary();
tableId = dictionary.tableNext(0);
info("Name;Field count;Index count;Table group;Has RecId Index;Has Surrogate key;Is SQL;Cache lookup");
for (tableId = dictionary.tableNext(0); tableId; tableId = dictionary.tableNext(tableId))
{
dictTable = new dictTable(tableId);
info(strfmt("%1;%2;%3;%4;%5;%6;%7;%8", dictTable.name(), dictTable.fieldCnt(), dictTable.indexCnt(), dictTable.tableGroup(), dictTable.hasRecidIdx(), dictTable.hasSurrogateKey(),
dictTable.isSql(), dictTable.cacheLookup()));
}
}
Kim
on March 6, 2014 at 02:07
// haha! you guys are awesome :)
static void KlaasRocks(Args _args)
{
container tcontainer;
str tline;
int row;
;
tcontainer = [
“KKKKKKKKK KKKKKKKlllllll”,
“K:::::::K K:::::Kl:::::l”,
“K:::::::K K:::::Kl:::::l”,
“K:::::::K K::::::Kl:::::l”,
“KK::::::K K:::::KKK l::::l aaaaaaaaaaaaa ssssssssss ssssssssss”,
“K:::::K K:::::K l::::l a::::::::::::a ss::::::::::s ss::::::::::s”,
“K::::::K:::::K l::::l aaaaaaaaa:::::ass:::::::::::::s ss:::::::::::::s”,
“K:::::::::::K l::::l a::::as::::::ssss:::::ss::::::ssss:::::s”,
“K:::::::::::K l::::l aaaaaaa:::::a s:::::s ssssss s:::::s ssssss”,
“K::::::K:::::K l::::l aa::::::::::::a s::::::s s::::::s”,
“K:::::K K:::::K l::::l a::::aaaa::::::a s::::::s s::::::s”,
“KK::::::K K:::::KKK l::::l a::::a a:::::assssss s:::::s ssssss s:::::s”,
“K:::::::K K::::::Kl::::::la::::a a:::::as:::::ssss::::::ss:::::ssss::::::s”,
“K:::::::K K:::::Kl::::::la:::::aaaa::::::as::::::::::::::s s::::::::::::::s”,
“K:::::::K K:::::Kl::::::l a::::::::::aa:::as:::::::::::ss s:::::::::::ss”,
“KKKKKKKKK KKKKKKKllllllll aaaaaaaaaa aaaa sssssssssss sssssssssss”
];
do
{
row++;
tline = ”;
tline = conPeek(tcontainer, row );
print(tline);
}
while (row < (conLen(tcontainer)));
tline = conPeek(tcontainer, 1 );
print(tline);
pause;
}
Mike Frank
on March 6, 2014 at 13:26
variation on the theme brought up by Kim ;-)
{
System.Drawing.Bitmap bitmap;
System.Drawing.Graphics graphics;
System.Drawing.Font font;
System.Drawing.SizeF sizeF;
System.Drawing.Size size;
System.Drawing.Imaging.ImageFormat imageFormat = System.Drawing.Imaging.ImageFormat::get_Bmp();
FileName imageFileName = System.IO.Path::Combine(WinAPI::getTempPath(), 'AxImage.bmp');
str text = "Klaaaas rocks";
str fontName = "Verdana";
int fontSize = 25;
boolean bold = true;
str formatLastCLRException()
{
System.Exception clrException = CLRInterop::getLastException();
System.Type type;
str message;
if (!CLRInterop::isNull(clrException))
{
type = clrException.GetType();
if (CLRInterop::getAnyTypeForObject(type.get_FullName()) != 'System.Reflection.TargetInvocationException')
{
message = CLRInterop::getAnyTypeForObject(clrException.get_Message());
}
clrException = clrException.get_InnerException();
while (!CLRInterop::isNull(clrException))
{
if (message)
{
message += '\t';
}
message += CLRInterop::getAnyTypeForObject(clrException.get_Message());
clrException = clrException.get_InnerException();
}
}
return message;
}
try
{
bitmap = new System.Drawing.Bitmap(10, 10);
graphics = System.Drawing.Graphics::FromImage(bitmap);
font = new System.Drawing.Font(fontName, fontSize, bold ? System.Drawing.FontStyle::Bold : System.Drawing.FontStyle::Regular);
sizeF = graphics.MeasureString(text, font);
size = sizeF.ToSize();
bitmap = new System.Drawing.Bitmap(size.get_Width(), size.get_Height());
graphics = System.Drawing.Graphics::FromImage(bitmap);
graphics.FillRectangle(new System.Drawing.SolidBrush(System.Drawing.Color::get_White()), new System.Drawing.Rectangle(0, 0, size.get_Width(), size.get_Height()));
graphics.DrawString(text, font, new System.Drawing.SolidBrush(System.Drawing.Color::get_Red()), new System.Drawing.PointF(0, 0));
graphics.Dispose();
bitmap.RotateFlip(System.Drawing.RotateFlipType::Rotate270FlipNone);
bitmap.Save(imageFileName, imageFormat);
bitmap.Dispose();
WinAPI::shellExecute(imageFileName);
}
catch(Exception::CLRError)
{
throw error(formatLastCLRException());
}
}
Kim
on March 6, 2014 at 18:47
Nice :)
I hope this thread will continue and somebody makes good use of the WinAPI::beep method!
Klaas Deforche
on March 6, 2014 at 19:32
I was waiting for the same thing, hehe. I was trying to make it work yesterday using console.beep() or beep() but failed. Didn’t know there was a beep function in WINAPI, cool! Mario theme playing now…. :D
Edward
on March 7, 2014 at 11:50
Hi Klaas,
Thumbs up! Keep up the good work :-)
Greetz,
Edward
{
//
//within previous version(s) the InventDimSearch is used
//
//boolean isDimInventBatchIdActive(ItemId _itemId)
//{
// InventTable inventTable = InventTable::find(_itemId);
//;
// return new InventDimSearch().find(inventTable.DimGroupId, fieldnum(InventDim,InventBatchId)).dimActive();
//}
//
//within AX2012 the EcoResTrackingDimGroupSetup is used
//
boolean isDimInventBatchIdActive(ItemId _itemId)
{
EcoResTrackingDimGroupSetup trackingDimGroupSetup;
InventTable inventTable;
;
inventTable = InventTable::find(_itemId);
trackingDimGroupSetup = EcoResTrackingDimGroupSetup::newDimensionGroup(inventTable.trackingDimensionGroup());
return trackingDimGroupSetup && trackingDimGroupSetup.getFieldSetup(fieldNum(InventDim,InventBatchId)).isActive();
}
//
//test the method
//
InventTable inventTableSearch;
;
while select inventTableSearch
{
info(strFmt('%1;%2',
inventTableSearch.ItemId,
isInventBatchIdActive(inventTableSearch.ItemId)
));
}
}
Dominic
on March 8, 2014 at 19:14
Trying my luck here.
=]
Jimmy
on March 12, 2014 at 16:25
Great posts and comments as always! :)
Greetings,
Jimmy
{
Form form;
FormRun formRun;
Args args;
FormBuildDesign formBuildDesign;
FormBuildControl formBuildControl;
FormBuildTabControl formBuildTabControl;
FormBuildTabPageControl formBuildTabPageControl;
FormBuildStringControl formBuildStringControl;
FormBuildButtonControl formBuildButtonControl;
FormBuildGroupControl formBuildGroupControl;
FormBuildDatasource formBuildDatasource;
FormBuildStringControl formString;
FormButtonControl buttonCtrl;
;
form = new Form();
formBuildDesign = form.addDesign('design');
formBuildDesign.caption('How building a form can be done quick and dirty...');
formBuildDesign.width(600);
formBuildDesign.height(300);
formBuildTabControl = formBuildDesign.addControl(FormControlType::Tab, 'Tab');
formBuildTabControl.width(550);
formBuildTabControl.height(250);
formBuildTabPageControl = formBuildTabControl.addControl(FormControlType::TabPage, 'TabPage');
formBuildTabPageControl.width(550);
formBuildTabPageControl.height(250);
formBuildGroupControl = formBuildTabPageControl.addControl(FormControlType::Group, 'Group');
formBuildStringControl = formBuildGroupControl.addControl(FormControlType::String, 'StringTextbox');
formBuildStringControl.width(500);
formBuildStringControl.text('Thank you for the blogposts and hopefully a copy of the Services ebook :-) ');
formBuildStringControl.enabled(false);
formBuildStringControl.fontSize(10);
formBuildStringControl.bold(7);
formBuildStringControl.colorScheme(2);
formBuildStringControl.backStyle(2);
formBuildStringControl.backgroundColor(0x0000ff00);
formBuildStringControl.foregroundColor(0x00ff0000);
formBuildButtonControl = formBuildGroupControl.addControl(FormControlType::Button, 'MyButton');
formBuildButtonControl.text('PRESS ME...AND EXPECT NOTHING');
args = new Args();
args.object(form);
formRun = new FormRun(args);
formRun.init();
formRun.run();
formRun.wait();
}
dfga
on March 22, 2014 at 20:54
Congrats on your new book! Can’t wait to get it, just make it happen! LOL :)
JantjeLeiden
on April 4, 2014 at 11:20
Good initiative, would love the ebook.
Anything about using REST in there ?
Klaas Deforche
on April 4, 2014 at 16:54
Yes, REST is mentioned on a few occasions, for example when using the OData query services and when consuming a web service. Don’t expect a lot of REST content though, it’s just mentioned when needed.