随笔分类 -  AX 2009

摘要:1 static void CreateFieldMethod(Args _args) 2 { 3 TreeNode tn1, tnAddr, methodsNode; 4 MemberFunction memberFunction; 5 str source; 6 ; 7 8 tn1 = infolog.findNode("\\Forms\\Address\\Data Sources\\Address\\Fields\\AddrRecId"); 9 tnAddr = infolo... 阅读全文
posted @ 2012-08-30 11:30 Sprite.z 阅读(157) 评论(0) 推荐(0)
摘要:1 int ret, j, i; 2 DictTable dictTable; 3 DictField DictField; 4 str curFieldName; 5 ; 6 dictTable = new DictTable(tableNum(yourTableName)); 7 i = dictTable.fieldCnt()-11;//这里系统会包括表的其他11个父类字段,所以减去11 8 for (j = 1; j <= i; j++) 9 {10 DictField=new DictField(dictTable.id(),dictTable.fi... 阅读全文
posted @ 2012-08-30 11:28 Sprite.z 阅读(145) 评论(0) 推荐(0)
摘要:1 void sendMail() { 2 SysMailer mailer = new SysMailer(); 3 ; 4 mailer.body("This is the body of the mail"); 5 mailer.subject("The message subject"); 6 mailer.fromAddress("Axapta_header@navision.com"); 7 mailer.fromName("Sell Axapta contract"); 8 mailer.tos(). 阅读全文
posted @ 2012-08-30 11:26 Sprite.z 阅读(148) 评论(0) 推荐(0)
摘要:1 Args ArgList = new Args(reportStr(My_Report));2 ReportRun My_Report = new ReportRun (ArgList);3 ;4 5 My_Report.design().caption('My Report');6 My_Report.query().interactive(false);7 My_Report.query().dataSourceNo(1).range(1).value('AA');//对报表里的数据源传递参数。若无,则可以不要。8 My_Report.run(); 阅读全文
posted @ 2012-08-30 11:26 Sprite.z 阅读(150) 评论(0) 推荐(0)
摘要:1 static void writeFile() 2 { 3 AsciiIo diskFile; 4 Filename diskFileName; 5 Str line; 6 Container c; 7 ; 8 c = [1, "MyText", 2, "HisText"]; 9 10 diskFileName = "c:\\test.txt";11 12 diskFile = new AsciiIo(diskFileName,'W');13 diskFile.outRecordDelimiter('\r\ 阅读全文
posted @ 2012-08-30 11:24 Sprite.z 阅读(150) 评论(0) 推荐(0)
摘要:1、在 Basic/setup/Number sequence/numberSequence 增加一个Sequence 编号:比如 'MySequence', from 1 to 9999999 format='######'。2、在form的数据源的Create方法添加以下代码。1 public void create(boolean _append = false)2 {3 NumberSeq _numberSeq;//declare a NumberSeq variable4 ;5 super(_append);6 _numberSeq = numberS 阅读全文
posted @ 2012-08-30 11:22 Sprite.z 阅读(179) 评论(0) 推荐(0)
摘要:本例中使用到很多Axapta高级技巧,比如函数的嵌套等,值得大家揣摩。例子中使用到的三个函数解释:fileExists(_name) 若存在文件,则返回 true。folderExists(_name) 若存在文件夹或文件,则返回true。pathExists(_name) 若存在文件夹,则返回true。 1 static void FindFile(Args _args) 2 { 3 #File 4 FileName fullFileName(FileName _path, FileName _fileName) 5 { 6 FileName p... 阅读全文
posted @ 2012-08-30 11:20 Sprite.z 阅读(174) 评论(0) 推荐(0)
摘要:1 str URL; 2 #DEFINE.MapURL('http://maps.google.com/maps?q=') 3 ; 4 if (!Address.QVS_Latitude || !Address.QVS_Longitude) 5 { 6 SmmUtility::GoogleMap(Address); 7 } 8 else 9 {10 URL = Address.QVS_Latitude;11 URL += "," + Address.QVS_Longitude;12 13 URL = #MapURL + URL;14 infolog.urlL 阅读全文
posted @ 2012-08-30 11:19 Sprite.z 阅读(327) 评论(0) 推荐(0)
摘要:1 ReportName.setTarget(printMedium::Printer);//直接打印到打印机2 this.suppressReportIsEmptyMessage(true);//空报表提示3 this.printJobSettings().suppressScalingMessage(true);//预览缩放提示 阅读全文
posted @ 2012-08-30 11:13 Sprite.z 阅读(159) 评论(0) 推荐(0)
摘要:AX的进度条比较简单,参考以下代码。 1 #avifiles 2 SysOperationProgress simpleProgress = SysOperationProgress::newGeneral(#aviUpdate, 'Posting', 100); 3 ; 4 simpleprogress.setCaption('Please wait...'); 5 simpleProgress.incCount(5); 6 simpleprogress.setText(strfmt("Percent: %1"+'%', 5 阅读全文
posted @ 2012-08-30 11:09 Sprite.z 阅读(258) 评论(0) 推荐(0)
摘要:1、先在form的声明的地方声明变量。1 public class FormRun extends ObjectRun2 {3 QueryBuildRange criteriaPosted;4 }2、数据源(datasource)对应的表的ini方法。1 public void init()2 {3 super();4 criteriaPosted=this.query().dataSourceName('YouTable').addRange(fieldNum(YouTable,FieldName));5 }3、数据源的ExecuteQuery方法下。1 public voi 阅读全文
posted @ 2012-08-30 11:07 Sprite.z 阅读(206) 评论(0) 推荐(0)
摘要:1 static void closeAxapta(Args _args)2 {3 infolog.shutDown(true);4 } 阅读全文
posted @ 2012-08-30 11:01 Sprite.z 阅读(147) 评论(0) 推荐(0)
摘要:1 public void init()2 {3 object obj;4 ;5 super();6 obj = element.design().sectionName("SalesLine_1").controlName("SalesLine_LineAmount");7 obj.SumAll(NoYes::Yes);8 } 阅读全文
posted @ 2012-08-30 11:00 Sprite.z 阅读(184) 评论(0) 推荐(0)
摘要:1 void modified()2 {3 object fieldNameRef;4 super();5 fieldNameRef = tableName_ds.object(fieldNum(tableName, fieldName));6 fieldNameRef.methodName();7 } 阅读全文
posted @ 2012-08-30 10:59 Sprite.z 阅读(148) 评论(0) 推荐(0)
摘要:1 static void loopFieldsInTable(Args _args) 2 { 3 dictTable dt; 4 int numberOfFields; 5 int fieldId; 6 int i; 7 ; 8 dt = new dictTable(tableNum(CustTable)); 9 //name of table10 info(dt.name()); 11 numberOfFields = dt.fieldCnt(); 12 info(int2str(numberOf... 阅读全文
posted @ 2012-08-30 10:58 Sprite.z 阅读(171) 评论(0) 推荐(0)
摘要:方法一,使用扩展类型 tableName。方法二,使用函数 PickTable(),参考下面的job(可以直接运行)。 1 static void GetSelectedTable(Args _args) 2 { 3 tableid a; 4 ; 5 6 a = pickTable(); 7 print 'Table ID is:'+int2str(a); 8 print 'Table Name is:'+tableID2Name(a); 9 pause;10 } 阅读全文
posted @ 2012-08-30 10:57 Sprite.z 阅读(164) 评论(0) 推荐(0)
摘要:1 static void ExportImageToExcel(Args _args) 2 { 3 container ImaPos; 4 COM comWorksheet; 5 COM comShapes; 6 COM comCells; 7 COM comFont; 8 COM comPageSetup; 9 SysExcelWorksheet sheet;10 SysExcelApplication excel;11 SysExcelWorkbooks boo... 阅读全文
posted @ 2012-08-30 10:56 Sprite.z 阅读(346) 评论(0) 推荐(0)
摘要:1 static void FindPrimaryIdx(Args _args) 2 { 3 DictTable dt; 4 DictIndex di; 5 Common cm; 6 IndexID idx; 7 int i, iCnt; 8 FieldID fid; 9 FieldID fids[,10];10 int fidsCnt = 0;11 str ... 阅读全文
posted @ 2012-08-30 10:55 Sprite.z 阅读(246) 评论(0) 推荐(0)
摘要:1 void startupPost() 2 { 3 int counter; 4 int num = 0; 5 int maxSessions = Info::licensedUsersTotal(); 6 xSession session; 7 UserInfo userInfo; 8 UserId currentUserId; 9 ;10 11 currentUserId = curuserid();12 13 for(counter = 1; ... 阅读全文
posted @ 2012-08-30 10:52 Sprite.z 阅读(209) 评论(0) 推荐(0)
摘要:1 static str Num2ChnStr(real realNum) 2 { 3 real y; 4 int b, a; 5 str je, x, hz1, hz2, e, h, f, m; 6 boolean IsNegative=false; 7 ; 8 if (realNum == 0) 9 return '零圆';10 if (realNum < 0)11 {12 realNum =... 阅读全文
posted @ 2012-08-30 10:49 Sprite.z 阅读(429) 评论(0) 推荐(0)