Exportfile for AOT version 1.0 or later Formatversion: 1 ***Element: JOB ; Microsoft Dynamics AX Job: DynamicsFox_DialogExample unloaded ; -------------------------------------------------------------------------------- JOBVERSION 1 SOURCE #DynamicsFox_DialogExample #//DynamicsFox_FillTmpTableForm - created on 26 Feb 2017 by ROHA #static void DynamicsFox_DialogExample(Args _args) #{ # #File # #define.dialogPath('dialogPath') # #define.filePath('filePath') # #define.fileName('fileName') # #define.fileExtension('fileExtension') # #define.delimiter('delimiter') # # Object dlgCountryCode, # dlgFilePath, # dlgFileName, # dlgFileNameArchive; # Filename fileName; # Filepath filePath, # filePathArchive; # # LogisticsAddressCountryRegion countryTable; # LogisticsAddressCountryRegionId countryId; # container countryList, # dialogValues, # typeList = [#filePath, # #fileName, # #fileName, # #delimiter, # #filePath]; # Counter counter; # Delimiter delimiter; # # Map dialogFields = new Map(Types::Integer,Types::Class); # MapEnumerator dialogFieldsMap; # # TmpCompanyLookup tmpTable; # TmpTableHandler tmpHandler = new TmpTableHandler(); # # // call the form and fill the temptable # void runCountryForm() # { # Formrun formRun; # object populateTempTable; # Args args = new Args(); # ; # # filepath = strFmt(@'%1\%2.%3', # conPeek(dialogValues,1), # conPeek(dialogValues,2), # conPeek(dialogValues,3)); # # filePathArchive = strFmt(@'%1\%2.%3', # conPeek(dialogValues,5), # conPeek(dialogValues,2), # conPeek(dialogValues,3)); # # args.name(formStr(TmpCountry)); # formRun = ClassFactory.formRunClass(args); # # populateTempTable = formRun; # # populateTempTable.parmTmpHander(tmpHandler); # # delimiter = conPeek(dialogValues,4); # tmpHandler.parmDelimiter(delimiter); # tmpHandler.parmFilePath(filepath); # # tmpHandler.parmFilePathArchive(filePathArchive); # # formRun.init(); # populateTempTable.populateTemp(countryList); # # formRun.run(); # formRun.wait(); # } # # //Get the previous dialog values # void getPreviousValue(counter _id, Object _dialogField) # { # dialogValues = conNull(); # # dialogValues = xSysLastValue::getValue(curext(), curUserId(), # UtilElementType::Job, #dialogPath); # # if (dialogValues) # { # _dialogField.value(conPeek(dialogValues, _id)); # } # } # # //Save the dialog values # void saveValue(container _dialogValues) # { # xSysLastValue::putValue(_dialogValues, # curext(), # curUserId(), # UtilElementType::Job, # #dialogPath); # } # # // create dialog # void selectPath() # { # Object dialogField; # str type, # objectValue; # Object object, # dialogPath = new Dialog("@CON13"); # # for(counter = 1; counter <= conlen(typeList); counter++) # { # type = conPeek(typeList, counter); # # if (counter == 5) # { # dialogPath.addGroup("@CON12"); # } # # if (type) # { # dialogField = dialogPath.addField(type); # # if (counter == 3) # { # dialogField.label("@CON19"); # } # # dialogFields.insert(counter, dialogField); # getPreviousvalue(counter, dialogField); # } # } # # if (dialogPath.run()) # { # dialogFieldsMap = new MapEnumerator(dialogFields); # # while (dialogFieldsMap.moveNext()) # { # object = dialogFieldsMap.currentValue(); # objectValue = object.value(); # # dialogValues = conIns(dialogValues, # dialogFieldsMap.currentKey(), # objectValue); # } # # saveValue(dialogValues); # } # # dialogField = null; # } # # selectPath(); # runCountryForm(); #} ENDSOURCE PROPERTIES Origin #{4FB0B635-8C9A-4FB9-A553-79663D3DA277} ENDPROPERTIES en-us Enter file information @CON13 0 0 5637144576 en-us Archive location @CON12 0 0 5637144576 en-us Filename extension @CON19 0 0 5637144576 ***Element: CLS ; Microsoft Dynamics AX Class: TmpTableHandler unloaded ; -------------------------------------------------------------------------------- CLSVERSION 1 CLASS #TmpTableHandler PROPERTIES Name #TmpTableHandler Origin #{F39C72E1-4A9C-4315-BBB1-F6669A458B5F} ENDPROPERTIES METHODS SOURCE #permission #private void permission() #{ # # permissionSet = new Set(Types::Class); # permissionSet.add(new FileIOPermission(filePath,#io_write)); # permissionSet.add(new InteropPermission(InteropKind::ClrInterop)); # # CodeAccessPermission::assertMultiple(permissionSet); #} ENDSOURCE SOURCE #moveFile #public void moveFile() #{ # this.permission(); # # CodeAccessPermission::assertMultiple(permissionSet); # # System.IO.File::Move(filePath, filePathArchive); # System.IO.File::Delete(filePath); # # CodeAccessPermission::revertAssert(); # # Box::info('@CON22'); #} ENDSOURCE SOURCE #classDeclaration #//DynamicsFox_FillTmpTableForm - created on 26 Feb 2017 by ROHA #class TmpTableHandler #{ # #File # Common markedRecord; # Delimiter delimiter; # FilePath filePath, filePathArchive; # Set permissionSet; # TmpCompanyLookup company; #} ENDSOURCE SOURCE #companyLookup #TmpCompanyLookup companyLookup(container _countryList = conNull()) #{ # Query query = new query(); # QueryBuildDataSource qbds; # QueryBuildRange qbr; # QueryRun qr; # # LogisticsAddressCountryRegion country; # TmpCompanyLookup tmpTable; # Counter counting; # DataAreaId countryId; # # qbds = query.addDataSource(tableNum(LogisticsAddressCountryRegion)); # # for (counting = 1; counting <= conLen(_countryList); counting++) # { # countryId = conPeek(_countryList, counting); # qbr = qbds.addRange(fieldNum(LogisticsAddressCountryRegion, CountryRegionId)); # qbr.value(SysQuery::value(countryId)); # } # # qr = new QueryRun(query); # # while (qr.next()) # { # country = qr.get(tableNum(LogisticsAddressCountryRegion)); # tmpTable.DataArea = country.CountryRegionId; # tmpTable.Name = country.displayName(); # tmpTable.insert(); # } # # return tmpTable; #} # # # ENDSOURCE SOURCE #parm_company #public TmpCompanyLookup parm_company(TmpCompanyLookup _company = company) #{ # company = _company; # # return company; #} ENDSOURCE SOURCE #parmDelimiter #public void parmDelimiter(Delimiter _delimiter = delimiter) #{ # delimiter = _delimiter; #} ENDSOURCE SOURCE #parmFilePathArchive #public void parmFilePathArchive(FilePath _filePath = filePathArchive) #{ # filePathArchive = _filePath; #} ENDSOURCE SOURCE #parmFilePath #public void parmFilePath(FilePath _filePath = filePath) #{ # filePath = _filePath; #} ENDSOURCE SOURCE #selectionHandler #public void selectionHandler(Common _caller) #{ # Box box; # Counter counting; # FormDataSource formDataSource; # TextIo textIo; # str read; # # if (_caller.TableId != tableNum(TmpCompanyLookup)) # { # return; # } # # if (box::yesNo("@CON18", DialogButton::Yes) == DialogButton::Yes) # { # formDataSource = _caller.dataSource(); # this.permission(); # # if (formDataSource.anyMarked()) # { # markedRecord = _caller; # # textIo = new TextIo(filePath, #IO_Write); # # markedRecord = formDataSource.getFirst(1, false); # # while (markedRecord) # { # counting++; # # read = markedRecord.(fieldNum(TmpCompanyLookup, DataArea)) # + delimiter # + markedRecord.(fieldNum(TmpCompanyLookup, Name)); # # info(read); # textIo.write(read); # # # markedRecord = formDataSource.getNext(); # } # # } # # CodeAccessPermission::revertAssert(); # } #} ENDSOURCE ENDMETHODS ENDCLASS en-us File is succesfully moved to archive @CON22 0 0 5637144576 en-us Do you generate a file ? @CON18 0 0 5637144576 ***Element: FRM ; Microsoft Dynamics AX Forms unloaded ; -------------------------------------------------------------------------------- FRMVERSION 12 FORM #TmpCountry PROPERTIES Name #TmpCountry Origin #{D2F4A5FA-2DF7-42AA-806C-DB18621DF07F} ENDPROPERTIES METHODS SOURCE #classDeclaration #public class FormRun extends ObjectRun #{ # TmpTableHandler tmpHandler; # FilePath filePath; #} ENDSOURCE SOURCE #log #private void log() #{ # //DynamicsFox_FillTmpTableForm - created on 26 Feb 2017 by ROHA #} ENDSOURCE SOURCE #parmTmpHander #public void parmTmpHander(TmpTableHandler _tmpHandler = tmpHandler) #{ # tmpHandler = _tmpHandler; #} ENDSOURCE SOURCE #populateTemp #public void populateTemp(container _countryList) #{ # tmpCompanyLookup.setTmpData(tmpHandler.companyLookup(_countryList)); #} ENDSOURCE ENDMETHODS OBJECTBANK PROPERTIES ENDPROPERTIES DATASOURCE OBJECTPOOL PROPERTIES Name #TmpCompanyLookup Table #TmpCompanyLookup ENDPROPERTIES FIELDLIST ENDFIELDLIST ENDOBJECTPOOL METHODS SOURCE #init #public void init() #{//DS # super(); #} ENDSOURCE ENDMETHODS ENDDATASOURCE ENDOBJECTBANK REFERENCEDATASOURCES ENDREFERENCEDATASOURCES JOINS ENDJOINS PARTREFERENCES ENDPARTREFERENCES DESIGN PROPERTIES Caption #@CON14 HideIfEmpty #No Style #SimpleList ENDPROPERTIES CONTAINER CONTROL ACTIONPANE PROPERTIES Name #ActionPane ElementPosition #715827882 Style #Strip ENDPROPERTIES METHODS ENDMETHODS ENDCONTROL CONTROL ACTIONPANETAB PROPERTIES Name #ActionPaneTab ElementPosition #1431655764 HierarchyParent #ActionPane ENDPROPERTIES METHODS ENDMETHODS ENDCONTROL CONTROL BUTTONGROUP PROPERTIES Name #ButtonGroup ElementPosition #1610612734 HierarchyParent #ActionPaneTab ENDPROPERTIES METHODS ENDMETHODS ENDCONTROL CONTROL BUTTONGROUP PROPERTIES Name #NewDeleteGroup ElementPosition #1073741823 HierarchyParent #ActionPaneTab ENDPROPERTIES METHODS ENDMETHODS ENDCONTROL CONTROL GRID PROPERTIES Name #GridCountry Width #Column width Height #Column height ElementPosition #1431655764 HierarchyParent #Body DataSource #TmpCompanyLookup ENDPROPERTIES METHODS ENDMETHODS ENDCONTROL CONTROL GROUP PROPERTIES Name #Body Width #Column width Height #Column height ElementPosition #1431655764 DataSource #TmpCompanyLookup ENDPROPERTIES METHODS ENDMETHODS ENDCONTROL CONTROL BUTTON PROPERTIES Name #ButtonArchiveFile ElementPosition #1789569705 HierarchyParent #ButtonGroup Text #@CON21 MultiSelect #Yes ENDPROPERTIES METHODS SOURCE #clicked #void clicked() #{ # tmpHandler.moveFile(); #} ENDSOURCE ENDMETHODS ENDCONTROL CONTROL BUTTON PROPERTIES Name #ButtonPrintFile ElementPosition #1431655764 HierarchyParent #ButtonGroup Text #@CON15 MultiSelect #Yes ENDPROPERTIES METHODS SOURCE #clicked #void clicked() #{ # tmpHandler.selectionHandler(TmpCompanyLookup); #} ENDSOURCE ENDMETHODS ENDCONTROL CONTROL COMMANDBUTTON PROPERTIES Name #DeleteButton ElementPosition #1610612734 HierarchyParent #NewDeleteGroup Text #@sys14425 ButtonDisplay #Text & Image left NormalImage #10121 ImageLocation #EmbeddedResource SaveRecord #No Primary #Yes Command #2832 ENDPROPERTIES METHODS ENDMETHODS ENDCONTROL CONTROL COMMANDBUTTON PROPERTIES Name #NewButton ElementPosition #1073741822 HierarchyParent #NewDeleteGroup ButtonDisplay #Text & Image left NormalImage #11045 ImageLocation #EmbeddedResource Primary #Yes Command #260 ENDPROPERTIES METHODS ENDMETHODS ENDCONTROL CONTROL STRINGEDIT PROPERTIES Name #TmpCompanyLookup_DataArea ElementPosition #858993458 HierarchyParent #GridCountry DataSource #TmpCompanyLookup DataField #DataArea ENDPROPERTIES METHODS ENDMETHODS ENDCONTROL CONTROL STRINGEDIT PROPERTIES Name #TmpCompanyLookup_Name ElementPosition #1717986916 HierarchyParent #GridCountry DataSource #TmpCompanyLookup DataField #Name ENDPROPERTIES METHODS ENDMETHODS ENDCONTROL ENDCONTAINER ENDDESIGN PERMISSIONS #Permissions PROPERTIES ENDPROPERTIES PERMISSIONSET #Read PROPERTIES ENDPROPERTIES FORM #Controls ENDFORM TABLES #Tables ENDTABLES SERVERMETHODS #Server Methods ENDSERVERMETHODS ASSOCIATEDFORMS #Associated Forms ENDASSOCIATEDFORMS ENDPERMISSIONSET PERMISSIONSET #Update PROPERTIES ENDPROPERTIES FORM #Controls ENDFORM TABLES #Tables ENDTABLES SERVERMETHODS #Server Methods ENDSERVERMETHODS ASSOCIATEDFORMS #Associated Forms ENDASSOCIATEDFORMS ENDPERMISSIONSET PERMISSIONSET #Create PROPERTIES ENDPROPERTIES FORM #Controls ENDFORM TABLES #Tables ENDTABLES SERVERMETHODS #Server Methods ENDSERVERMETHODS ASSOCIATEDFORMS #Associated Forms ENDASSOCIATEDFORMS ENDPERMISSIONSET PERMISSIONSET #Delete PROPERTIES ENDPROPERTIES FORM #Controls ENDFORM TABLES #Tables ENDTABLES SERVERMETHODS #Server Methods ENDSERVERMETHODS ASSOCIATEDFORMS #Associated Forms ENDASSOCIATEDFORMS ENDPERMISSIONSET ENDPERMISSIONS ENDFORM en-us Countries @CON14 0 0 5637144576 en-us Archive file @CON21 0 0 5637144576 en-us Print to file @CON15 0 0 5637144576 en-us Delete [VendorOnboardingPhase1] PurchReqConsolidation @sys14425 0 0 5637144576 ***Element: PRN ; Microsoft Dynamics AX Project : DynamicsFox_TmpTableFormHandler unloaded ; -------------------------------------------------------------------------------- PROJECTVERSION 2 PROJECT #DynamicsFox_TmpTableFormHandler SHARED PROPERTIES Name #DynamicsFox_TmpTableFormHandler Origin #{A5ABA30D-8B98-45B7-8CC0-7E92F28C937F} ENDPROPERTIES PROJECTCLASS ProjectNode GROUP #Jobs PROPERTIES Name #Jobs ProjectGroupType #Jobs GroupMask # PreventEditProperties #No ENDPROPERTIES BEGINNODE FILETYPE 0 UTILTYPE 5 UTILOBJECTID 0 NODETYPE 215 NAME #DynamicsFox_DialogExample ENDNODE ENDGROUP GROUP #Classes PROPERTIES Name #Classes ProjectGroupType #Classes GroupMask # PreventEditProperties #No ENDPROPERTIES BEGINNODE FILETYPE 0 UTILTYPE 45 UTILOBJECTID 1024144 NODETYPE 329 NAME #TmpTableHandler ENDNODE ENDGROUP GROUP #Forms PROPERTIES Name #Forms ProjectGroupType #Forms GroupMask # PreventEditProperties #No ENDPROPERTIES BEGINNODE FILETYPE 0 UTILTYPE 11 UTILOBJECTID 0 NODETYPE 201 NAME #TmpCountry ENDNODE ENDGROUP ENDPROJECT ***Element: END