Skip to main content

Posts

Showing posts with the label create a new object type

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