
Monday, March 30, 2009
Watching variables of a report
A little trick to watch your variables during debugging a report. Add a variable to watch and add the Element. prefix to its name.

Monday, March 16, 2009
Customized Comment In Your Code Editor
Standard code editor allows to create your own kind of comments. Generally, a style of comments depends on your programming style and the company's policies on that.
1. Created a new add-on function
2. Changed getSelectedText standard method
3. Created the method which implements this new kind of comments:
So, after compilation you can use the new comments style.

after commenting

Just to be on the safe side I place here the link to the whole project file CommentParentheses.xpo
I prefer to frame changes I make in a code with parentheses in the following style:
// Voytsekhovskiy, Alexey (My company name) (2009/03/16) (#)
//-->
the code as it wasd before my changes
//<--
In order to have such an option in the editor's context menu I changed EditorScripts class as follows:
1. Created a new add-on function
boolean isEmptySelection(str s)
{
;
// delete all special symbols
return strLen(strRem(strRem(strRem(s," "),"\n"),"\r"))>0;
}
2. Changed getSelectedText standard method
// added here the new parameter takeAllIfEmpty
static str getSelectedText(Editor e, boolean takeAllIfEmpty = true)
{
int i;
str text;
str line;
int startLine = e.selectionStartLine()+1;
int endLine = e.selectionEndLine()+1;
int startCol = e.selectionStartCol();
int endCol = e.selectionEndCol();
if (startLine == endLine && startCol == endCol)
{
// added here
//-->
if (!takeAllIfEmpty)
return text;
//<--
e.firstLine();
while (e.moreLines())
{
text += e.getLine()+'\r\n';
e.nextLine();
}
}
else
{
...
(the rest of the method)
3. Created the method which implements this new kind of comments:
// Insert a comment in place of the cursor
// (Example: Developer's name (Your company name) (YYYY/MM/DD) (#))
// //-->
// Your code here as it was before
// //<--
void Comments_BetweenParentheses(Editor e)
{
#define.YourCompanyName("Your company name")
str selText = EditorScripts::getSelectedText(e, false);
str selFirstLine;
int startLine = e.selectionStartLine()+1;
int startCol = e.selectionStartCol();
xppSource xppSource;
;
if(this.isEmptySelection(selText))
{
startLine = e.selectionStartLine()+1;
e.firstSelectedLine();
selFirstLine = e.getLine();
startCol = strLen(selFirstLine) -strLen(strLTrim(selFirstLine));
xppSource = new xppSource(startCol);
e.insertLines(xppSource.indent()+strFmt("// %1 ("+#YourCompanyName+") (%2) (#)", XUserInfo::find(False, curUserId()).name, date2str(today(), 321, 2, 4, 2, 4, 4))+"\n");
e.insertLines(xppSource.indent()+strFmt("//-->\n"));
e.insertLines(selText);
e.insertLines(strFmt(xppSource.indent()+"//<--\n"));
e.gotoLine(startLine+1);
e.gotoCol(startCol+1);
}
else
{
startCol = e.columnNo();
xppSource = new xppSource(startCol);
e.insertLines(strFmt("// %1 ("+#YourCompanyName+") (%2) (#)", XUserInfo::find(False, curUserId()).name, date2str(today(), 321, 2, 4, 2, 4, 4))+"\n");
e.insertLines(xppSource.indent()+strFmt("//-->\n"));
e.insertLines(strFmt(xppSource.indent()+"//<--\n"));
e.gotoLine(e.currentLineNo()-1);
e.gotoCol(50);
e.insertLines(strFmt("\n"+xppSource.indent()));
}
}
So, after compilation you can use the new comments style.

after commenting

Just to be on the safe side I place here the link to the whole project file CommentParentheses.xpo
книга Разработка бизнес-приложений в Microsoft Business Solutions - Axapta версии 3.0

С этой книги я начал изучение ERP-системы MS Axapta, во многом благодаря ей я нашёл первую работу в Канаде, и по сей день, она является наиболее востребованной среди прочих книг на моём столе для разработки для всех версий MS Dynamics: 3.0 4.0 и 2009.
Книга написана одновременно и как справочное пособие по архитектуре, среде разработки и языку X++, и параллельное описание реализации конкретного проекта "Управление гостиницей".
На примере последнего и разбираются варианты использования той или иной функциональности.
Вообще, примеры - это самая сильная часть любого руководства разработчика, и данная книга - отличный образец того, как это нужно делать: здесь можно найти не только соответствующие Best Practice стандартные паттерны программирования, которые особенно важно усвоить вначале работы с системой, но и такие приёмы, как, скажем работа с COM - Axapta Business Connector или организация многомерных массивов.
Название третьей главы "Что должен знать эксперт" говорит само за себя.
Мои любимые параграфы те, где речь идёт о создании и вызове сущностей системы, таких как формы, меню, запросы и так далее, напрямую из кода.
Особенно приятно, что она написана русскими ребятами на хорошем русском языке.
В целом, оценивая этот беспрецедентный по охвату материала, стройности и стилю изложения и оригинальности концепции труд, можно сказать, что данная книга является краеугольным камнем в построении карьеры разработчика MS Dynamics.
Subscribe to:
Posts (Atom)