tceic.com
>> IT/ >>

Dynamics Ax



116 10 ...................................................................................... 3 2Agrs Class ................................................................................................................ 3 3Args ......................................................................................................................... 4 4Ax2009 ............................................................................................ 5 5Axapta Form Form .................................................................... 6 6Ax ........................................................................................................ 7 7Common ......................................................................................................... 8 8display .................................................................................................................... 8 9distinct ........................................................................................................ 9 10Form container form ......................................................... 10 11Form Datasource ................................................................................... 11 12Form ................................................................................ 12 13Grid څ ..................................................................................... 13 14Map ................................................................................................................. 13 15query ........................................................................................................... 15 16QueryBuildRange .................................................................................... 17 17QueryBuildRange .................................................................... 18 18Query .................................................................................................................. 25 19Reaseach,Refresh reRead .......................................................................... 26 20TableId RecId .......................................................................................... 26 21this Form .................................................................................................... 27 22X++ ........................................................................................... 27 23, ........................................................................ 30 24 Query ............................................................................. 31 25 Number Sequence ................................................................ 32 26 ............................................................................................. 35

27 ......................................................................................... 35 28 ..................................................................................................... 36 29 ......................................................................................................... 37 30; Ax ...................................................................................... 38 31 ............................................................................. 39 32 ......................................................................................................... 39 33 LOGO ..................................................................... 39 34 ..................................................................... 40 35 ......................................................................................... 41 36 Query .............................................................................................. 41 37 ............................................................................................................. 42 38 ................................................................................. 43 39 ................................................................................................................. 44 40 ......................................................................................................... 45 41 Data Source ...................................................................... 45 42 Form report ...................................................... 46 43 ............................................................................................................. 46 44ȧ ............................................................................................................. 47 45 AX ....................................................................................... 47 46 query .......................................................... 48 47 ......................................................................... 50 48 Form ................................................................................................... 50 49 ............................................................................................................. 51 50 X++ Project ............................................................................................. 52 51 AX Not like .................................................................... 52 52 ................................................................. 53

116 10
class globel::hex2int() static int hex2Int(str 12 hex) { int res = 0; int d = strLen(hex); int i = 1; int char; int largeA = char2num('A',1); int largeF = char2num('F',1); int zero = char2num('0',1); int nine = char2num('9',1); hex = strUpr(hex); while (i <= d) { char = char2num(hex,i); res = res * 16; if ((char >= zero) && (char <= nine)) res += (char - zero); else if ((char >= largeA) && (char <= largeF)) res += (char - largeA + 10); else return 0; i++; } return res; }

2Agrs Class
http://farseer1215.cnblogs.com/archive/2006/06/07/419330.html ,. . Axapta Args ,: 1.. 2.. 3.,, . OO ,,, ,. ب,. Axapta ,,,Action , Axapta Args

,. caller object Args dataset tableid , null, dataset . designName str , null . lookupField Fieldid , loopupValue Str ,. menuitemName Str menuitemType Str Name Str Form Report Form Report parentWnd Int ,. Parm Str parmenumType int ID, enumnum(some-type) parmenum int paramnumType . parmenumType . paramObject Object object Record common dataset , DictTable.makeRecord .

3Args
{ Container cData; ContainerClass cClass; Formrun formRun; Args args = new Args(); ; cData = [st1,int1,boolean1];//container

cClass = new ContainerClass(cData);// ContainerClass args.parmObject(cClass);//ContainerClass args.name(formstr(formname)); formRun = classFactory.formRunClass(args); formRun.init(); formrun.run(); formrun.wait();

{ ContainerClass _ContainerClass; container containerData ; if(element.args() && element.args().parmObject()) { _ContainerClass = element.args().parmObject();// containerData = _ContainerClass.value();// class container container }

4Ax2009
static void TEST_HideContentFrame(Args _args) { #WinApi HWND contentPane = WinApi::findWindowEx(WinAPI::findWindowEx(infolog.hWnd(), 0, 'MDIClient', ''), 0, 'ContentFrame', '' ); ; if (contentPane) WinApi::ShowWindow(contentPane, #SW_HIDE); }

5Axapta Form Form

Form

Form Form GetCoder Form Form OK Form Form s 1 Form str Coder; 2 Form void setCoderValue(str newCoder) { Coder = newCoder; } 3 GetCoder void clicked() { args args; formrun formrun; ; args = new Args(formstr(UnifyCoder));

args.caller(Element); formRun = ClassFactory.formRunClass(args); formRun.init(); formRun.run(); ormRun.wait(); InventTable.ItemId = Coder; } 4 Form OK void clicked() { super(); element.args().caller().setcodervalue(UnifyCoder.GetCoder()); element.close(); }

6Ax
class ThreadDemo { static server void main() { Thread t; ; new ExecutePermission().assert(); //BP Deviation Documented t = new Thread(); t.run(classnum(ThreadDemo), staticmethodstr(ThreadDemo, run)); } static server void run(Thread t) { AsciiIo ai; // Change this to some path that your server will have access to str fileName = '\\t\\HelloWorld.txt'; ; sleep(5000); new FileIOPermission(fileName, 'w').assert(); //BP Deviation Documented ai = new AsciiIo(fileName, 'w'); ai.write('Hello World!');

} } static void ThreadDemoJob(Args _args) { ; ThreadDemo::main(); print 'Ok'; pause; }

7Common
BudgetMap parentLine() { DictTable dictTable = new DictTable(this.TransTableId); Common common; ; common = dictTable.makeRecord(); select common where common.RecId == this.TransRecId; return common; }

8display
1,display form report ? ?2 3 display name getTime() { return date2Str(systemdateget(),123,2,0,2,0,2); } name, display int getTime1()

{ return timeNow(); } display date getTime() { return systemdateget() }

9distinct
X++F SQL distinct F Query r 1 ordermode group by 2 sorting -------------------------------------------------------------------. server static boolean updatedate(PurchIdBase PurchIdBase , TEC_EDIOrder TEC_EDIOrder ) { TEC_EDICount TEC_EDICount; ; ttsbegin; select firstonly forupdate TEC_EDICount index hint Index1 where TEC_EDICount.PurchId == purchIdBase && TEC_EDICount.Tec_EDIOrder == TEC_EDIOrder; if(TEC_EDICount) { TEC_EDICount.Tec_CountEDI += 1 ; TEC_EDICount.doUpdate(); ttscommit; return true ; } ttscommit; return false ;

} -------------------------------------------------------------------lz 1111 2222 group by while select ItemId from trans group by ItemId { print trans.ItemId; } --------------------------------------------------------------------group by Query Query query = new Query(); QueryBuildDataSource queryBuildDataSource; QueryBuildRange queryBuildRange; ?; queryBuildDataSource = query.addDataSource(tablenum(inventTrans)); queryBuildDataSource.sortClear(); queryBuildDataSource.addSortField(fieldnum(InventTrans, itemId)); queryBuildDataSource.orderMode(OrderMode::GroupBy); this.query(query); -------------------------------------------------------------------1 SQL Distinct Group by 2 AX FirstOnly--- Group by

10Form container form
Container cData; ContainerClass cClass; Formrun formRun; Args args = new Args(); cData = [st1,int1,boolean1]; cClass = new ContainerClass(cData); args.parmObject(cClass);//ContainerClass

args.name(formstr(formname)); formRun = classFactory.formRunClass(args); formRun.init(); formrun.run(); formrun.wait();

ContainerClass _ContainerClass; container containerData if(element.args() && element.args().parmObject()) { _ContainerClass = element.args().parmObject();// containerData = _ContainerClass.value();// class container container }

11Form Datasource
Active super()

Create (CTRL+N) defaultMark Grid Delete validateDelete True dislayOption ڡ

super() super(true);

Grid ֧

super()



exeuteQuery Form query

super() Init

Filter



First super() Init super() initValue Form query Form





super()

Last Leave leaveRecord linkActive

super() executeQuery

12Form
public class FormRun extends ObjectRun { Integer viewOptionValue; PrintPostCancel journalStatus; NoYesId journalPrinted; QueryBuildRange rangeStatus; QueryBuildRange rangePrinted; SysLastValue sysLastValue; #define.CurrentVersion(1) #localmacro.CurrentList viewOptionValue, journalStatus, journalPrinted #endmacro }

public void init() { super(); xSysLastValue::getLast(this); }

public void close() { ; xSysLastValue::saveLast(this); super(); } Form:CustInterestNote

13Grid څ
AX4.0Form/ReqPoItemStatistic AX4.0

14Map
Map Maps map Map mymap; mapEnumerator me; ; Mymap = new map(Types::String,Types::String); // Mymap.insert(key,value); // Me = map.getEnumerator(); While(me.MoveNext()) {

Print me.currentKey() + me.currentValue(); } static void Job2(Args _args) { mapIterator mi; map mapC = new map(types::Integer,types::String); int i; while (i<=20) { mapC.insert(i,"aaa" + int2Str(i)); i++; } mi = new mapIterator(mapc); while ( mi.more()) { print mi.key(),"--", mi.value(); mi.next(); } pause; } MSDN mapsӧ Maps Map CustTable myTable 1. AOT Map MapMyMap 2. EDT AccountNum, CustName, CustGroupId CustCurrencyCode MyMap 3. g RESTORE 4. myMap mapping CUSTTABLE ͧ CUSTTABLE accountNum, name, currency and custGroup. 5. MyTable 6. MyMap Methods void listRecords(MyMap _myMap) { ; while select _myMap { info(strFmt("%1, %2", _myMap.accountNum, _myMap.custName));

} } 7. MAPS static void DataDic_TestMyMap(Args _args) { MyMap myMap; CustTable custTable; MyTable myTable; ; myMap.listRecords(myTable); } MAP Tablename.mapsname::mapsmethos(parameter); MAPS MAPS MAPS » MyMap myMap; MyTable myTable; ; myMap = myTable; ttsbegin; select forupdate myMap; myMap.fields = value; ? myMap.insert(); ttscommit;

15query
As the name implies QueryRun is the executor of a query linked to it. To construct a query you want QueryRun to execute, you need build classes: Query QueryBuildDataSource QueryBuildRange QueryBuildFieldList QueryBuildLink QueryBuildDynaLink

Todays example will use the first four to demonstrate a query that sums the credit limit field in CustTable grouped by Country and Currency. Additionally a count field indicates how many records are represented in the sum. Ranges are implemented for AccountNum and Country, but the user is allowed to add additional range criteria in the dialog. To demonstrate the status() property I have locked it, so the user can not change it. QueryRun QueryRun executes the query. If needed the familiar query dialog can be opened before the query is run. This is done using the prompt() method. SysQueryRun extends QueryRun and has a total of 7 prompt*() methods, with different default behavior. For example promptAllowAddRange() would allow the user to add new where-conditions. Query A query represents the select statement. This is where all the strings come together. QueryBuildDataSource Using QueryBuildDataSources you add all the tables you want joined (just one in this example). This is also where you define how the resultset is to be sorted. The orderMode() method lets you define OrderBy GroupBy QueryBuildRange Ranges represent where conditions. Multiple ranges are connected with AND conditions. Unfortunately there is no easy way to change that. QueryBuildFieldList Represents the selected fields of the query. By default all fields are selected. In regular queries you probably wouldnt use them that often, but when grouping this is the way to define which fields are calculated. SelectionField is an enum with the following values Avg Count Database Max Min Sum

static void Job24(Args _args) { CustTable custTable; Query query = new Query(); QueryRun qr = new queryRun(query); QueryBuildDataSource qbds = qr.query().addDataSource(tableNum(CustTable)); QueryBuildRange qbrAccN = qbds.addRange(fieldNum(CustTable,AccountNum)); QueryBuildRange qbrCountry = qbds.addRange(fieldNum(CustTable,CountryRegionId)); QueryBuildFieldList qbfl = qbds.fields(); ; qbrAccN.value('4000..4050'); qbrAccN.status(RangeStatus::Locked); qbrCountry.value('US..'); qbfl.addField(fieldNum(CustTable,CreditMax),SelectionField::Sum); qbfl.addField(fieldnum(CustTable,RecId),SelectionField::Count); qbds.addSortField(fieldnum(CustTable,CountryRegionId)); qbds.addSortField(fieldNum(CustTable,Currency)); qbds.orderMode(OrderMode::GroupBy); if (qr.prompt()) { while (qr.next()) { custTable = qr.get(tableNum(CustTable)); print strfmt("%1 %2 %3 records)",custTable.CountryRegionId,custTable.Currency, num2str(custTable.CreditMax,10,2,0,0),custTable.RecId); } } pause; }

(%4

16QueryBuildRange
QueryBuildRange value value Range Range static void EmptyTest() {

Query q; QueryRun qr; CustTable cust; ; q = new Query(); q.addDataSource(tableNum(custtable)).addRange(fieldnum(custtable,accountnum)).value(''); qr = new QueryRun(q); while(qr.next()) { cust = qr.get(tablenum(custtable)); box::info(cust.Address); } pause; } SysQuery::valueEmptyString(); static void EmptyTest() { Query q; QueryRun qr; CustTable cust; ; q = new Query(); q.addDataSource(tableNum(custtable)).addRange(fieldnum(custtable,accountnum)).value(SysQu ery::valueEmptyString()); qr = new QueryRun(q); while(qr.next()) { cust = qr.get(tablenum(custtable)); box::info(cust.Address); } pause; }

17QueryBuildRange
QueryBuildRange queryBuildRange





Select inventtable where itemid = aa static void job99() { Query QueryBuildRange QueryBuildDataSource QueryRun str str InventTable ;

query; qbr; qbds; qr; qs; s; inventTable;

qs = '"CW"'; query = new Query(); qbds = query.addDataSource(tablenum(InventTable)); qbr = qbds.addRange(fieldnum(InventTable,ItemId)); qbr.value(qs); qr = new QueryRun(query); while(qr.next()) { inventTable = qr.get(tablenum(InventTable)); s = s + inventTable.ItemId + ' '; } print s; pause; }

Select inventDim where color=Gold and size = 30 Range static void Job55(Args _args)

{ Query QueryBuildRange QueryBuildDataSource QueryRun str str str InventDim ; query; qbr; qbds; qr; qscolor; qssize; s; inventDim;

qscolor = '"Gold"'; qssize = '"30"'; query = new Query(); qbds = query.addDataSource(tablenum(InventDim)); qbr = qbds.addRange(fieldnum(InventDim,InventColorId)); qbr.value(qscolor); qbr = qbds.addRange(fieldnum(InventDim,InventSizeId)); qbr.value(qssize); qr = new QueryRun(query); while(qr.next()) { inventDim = qr.get(tablenum(InventDim)); s = s + InventDim.InventDimId + ' '; } print s; pause; } Select inventTable where itemId = aa or itemId = 11 static void Job22(Args _args) { Query QueryBuildRange QueryBuildDataSource QueryRun str

query; qbr; qbds; qr; qs;

str InventTable ;

s; inventTable;

qs = '"cw","11"'; query = new Query(); qbds = query.addDataSource(tablenum(InventTable)); qbr = qbds.addRange(fieldnum(InventTable,ItemId)); qbr.value(qs); qr = new QueryRun(query); while(qr.next()) { inventTable = qr.get(tablenum(InventTable)); s = s + inventTable.ItemId + ' '; } print s; pause; }

Select inventTable where itemId = aa or itemName = admin QueryBuildDataSource Rrange, Range value 1.' '" " 2. 3. 4.֦ 5.֦ DataSource Name 6.string " " queryValue()

7. int 8.Date Date2StrXpp() static void Job23(Args _args) { Query QueryBuildRange QueryBuildDataSource QueryRun str str InventTable ; qs

query; qbr; qbds; qr; qs; s; inventTable;

= strfmt('((%1== "%2") || (%3=="%4"))', fieldStr(inventTable,ItemId),"cw", fieldStr(inventTable,ItemName)," 1");

query = new Query(); qbds = query.addDataSource(tablenum(InventTable)); qbr = qbds.addRange(fieldnum(InventTable,ItemId)); qbr.value(qs); qr = new QueryRun(query); while(qr.next()) { inventTable = qr.get(tablenum(InventTable)); s = s + inventTable.ItemId + ' '; } print s; pause; } B static void Job23(Args _args) {

Query QueryBuildRange QueryBuildDataSource QueryRun str str InventTable ;

query; qbr; qbds; qr; qs; s; inventTable;

qs= '(' + fieldid2name(tablenum(inventTable),fieldnum(inventTable,Itemid))+ ' == '+ '"11"' +'\") '=='+'"aa"'+')'; || ('+fieldid2name(tablenum(inventTable),fieldnum(inventTable,itemId))+

query = new Query(); qbds = query.addDataSource(tablenum(InventTable)); qbr = qbds.addRange(fieldnum(InventTable,ItemId)); qbr.value(qs);

qr = new QueryRun(query); while(qr.next()) { inventTable = qr.get(tablenum(InventTable)); s = s + inventTable.ItemId + ' '; } print s; pause; } Forms-->Adress-->DataSource Method addQuerySalesQuotationTable void addQuerySalesQuotationTable(SalesQuotationTable { QueryBuildDataSource CustTable queryBuildDataSource; custTable; _salesQuotationTable)

str ; queryBuildDataSource custTable

queryExpression;

= this.query().dataSourceTable(tablenum(Address)); = CustTable::Find(_salesQuotationTable.CustAccount);

queryExpression = &apos;(((&apos; + tableid2name(tablenum(Address)) fieldid2name(tablenum(Address), fieldnum(Address, AddrTableId)) + + &apos;.&apos; +

&apos; == &apos; + queryValue(_salesQuotationTable.TableId) + &apos;) && (&apos; + tableid2name(tablenum(Address)) fieldid2name(tablenum(Address), fieldnum(Address, AddrRecId)) + + &apos;.&apos; +

&apos; == &apos; + queryValue(_salesQuotationTable.RecId) + &apos;)) || ((&apos; + tableid2name(tablenum(Address)) fieldid2name(tablenum(Address), fieldnum(Address, AddrTableId)) + + &apos;.&apos; +

&apos; == &apos; + queryValue(custTable.TableId) + &apos;) && (&apos; + tableid2name(tablenum(Address)) fieldid2name(tablenum(Address), fieldnum(Address, AddrRecId)) + + &apos;.&apos; +

&apos; == &apos; + queryValue(custTable.RecId) + &apos;)))&apos;;

queryBuildDataSource.addRange(fieldnum(Address, Address)).value(queryExpression);

}

18Query
QueryBuildRange queryExpression = '(InventTable.ItemName == "") && (InventTable.ItemGroupID == "10")'; qbds.addRange(fieldnum(InventTable, ItemId)).value(queryExpression); queryExpression = '(InventTable.ItemGroupID == "10")'; qbds.addRange(fieldnum(InventTable, ItemId)).value(queryExpression); qbds.addRange(fieldnum(InventTable, ItemName)).value("**"); qbds.addRange(fieldnum(InventTable, ItemName)).value("c*001"); ItemId like 'c*' and itemid like '*001' queryExpression = '(InventTable.ItemGroupID == "20") ||(ItemName == "")'; qbds.addRange(fieldnum(InventTable, ItemId)).value(queryExpression); queryExpression = '20,10'; qbds.addRange(fieldnum(InventTable, ItemGroupId)).value(queryExpression);

queryExpression = '*,00*'; qbds.addRange(fieldnum(InventTable, ItemId)).value(queryExpression

19Reaseach,Refresh reRead
ReSearch() executeQuery ReSearch Refresh Reread Methods on a form data source doupdate update ,. update update , doupdate update , update ..

20TableId RecId
SysDictTable dictTable; WebLink webLink = new WebLink(); PurchTable PurchTableTmp; xtTCardTable xtTCardTableTmp; if(element.args().dataset()) { actualCommon = element.args().record(); actualTableId = actualCommon.TableId; actualRecId = actualCommon.RecId; dictTable = new SysDictTable(actualTableId); //select purchTable where purchTable.RecId == actualRecId; }

select actualCommon where actualCommon.RecId == actualRecId; if(actualCommon) { if(actualCommon.(dictTable.fieldName2Id("approveState")) xtApproveState::Open) { } else { wmf = WebUrlMenuFunction(weburlitemstr('xtEPAuditingCurHistoryInfo')); webLink.menufunction(wmf); webLink.record(actualCommon); url = webLink.url(false); webSession().redirectURL(url); } }

==

new

21this Form
Form this element element this form report element this this element OK Class table this

22X++
1.strlen(str text) text,

static void strlenExample(Args _args) { str source; int i ; ; source = "Axapta"; i = strlen(source); print i;

pause; } 2.strfind(str source,str toFindCharacters,int position ,int number) source toFindCharaters: position: number:

static void strfindExample(Args _args) { str source; str destination; int i ; ; source = "Axapta Axapta"; destination = 'x'; i = strfind(source,destination,3,100); print i; pause; }

3.strins(str source ,str toInsertStr,int postion) ˨ source toInsertStr postion

static void strinsExample(Args _args) { str source; str destination; int i ; ; source = "Axapta Axapta"; destination = ' Axapta'; source = strins(source,destination,7);

print source; pause; } 4.strdel(str source,int postion,int number) source postion number

static void strdelExample(Args _args) { str source; str destination; int i ; ; source = "Axapta Axapta"; source = strdel(source,1,7); print source; pause; } 5.strLFix,strRFix static void SpecialQueryBuild2() { str newStr; ; newStr = strLfix(int2str(8),10,"0"); print(newStr); newStr = strRfix(int2str(8),10,"0"); print(newStr); pause; } 6.strpoke(str text1,str text2, int position) : text1 position text2.

: strpoke('123456789','ABC',3) '12ABC789' 7.strrem(str text1,str text2) : text1 text2 . : strrem('ACBDEFGAEFGD','AF') :'CBDEGEGD'. 8.strLine(str text1,int counter) : text1 counter . : strtemp='SDFEG-jui\nkjedss\nuikjh344\n' strline(strtemp,1) :'kjedss'.

23,
Static Common RecordCopy(Common _from,Common _to) { Dictionary dict; DictTable dictTableFrom; DictTable dictTableTo; DictField dictFieldFrom; DictField dictFieldTo; Integer recCnt; ; dictTableFrom = new DictTable(_from.TableId); dictTableTo = new DictTable(_to.TableId); for (recCnt = 1;recCnt <= dictTableTo.fieldCnt();recCnt ++) { dictFieldTo = dictTableTo.fieldObject(dictTableTo.fieldCnt2Id(recCnt)); if (!dictFieldTo.isSystem()) {

if (dictFieldTo.name() == "oldRecId") dictFieldFrom dictTableFrom.fieldObject(dictTableFrom.fieldName2Id("RecId")); else dictFieldFrom dictTableFrom.fieldObject(dictTableFrom.fieldName2Id(dictFieldTo.name())); if (dictFieldFrom && dictFieldFrom.type() == dictFieldTo.type()) { _to.(dictFieldTo.id()) = _from.(dictFieldFrom.id()); } } } return _to; }

=

=

, :RecordOperation RecordOperation::RecordCopy(from,to);

24 Query
1. void findCaller() { TableTest tableTestTmp; SalesTable salesTableTmp = element.args().record(); ; select tableTestTmp where tableTestTmp.EmployeeId salesTableTmp.SalesResponsible; if (tableTestTmp.RecId) tableTest_ds.findRecord(tableTestTmp); } 2. executeQuery public void executeQuery() { tableTest_ds.findCaller(); super(); }

==

25 Number Sequence
2006-4-15 10:03:00 Daniel.Intelzon Axapta number Sequence Number Sequence SMS SMS_Content SMS_ContentId Number Sequence 1. NumberSeqModule BaseEnum SMS 2. SMS Number Sequence numberSeqReference NumberSeqReference_SMS LoadModule public class NumberSeqReference_SMS extends numberSeqReference { protected void loadModule() { NumberSequenceReference numRef; ; numRef.configurationKeyId = 16001;// Configuration Key AOT Data Dictionary ConfigurationKeys SMS 16001 /* Setup SMS Content number */ numRef.dataTypeId = typeId2ExtendedTypeId(typeid(SMS_ContentId));// number Sequence SMS_ContentId numRef.referenceHelp = literalStr('@SMS151');// Label numRef.wizardContinuous = true;// number sequence

numRef.wizardManual = NoYes::No;// number sequence numRef.wizardAllowChangeDown = NoYes::No;// number sequence numRef.wizardAllowChangeUp = NoYes::No;// number sequence numRef.wizardLowest = 1;//number Sequence numRef.wizardHighest = 9999999;//number Sequence numRef.sortField = 1;// SMS number Sequence this.create(numRef);// number Sequence } public static NumberSeqModule numberSeqModule() { return NumberSeqModule::SMS; } } 3. Class NumberSeqReference construct : case (NumberSeqReference_SMS::numberSeqModule()) : return new NumberSeqReference_SMS(_module); ˧ case number sequence 4. Class NumberSeqReference moduleList : moduleList += NumberSeqReference_SMS::numberSeqModule(); return moduleList number sequence moduleList number Sequence number sequence SMS_ContentId Table initValue NumberSeq numberSeq;//

SMS_Content sms_Content; numberSeq = NumberSeq::newGetNum(NumberSeqReference::findReference(typeId2ExtendedTypeId(typ eid(SMS_ContentId))), true);// sms_Content.SMS_ContentId = numberSeq.num();// delete NumberSeq::release(NumberSeqReference::findReference(typeId2ExtendedTypeId(typeid(S MS_ContentId))).NumberSequence, sms_Content.SMS_ContentId); basic-Setup-Number Sequence-Number Sequence ا basic-Setup-Number Sequence-Reference module SMSreference SMS_ContentId Label AOT-Data Dictionary-Tables-SMS_Content Add-ins Table Browser SMS_ContentId numberSequence

Sequence Number , Basic/setup/Number sequence/numberSequence Sequence 'MySequence', from 1 to 9999999 format='######' , form Create public void create(boolean _append = false) { NumberSeq _numberSeq;//declare a NumberSeq variable ; super(_append); _numberSeq = numberSeq::newGetNumFromCode('MySequence',true,false); CurrentSequenceNo=_NumberSeq.num();

}

26
public void init() { formdatasource formdatasource; QueryBuilddatasource inventTransQuery; ; super(); if(element.args().caller()) { formdatasource = element.args().record().dataSource(); } inventTransQuery formdatasource.queryRun().query().dataSourceTable(tablenum(InventTrans)); info(inventTransQuery.findRange(fieldNum(InventTrans, DatePhysical)).value()); } =

27
static void TestJob(Args _args) { Dictionary dict; DictType dictType; ; dict = new Dictionary(); dictType = dict.typeObject(dict.typeName2Id(extendedtypestr(AccountName))); info(strfmt("Name : %1 \nId: %2 \nStringLength: %3 \nAdjustment: %4 \nLabel: %5 \nHelp: %6 \nBasetype: %7", dictType.name(), dictType.id(), dictType.stringLen(), dictType.stringRight() ? "Right" : "Left", dictType.label(), dictType.help(), int2str(dictType.baseType()) + " - " + enum2Value(dictType.baseType()))); }

28
static void AtuoCreateTable(Args _args) { AOTTableFieldList ATFL Dictionary\\Tables\\myTable\\Fields'); xInfo xInfo = new xInfo(); treeNode nodeTable Dictionary").AOTfindChild("Tables"); treeNode nodeTable1 Dictionary").AOTfindChild("Tables"); treeNode childNode; treenodeIterator nodeIterator; str properties; str fields; ; // nodeTable = nodeTable.AOTfindChild("myTable"); if(!nodeTable) nodeTable.AOTadd("myTable"); // if (!ATFL.AOTFindChild('NewEnum')) ATFL.addEnum('NewEnum'); if (!ATFL.AOTFindChild('PostedDate')) ATFL.addDate('PostedDate'); // /*nodeIterator = nodeTable.AOTiterator(); childNode = nodeIterator.next(); while (childNode) { fields = childNode.treeNodeName(); = xInfo.rootNode().AOTfindChild("Data

=

infolog.findNode('\\Data

=

xInfo.rootNode().AOTfindChild("Data

if (fields == 'Field1') { properties = setProperty(childNode.AOTgetProperties(), "Label","New label"); childNode.AOTsetProperties(properties); break; } childNode = nodeIterator.next(); }*/ nodeTable1.AOTsave(); nodeTable1.AOTrefresh(); }

29
args.record(), FORM FORM FORM :T1 . FormDataSource FormRun T1 t1; ; fr = args.caller(); tTmp = fr.dataSource(); for (t1 = tTmp.GetFirst(1) ? tTmp.GetFirst(1) : args.record();t1;tTmp.GetNext()) { ........ } fr; tTmp;

FormDataSource TempDataSource; Common common; ; if ( element.args().parmEnum() == zyj_reportentrystyle::SelReport ) { TempDataSource = element.args().record().dataSource(); for (common=TempDataSource.getFirst(true) // ? TempDataSource.getFirst(true) : element.args().record();common;common=TempDataSource.getNext()) { element.insertlist(common); } } else if ( element.args().parmEnum() == zyj_reportentrystyle::AllReport ) { TempDataSource = element.args().record().dataSource(); for (common=TempDataSource.getFirst() // ? TempDataSource.getFirst() : element.args().record();common;common=TempDataSource.getNext()) { element.insertlist(common); } }

30; Ax
§ Ax ax InventTable ax Axapta sql

31
static server boolean checkTableName(str 50 _str) { Dictionary dictionary ; int tableCnt ; int i ; TableId tableId ; ; dictionary = new Dictionary() ; tableCnt = dictionary.tableCnt(); for (i = 1 ; i <= tableCnt ; i++) { tableId = dictionary.tableCnt2Id(i) ; if ( _str == dictionary.tableName(tableId) ) { return true ; } } return false ; }

32
changecompany() DataAreaId dataarea DataAreaId = curExt(); dataarea;

//appl.setDefaultCompany(DataAreaId); appl.setDefaultCompany(dataarea.id,false); SysSecurity::reload(false); infolog.runStartupMenu();

33 LOGO
LOGO ħ

display bitmap logo() { companyinfo ci; bitmap zml; ; zml = (select companyinfo).logo; return zml; } return companyinfo::find().logo;

34
<Morphx IT>,38 . է

init() ? dialog() ? run() ? fetch() ? send() ? print() 1. Init() dialog() 2. Run() OK 3. Fetch() Query Send() Report Design Fetch Send 4. print() ٧ Query programmable section ֧report Runbase framework AOT ҧ init() ? run() ? prompt() ? fetch() ? send() ? print() dialog() RunBaseReportStd Runbase Runbase framework Prompt()

35
static void GetUserInfo(Args _args) { UserInfo UserInfo ; ; Print infolog.isoCurrencyCode(); // Print infolog.Language(); pause; } //

36 Query
static void Exercise3(Args _args) { CustTable _custTable; CustTrans _custTrans; Query q = new Query(); QueryBuildDataSource qbdCustTable; QueryBuildDataSource qbdCustTrans; QueryRun _queryExercise; Name _name; AmountMST _amountMST; ; //add the first data source. qbdCustTable = q.addDataSource(TableNum(CustTable)); qbdCustTable.addSortField(FieldNum(CustTable,Name)); //add the second datasource. qbdCustTrans = qbdCustTable.addDataSource(TableNum(CustTrans)); //declare the relation between the two datasources. qbdCustTrans.joinMode(JoinMode::InnerJoin); qbdCustTrans.addLink(fieldnum(CustTable,AccountNum), fieldnum(CustTrans,AccountNum)); _queryExercise = new QueryRun(q); if (_queryExercise.prompt()) { //the query is sorted by Customer.

while (_queryExercise.next()) { _custTable = _queryExercise.getNo(1); _custTrans = _queryExercise.getNo(2); if (_name != _custTable.Name) { print _custTable.Name+" "+ num2str(_amountMST,10,2,2,1); //start calculating for the next customer. _name = _custTable.Name; _amountMST = 0; } //increase the total amout of sales orders _amountMST += _custTrans.AmountMST; } } pause; }

37
FORM form ݧ --------------------------------------------------------------------------------------------------------------,! Query, RecordInsertList ,, ,! ---------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------, SCOPE . public final void setTmpData(Common _cursor) TmpTalbe tmp1, tmp2; tmp2.setTmpData(tmp1);

tmp1 tmp2 data. FORM form answer: Report Form data.. ---------------------------------------------------------------------------------------------------------------- TMP* Insert setTmpData() ---------------------------------------------------------------------------------------------------------------- Report Data Source ] QueryRun.setRecord();

38
1 public static boolean isIncludesInUserGroup(userID _userid,userGroupID _UserGroup) { userGroupList userGroupList; boolean ret; ; select firstonly groupId from userGroupList where userGroupList.userId userGrouplist.groupId==_userGroup; if (userGroupList.userId!='') ret=true; else ret=false; return ret; } 2(_UserID)(_UserGroup); 3_userID, ID_UserGroup 4Job print clsglobe::IncludesInUserGroup('B01','Admin');pause;

==

_userID

&&

TRUE

// if(UserInfoHelp::userInUserGroup(curuserid(),'Admin') ) { info("Yes"); }

39
Cannot execute a data definition language command on (). The SQL database has issued an error., static void forceDbSynchronize(Args _args) { Dictionary dict; int idx, lastIdx, totalTables; TableId tableId; Application application; SysOperationProgress progress; StackBase errorStack; ErrorTxt errorTxt; ; application = new Application(); dict = new Dictionary(); totalTables = dict.tableCnt(); progress = new SysOperationProgress(); progress.setTotal(totalTables); progress.setCaption("@SYS90206"); errorStack = new StackBase(Types::String); lastIdx = 0; try { for (idx = lastIdx+1; idx <= totalTables; idx++) { tableId = dict.tableCnt2Id(idx); progress.setText(dict.tableName(tableId)); lastIdx = idx; application.dbSynchronize(tableId, false, true, false);

progress.incCount(); } } catch (Exception::Error) { errorTxt = strFmt("Error in table '%1' (%2)", tableId, dict.tableName(tableId)); errorStack.push(errorTxt); retry; } setPrefix("@SYS86407"); errorTxt = errorStack.pop(); while (errorTxt) { error(errorTxt); errorTxt = errorStack.pop(); } }

40
CHECKPOINT DBCC DROPCLEANBUFFERS WITH NO_INFOMSGS DBCC FREEPROCCACHE WITH NO_INFOMSGS

41 Data Source
void clicked() { int i; formdataSource fds; ; super(); for (i=1;i<=element.dataSourceCount();i++) { fds = element.objectSet(i) ; info(tableId2name( fds.table())); }

}

42 Form report
field Groups | autoreport form

43
static void Job7(Args _args) { #AOT str Reportname,ReportLabel,s; TreeNode tmp,node,design; TreeNodeIterator iterator; int i; ReportList tl; ; delete_from tl; select firstonly tl ; node = infolog.findNode(#ReportsPath); if (node) { iterator = node.AOTiterator(); if (iterator) tmp = iterator.next(); while (tmp) { Reportname = tmp.treeNodeName(); design = tmp.AOTfindChild( 'Designs');

if (design) { design = design.AOTfirstChild(); if (design) {

s = design.AOTgetProperty('caption'); ReportLabel = syslabel::labelId2String(s); } } if (ReportLabel) { tl.ReportName = reportname; tl.ReportLabel = ReportLabel; tl.insert(); } tmp = iterator.next(); } } pause; }

44ȧ
? NoOfDecimals . extenddatatype NoOfDecimals , , , form,editer,gride,report . 1 AOT Ŧ AOT ->DATA DICTIONARY-> TABLE EXTENDEDDATATYPE AOT ->DATA DICTIONARY-> EXTENDED DATA TYPE NoOfDecimal 2 2

45 AX
xInfo::directory(DirectoryType::Appl) DirectoryType // BIN Temp filePath = xInfo::directory(DirectoryType::Bin) + "\Temp"; if(!WinApi::folderExists(filePath)) {

if(!WinApi::createDirectory(filePath)) { info("!"); return; } } static void Job7(Args _args) { xtTPBtmpInventTable it; it.setTmp(); it.ItemId = xinfo::releaseVersion(); it.ItemAllName = xinfo::buildNo(); it.ItemGroupId = xinfo::productName(); it.insert(); info(it.ItemId+" } "+it.ItemAllName +" "+it.ItemGroupId);

46 query
static void CusttomClearRanges(QueryBuildDataSource qbds) { int i; QueryBuildDataSource qbdsInternal; ; qbds.clearRanges(); for(i=1;i<=qbds.childDataSourceCount();i++) { qbdsInternal = qbds.childDataSourceNo(i); Ranges::CusttomClearRanges(qbdsInternal); } } static void TestExample(Args _args)

{ ProdTable InventTable InventItemLocation QueryBuildDataSource QueryBuildDataSource QueryBuildDataSource QueryBuildDataSource prodTable; inventTable; inventItemLocation; qbdsProdTable; qbdsInventTable; qbdsInventDim; qbdsInventItemLocation;

Query query; ; query = new Query(); qbdsProdTable = query.addDataSource(tableNum(ProdTable)); qbdsInventTable = qbdsProdTable.addDataSource(tableNum(InventTable)); qbdsInventItemLocation qbdsInventTable.addDataSource(tableNum(InventItemLocation)); qbdsInventDim = qbdsProdTable.addDataSource(tableNum(InventDim)); qbdsInventTable.relations(true); qbdsInventDim.relations(true); qbdsInventItemLocation.relations(true); qbdsInventTable.fetchMode(0); qbdsInventDim.fetchMode(0); qbdsProdTable.addRange(fieldNum(ProdTable,prodId)).value('aa'); qbdsInventTable.addRange(fieldNum(InventTable,itemId)).value('bb'); qbdsInventItemLocation.addRange(fieldNum(InventItemLocation,itemId)).value('cc'); qbdsInventDim.addRange(fieldNum(InventDim,inventDimId)).value('dd'); // info(qbdsProdTable.toString()); Ranges::CusttomClearRanges(query.dataSourceTable(tableNum(ProdTable))); // info(qbdsProdTable.toString()); }

=

47
ϡ 1. B init public void init() { super(); infolog.globalCache().set("B","FormB",element); } 2. B close public void close() { super(); infolog.globalCache().remove("B","FormB"); } B ԧ B B 3. A clicked void clicked() { FormRun fr; ; super(); if(infolog.globalCache().get('B','FormB')) { fr = infolog.globalCache().get('B','FormB'); fr.close(); } } B ɧ B

48 Form
From : // getdata Form,cmdOK .

public void getData() { cmdok.clicked();// this.close(),; }

// 1000 public void run() { super(); this.setTimeOut('getdata',1000,true); }

49
void clicked() { Args MenuFunction ;

parameters = new Args(); salesConfirmMenu;

if(xtTPBDataTransact.ItemRelease == 1) { salesConfirmMenu = new MenuFunction(menuItemdisplayStr(xtMPBDataTransform_Invent), MenuItemType::display); } if(xtTPBDataTransact.RouteRelease == 1) { salesConfirmMenu = new MenuFunction(menuItemdisplayStr(xtMPBDataTransform_Route), MenuItemType::display); } if(xtTPBDataTransact.EbomRelease == 1 || xtTPBDataTransact.MbomRelease == 1) { salesConfirmMenu = new MenuFunction(menuItemOutPutStr(xtMPBDataTransform_Bom), MenuItemType::Output); } parameters.caller(this);

parameters.record(xtTPBDataTransact);

salesConfirmMenu.run(parameters); }

50 X++ Project
static void Job1(Args _args) { ProjectNode pNode; ProjectGroupNode pgNode; ProjectListNode plNode; ; //delete project pNode = SysTreeNode::getPrivateProject().AOTfindChild("testPrivateProject"); if(pNode) pNode.AOTdelete(); //create test project pNode = SysTreeNode::getPrivateProject().AOTadd("testPrivateProject"); //load project pNode = pNode.getRunNode(); //add group node to project pgNode = pNode.AOTadd("testGroup"); pgNode.projectGroupType(GroupNodeType::Tables); //add node to group pgNode.addNode(TreeNode::findNode("\\Classes").AOTfirstChild()); //add node to project pNode.addNode(TreeNode::findNode("\\Forms").AOTfirstChild()); //save project pNode.AOTsave(); }

51 AX Not like
not like PurchTable 00007 purchId

PurchTable purchTable; ; select firstonly purchTable where !(purchTable.purchId like '00007*'); PurchTable purchTable, refPurchTable; ; select firstonly purchTable notexists join refPurchTable where purchTable.PurchId like '00007*'; Query Query query = new Query(); QueryRun queryRun; ; query.addDataSource(tableNum(PurchTable)).addRange(fieldNum(PurchTable, PurchId)).value('!00007*'); queryRun = new QueryRun(query); if(queryRun.next()) { purchTable = queryRun.get(tableNum(PurchTable)); print purchTable.PurchId; pause; }

52
ItemID, ItemGroup='Group1' ItemType='Bom' Itemgroup ITEMTYPE 1 InventTable lookupItemByItemTypeGroup client static void lookupItemByItemTypeGroup(FormStringControl lookupCtrl, ItemGroupId ItemGroupId,ItemType _ItemTYpe=ItemType::BOM) { SysTableLookup sysTableLookup = SysTableLookup::newParameters(tableNum(InventTable), lookupCtrl); Query query = new Query();

QueryBuildDataSource queryBuildDataSource query.addDataSource(tableNum(InventTable)); QueryBuildRange queryBuildRange queryBuildDataSource.addRange(fieldNum(InventTable, ItemGroupId)); QueryBuildRange queryBuildRange1 queryBuildDataSource.addRange(fieldNum(InventTable, ItemType)); ; QueryBuildRange.value(ItemGroupId); QueryBuildRange1.value(enum2str(_ItemTYpe)); sysTableLookup.addLookupfield(fieldNum(InventTable, ItemId)); sysTableLookup.addLookupfield(fieldNum(InventTable, ItemName)); sysTableLookup.parmQuery(query); sysTableLookup.performFormLookup(); } lookup public void lookup() {

= = =

// super();//ڧ ; inventtable::lookupItemByItemTypeGroup(this,'Group1',ItemType::BOM); } 2 lookup է View view ITemGroupID "Group1" Inventtable ItemGroupID.

pangningwxh 2009 12 10


:

Microsoft Dynamics AX.pdf

Microsoft Dynamics AX - Microsoft?Dynamics?AX? ? [Microsoft Dynamics ] ID ...


Dynamics Ax.pdf

Dynamics Ax_IT/_Ax


Dynamics AX2009_.doc

Dynamics AX2009 - Dynamics AX2009 : MBS ,,,...


Microsoft Dynamics Ax_.ppt

Microsoft Dynamics Ax - Microsoft Dynamics Ax,p: 1AX 2AX 3X++ ...


ERP Dynamics AX2012 ().pdf

ERP Dynamics AX2012 ()__IT/_...Dynamics Ax 54 Oracle,SAP,AxaptaE... 8 AX2012...


Dynamics AX.pdf

Dynamics AX - ,Dynamics AX;...


MicrosoftDynamicsAX.doc

MicrosoftDynamicsAX - MicrosoftDynamicsAX --ERP --ERP 1]: [...


Microsoft-Dynamics-Ax_.ppt

AX 3X++ 4X++ 5(Data...Dynamics Ax 54 Microsoft Axapta... 46 1 ...


Dynamics AX.doc

Dynamics AX_IT/_Dynamics AX ...Dynamics AX ... 15 Dynamics Ax 54 1 ...


Dynamics AX _.doc

Dynamics AX - ,


Microsoft Dynamics AX 2009 -1.pdf

Microsoft Dynamics AX 2009 -1__AX2009 ... ,Microsoft Dynamics AX ...


Microsoft Dynamics AX.doc

(), ERPAxapta 3.0(:Dynamics AX ), ...


Dynamics AX _.ppt

Page 2 Dynamics AX 2009 Dynamics AX 2009 Dynamics AX...Dynamics Ax 54 1 AX2009... 1 2...


Dynamics AX ERP SSRS .doc

Dynamics AX ERP SSRS __IT/_ ...Dynamics Ax 54 1 Microsoft Dynamics Ax... 133 1...


1.Dynamic AX_.ppt

1.Dynamic AX__IT/_Dynamics AX... 3.0+sp5,,4.0...


MicrosoftDynamicsAX..doc

Microsoft Dynamics AX ... ,Q,Ч,...


Microsoft Dynamics AX.doc

Microsoft Dynamics AX - Microsoft Dynamics AX ā ERP ...


Dynamics _.ppt

Dynamics AX 2012 R3 * Retail for Dynamics AX ,...( ) Office ...


Dynamics AX 2009 ݌_.doc

Dynamics AX2009 ݌


Dynamics AX 2012 R3 _.pdf

, APP,ܧ Microsoft Dynamics AX...

|
All rights reserved Powered by www.tceic.com
copyright ©right 2010-2021
zhit325@126.com