static void JobAllTheWindows(Args _args) { hWnd Parent; hWnd handle; hWnd mdi; #WinApi dialog d = new Dialog(); DialogTabPage dt; str text; ; d.caption("All the windows"); d.windowType(FormWindowType::PopUp); Parent = infolog.hWnd(); mdi = WinApi::getWindow(Parent, #GW_CHILD); handle = WinApi::getWindow(mdi, #GW_CHILD); text = WinApi::getWindowText(handle); if(text) { dt = d.addTabPage(text); d.addText(text); } if(handle) { while(handle) { handle = WinApi::getWindow(handle, #GW_HWNDNEXT); text = WinApi::getWindowText(handle); if(text) { dt = d.addTabPage(text); d.addText(text); } }An interesting observation: as a matter of fact Infolog window is open always, even if we not see it at the moment!
} d.run(); }
2007-12-28
How to get list of all open windows and their names in AX
How to get list of all open windows and their names in AX.
Just run following job.
2007-12-21
Mandatory property for DialogField
Usually in Dialog Forms it's unable to set mandatory property for Dialog Fields. The lack of this property
sometimes annoyed me. At the end I've decided to eliminate this gap :-)
To expand the standard functionality you need to do the following steps:
1.Add mandatory() method into DialogField class:
void mandatory(boolean r) { str name; // If properties exists then we are on server if (properties) { name = #Propertymandatory; if (! properties.exists(name)) properties.add(name,true); properties.value(name,r); } else this.fieldControl().mandatory(r); }2. Add into unpack() method following lines:
case #PropertyMandatory:Now you may enjoy mandatory property in Dialog Forms. This trick published in Axaptapedia too.
this.mandatory(unpackedProperties.valueIndex(i)); break;
2007-12-19
QueryBrowser
The tool I've developed allows browse queries from AOT or custom queries as such as TableBrowser works.
Visit axaptapedia to download QueryBrowser
Copyright © 2007 Ruslan Goncharov
Labels:
Axaptapedia,
DEV_QueryBrowser,
QueryBrowser
How to add a document into AX programmically (Document handling)
As a matter of fact it's pretty easy.
Following lines allow you do this.
void saveIntoDocuRefTable() { DocuValue docuValue; DocuRef docuRef; Container cFile; BinData binData; DocuTypeId _docuTypeId = ...; ; binData = new BinData(); binData.loadFile(fileName); cFile = Docu::splitFileName(fileName); docuValue.fileName = conpeek(cFile,1); docuValue.path = conpeek(cFile,3); docuValue.fileType = conpeek(cFile,2); docuValue.File = binData.getData(); docuValue.insert(); docuRef.ValueRecId = docuValue.recId; docuRef.RefCompanyId = CurExt(); docuRef.RefTableId = tableNum(....); docuRef.RefRecId = .....; docuRef.TypeId = _docuTypeId; docuRef.Name = fileName; docuRef.Notes = ....; docuRef.insert(); WinApi::deleteFile(fileName); }
2007-12-18
Integration AX with side applications
The Microsoft Business Connector is the way to integrate AX with outside world. It allows the programmer to leverage existing Microsoft Axapta functionality in his favorite programming language. At the other hand AX has one powerful feature: enumerators. An enum is a list of literals, which can be used throughout the development environment in MorphX.
Really, in MorphX using enumerators very simple, e.g.:
SalesStatus status; //Order status as to delivery and invoicing; if(status == SalesStatus::Invoiced) { ... }There are two advantages: it is an easy way to make an overall change in the system; the code is easier to read; Unfortunately, side application nothing "knows" about this AX feature. And we need to use constants directly in code!
if(status == 3)//SalesStatus::Invoiced) { ... }Let's try to instruct side applications enums feature. The idea consists in asking AX directly what does construction SalesStatus::Invoiced mean. To do this I've developed new DEV_DictTable class with some methods.
// Created by GRR on 18.07.2007 for AX Connector class DEV_DictTable { } // Returns constant, where _enumName is enum's name; _enumSymbol - literal int getEnum(identifierName _enumName, str _enumSymbol) { return new DictEnum(enumName2Id(_enumName)).symbol2Value(_enumSymbol); }An example how to use this class:
dict = AX.CreateObject("DEV_DictTable"); // A reference at our class SalesStatus_Invoiced = dict.Call("getEnum", "SalesStatus", "Invoiced"); // here we store our constant 3 //And now we may use SalesStatus::Invoiced in side application code --> if(status == SalesStatus_Invoiced){ ... }// <--There are some methods in DEV_DictTable class to improve integration's flexibility:
// gets enum label according enum name and specific value str getEnumLabel(identifierName _enumName, int _value) { return new DictEnum(enumName2Id(_enumName)).value2Label(_value); } // gets fieldId according Axapta's tableName and fieldName FieldId getFieldId(str tableName, str fieldName) { FieldId fieldId; DictField dictField; TableId tableId; ; tableId = new SysDictTable(tableName2Id(tableName)).id(); dictField = new DictField(tableid, fieldName2Id(tableId, fieldName)); fieldId = dictField.id(); return fieldId; } // gets tableId according Axapta's tableName
TableId getTableId(str tableName) { SysDictTable sysDictTable; TableId tableId; ; sysDictTable = new SysDictTable(tableName2Id(tableName)); tableId = sysDictTable.id(); return tableId; }
Hello Everybody!
Hello Everybody!
In this blog I'd like to share with everyone who interested in and works with Dynamics AX useful tips and tricks.
Hope it will be interesting information.
In this blog I'd like to share with everyone who interested in and works with Dynamics AX useful tips and tricks.
Hope it will be interesting information.
Subscribe to:
Posts (Atom)