Saturday, May 08, 2010
Friday, May 07, 2010
Install you DLL assembly by using the ‘gacutil.exe’, before installing the DLL ensure it has a strong name, to assign a strong name refer to the link Assigning a DLL strong name .
1) open the Command prompt, and navigate to the folder of gacutil.
2) To install a DLL assembly
gacutil /I "C:\[PathToBinDirectoryInVSProject]\gac.dll"
3) To uninstall
gacutil /U “Name_of_The_DLL”
Hi Guys, few days back I needed to install few DLL assemblies to GAC, since I hardly knew about this topic, so googled on the internet and here is what I learned; There is a utility named ‘gacutil.exe’
which is delivered with Visual studio and .NET framework ( search in your PC for gacutil.exe) or you can also download from internet.
Before installing the DLL to GAC , ensure that the DLL you want to install has a strong name. To assign a strong name follow these steps::
1) Open the visual studio and open your C# project
2) Right click on the project/Solution and click on properties.
3) Click on the ‘Signing’ tab
4) Select the check box Sign the assembly and select a strong key file .
5) You can also create a new key file by selecting new, click on new to create a key file, provide the name of the file and password
6) Now build your solution, the dll file generated has a strong name.
Sunday, April 04, 2010
| public static client str lookupTableDisplayMethod(str _tableId) { SysDictTable dictTable = new SysDictTable(str2int(_tableId)); ListEnumerator enum; Map map = new Map(Types::String, Types::String); ; if (dictTable && dictTable.rights() > AccessType::NoAccess) { enum = dictTable.getListOfDisplayMethods().getEnumerator(); while (enum.moveNext()) { map.insert(enum.current(), enum.current()); } } return pickList(map, "Display method", tableid2pname(_tableId)); } |
| public static str lookupDatasourceOfQuery(Query _query) { Query query = _query; QueryBuildDataSource qbds; int dsIterator; Map map = new Map(Types::String, Types::String); ; for (dsIterator = 1; dsIterator <= query.dataSourceCount(); dsIterator++) { qbds = query.dataSourceNo(dsIterator); map.insert(qbds.name(), qbds.name()); } return pickList(map, "Data source", "Data sources"); } |
Saturday, April 03, 2010
The following job helps you find the related field of a table, in the e,g it tries to find the related field of (InventTrans, InventTransId) for the sales Line table
| static void findRelatedFieldId(Args _args) { Sy sDictTable dictTable = new SysDictTable(tablenum(InventTrans)); int i,j; SysDictRelation dictRelation; TableId externId = tablenum(SalesLine); IndexId indexId; ; // Search the explicit relations for (i = 1; i <= dictTable.relationCnt(); ++i) { dictRelation = new SysDictRelation(dictTable.id()); dictRelation.loadNameRelation(dictTable.relation(i)); // If it is a 'relation' then you use externTable(), but for extended data types you use table() (see next block). if (SysDictRelation::externId(dictRelation) == externId) { for (j =1; j <= dictRelation.lines(); j++) { info(strfmt("%1", dictRelation.lineExternTableValue(j))); info(fieldid2name(dictRelation.externTable(),dictRelation.lineExternTableValue(j))); } } } info(strfmt("%1", dictRelation.loadFieldRelation(fieldnum(InventTrans, InventTransId)))); } |
Sunday, July 05, 2009
Whenever we try to use a group by on a lookup, the group by used to come for the first time, and later it never showed.
investigations revealed that it second time it fired a Order By Asc instead of group by query. this problem was fixed by passing parameter false to
sysTableLookup.parmUseLookupValue(false);
Sample
void orderNoLookup(FormControl _control)
{
SysTableLookup sysTableLookup = SysTableLookup::newParameters(tablenum(InventTrans),_control);
QueryBuildDataSource inventTransQbds;
Query query;// = element.initQuery();
;
sysTableLookup.addLookupfield(fieldnum(InventTrans, TransRefId),
true);
inventTransQbds = query.dataSourceNo(1);
inventTransQbds.addSortField(fieldnum(InventTrans,TransRefId));
inventTransQbds.orderMode(OrderMode::GroupBy);
sysTableLookup.parmUseLookupValue(false);
sysTableLookup.parmQuery(query);
sysTableLookup.performFormLookup();
}
Thursday, May 21, 2009
Microsoft Dynamics AX 2009 has a new feature, which allows you to create union of queries. The QueryBuildDataSource class allows you to create unions of query.
First you need to specify what type of the query for e.g. Union or Join
Sample
query.queryType(QueryType::Union);
You need to specify the union type for e.g. Union, UnionAll, or None
Sample
qbdsCustTable = query.addDataSource(tableNum(CustTable));
qbdsCustTable.unionType(UnionType::UnionAll); // Include duplicate records
please refer to documentation for specific usage of Union types