Skip to main content

Posts

Showing posts with the label tableid

Get Primary key field name of table in MSD axapta by code

To Get Primary key field name of table in axapta by code you can try following code. First you need to declare variable for dictTable . DictTable _dictTable; DictField _dictField; ; _dictTable = new SysDictTable(tableNum(SalesTable)); // Then you need to call primary key field by passing table id like here we have pass salestable and dicttable.id() method will get id of salestable. _dictField = new SysDictField(dictTable.id(), dictTable.primaryKeyField()); info(dictField.name());

How to get all table ids from AOT using dynamics MSD axapta x++ code

You can write following code  to get all table ids from AOT using dynamics axapta x++ language. Axapta is developed on .Net platform and its object base programming. You need to understand object concept before starting programming in axapta. You can declare object for tables,forms,reports,class,views etc . //variable declaration Dictionary dictionary1; TableId tableId1; ; // initialize object dictionary1 = new Dictionary(); // set initial table id tableId1 = dictionary.tableNext(0); // start table id loop while (tableId1) { info(int2str(tableId1)); tableId1 = dictionary1.tableNext(tableId1); } // end table id loop

crossCompany Keyword on the X++ Select Statement in MSDAX

crossCompany Keyword on the X++ Select Statement The following code example populates a table buffer with all the BankAccountTable rows that have a dataAreaId of either cm1 or cm2. This example assumes that the user has authority to access data for these two companies. The first two dataAreaId values that are found will be printed. BankAccountTable tabBAT; // saveDataPerCompany == true. container conCompanies = [ 'cm1', 'cm2' ]; str sCompanyPrevious =" "; int iCountCompanies = 0; ; while select crossCompany : conCompanies * from tabBAT order by dataAreaId { if ( sCompanyPrevious != tabBAT .dataAreaId ) { print( tabBAT .dataAreaId + " = tabBAT .dataAreaId" ); iCountCompanies++; if ( iCountCompanies >= 2 ) { break; } sCompanyPrevious = tabBAT .dataAreaId; } } pause; return;

Virtual Fields in Axapta

Virtual Fields in Axapta ModifiedDate Date the record was last modified ModifiedTime Time the record was last modified, in seconds since midnight ModifiedBy Axapta user who made the last modification ModifiedTransactionID Transaction ID of the transaction that made the last modification CreatedDate Date the record was created CreatedTime Time of creation of the record, in seconds since midnight CreatedBy Axapta user who created the record CreatedTransactionID  Transaction ID of the transaction that created the record TableId ID of the table SequenceNum The same value as in RecId

Code to Get all table id of axapta AOT

Try this code in job static void findTables(Args _args) { Dictionary dictionary; TableId tableId; tableName tableName; ; dictionary = new Dictionary(); tableId = dictionary.tableNext(0); tableName = dictionary.tableName(tableId); while (tableId) { info(strfmt("%1 - %2",int2str(tableId), tableName)); tableId = dictionary.tableNext(tableId); tableName = dictionary.tableName(tableId); } }

select All Records Dynamically in axapta

This is sample code to select All Records Dynamically in axapta static void selectAllRecordsRuntimeArgs _args) { firstTable firstTable; DictField dictField; DictTable dictTable; int field; int fieldId; int records; str header, line; ; // Create a new object of type DictTable based on the firstTable dictTable = new DictTable(tablenum(firstTable)); // Loop through the fields on the table. // For each field, store the field-label in the header variable. for (field=1; field <= dictTable.fieldCnt(); field++) { fieldId = dictTable.fieldCnt2Id(field); dictField = new DictField(tablenum(firstTable), fieldId); header += strfmt("%1, ", dictField.label()); } info(strupr(header)); // strupr changes the string to UPPERCASE // Loop through all the records in the firstTable while select firstTable { line = ""; // For each record in the firstTable, loop through all the //fields // and store the value of the field