Get all Tables of AOT

Here is a code spinet to get all the tables of AOT. static void TableList(Args _args) {     tableId         tableId;     int             tablecounter;     Dictionary      dict = new Dictionary();     for (tablecounter=1; tablecounter<=dict.tableCnt(); tablecounter++)     {     … Continue reading Get all Tables of AOT

Advertisements

Writing data to EXCEL

Here is a simple code to write data in EXCEL from X++ static void Write2ExcelFile(Args _args) { InventTable inventTable; SysExcelApplication application; SysExcelWorkbooks workbooks; SysExcelWorkbook workbook; SysExcelWorksheets worksheets; SysExcelWorksheet worksheet; SysExcelCells cells; SysExcelCell cell; int row; ; application = SysExcelApplication::construct(); workbooks = application.workbooks(); workbook = workbooks.add(); worksheets = workbook.worksheets(); worksheet = worksheets.itemFromNum(1); cells = worksheet.cells(); cells.range('A:A').numberFormat('@'); … Continue reading Writing data to EXCEL

Read Data From Excel

Here is a simple code to read data from Excelstatic void ReadExcel(Args _args){ SysExcelApplication application;SysExcelWorkbooks workbooks;SysExcelWorkbook workbook;SysExcelWorksheets worksheets;SysExcelWorksheet worksheet;SysExcelCells cells;COMVariantType type;int row;ItemId itemid;Name name;FileName filename;;application = SysExcelApplication::construct();workbooks = application.workbooks();//specify the file path that you want to readfilename = "C:\\item.xls";try{workbooks.open(filename);}catch (Exception::Error){throw error("File cannot be opened.");}workbook = workbooks.item(1);worksheets = workbook.worksheets();worksheet = worksheets.itemFromNum(1);cells = worksheet.cells();do{row++;itemId = cells.item(row, 1).value().bStr();name = … Continue reading Read Data From Excel

Workflow Approver NAME

Below is the Job Snippet to get the Workflow Approver Name static void workflowApproverInfo(Args _args) { WorkflowTrackingStatusTable workflowtrackingstatustable; WorkflowTrackingTable workflowtrackingtable; while select workflowtrackingstatustable order by RecId desc join workflowtrackingtable where workflowtrackingstatustable.ContextRecId == 5637155826 //(Required Record) && workflowtrackingtable.TrackingContext == workflowtrackingcontext::WorkItem && workflowtrackingtable.TrackingType == workflowtrackingtype::Approval && workflowtrackingtable.WorkflowTrackingStatusTable == workflowtrackingstatustable .recid { info(workflowtrackingtable.User); info(HcmWorker::find(DirPersonUser::findUserWorkerReference(workflowtrackingtable.User)).name()); } }