x++

Select Statement Vs Find in Ax

爷,独闯天下 提交于 2019-12-11 02:38:48
问题 while writing code we can either use select statement or select field list or find method on table for fetching the records. I wonder which of the statement helps in better performance 回答1: It really depends on what you actually need. find() methods must return the whole table buffer, that means, all of the columns are projected into the buffer returned by it, so you have the complete record selected. But sometimes you only need a single column, or just a few. In such cases it can be a waste

Passing Financial Dimension combination values in ax 2012

无人久伴 提交于 2019-12-11 02:29:03
问题 I need to pass Ledger Dimension value for General Journal (Table:LedgerJournalTable) form to LedgerJournalTransDaily(Table:LedgerJournalTrns) form along with combination values. EX: In General Journal form I am creating a new journal with the journal name "Alloc"(ledger dimension is like 1003), and in Financial dimension tab I am selecting Cost centre(024), department(001), purpose(training) after that I am clicking on lines, then a new form LedgerJournalTransDaily. In the from grid one filed

Axapta: Load and Save file from and to container field

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-11 02:27:28
问题 I need to customize AX to load an arbitrary file with arbitrary size and save it to database as a container field. I also need to read back from that container field and write the content into a file, which should contain exactly the same file content as before load. I had tried with BinaryIO, unfortunately with no luck 回答1: The answer to this question applies. Especially you should use the system class BinData and the methods loadFile and saveFile . Example: this job copies the notepad

How do you reset the workflow status of a purchase requisition from completed to submitted programatically in X++?

送分小仙女□ 提交于 2019-12-11 00:52:41
问题 MS Dynamics AX 2009: I need to do this from the Purchase Order Screen, so I only have the Purchase Requisition number available from the PurchLines Table. Your help would be really greatly appreciated as there is nothing yet on the net available (that I can find) and there are missing classes in the AX 2009 Tutorials. All helpful answers will definitely get an upvote from me. Edit: Purpose is to force the existing workflow to re-execute on the Purchase Requisition from "Submitted" stage when

Axapta 2009 X++ download text file from a website

主宰稳场 提交于 2019-12-10 20:08:53
问题 I would like to download a text file from a website, given I know the URL of it. 回答1: There are a few examples in Axaptapedia.com, loading Web Documents. The examples use the Microsoft .NET Framework. The code below is from Axaptapedia: public static void TEST_DownloadString (Args _args) { System.Net.WebClient webClient = new System.Net.WebClient(); ; info(webClient.DownloadString('http://axaptapedia.com')); } 来源: https://stackoverflow.com/questions/8253012/axapta-2009-x-download-text-file

Lookup method bug with SysTableLookup?

為{幸葍}努か 提交于 2019-12-10 11:13:54
问题 This is code that should work with any base system added to Tables\ProdBOM. Somehow the query is stripping out data from fields. static void lookupItemIdBOMSubset(FormStringControl _ctrl, ProdId _prodId) { SysTableLookup sysTableLookup = SysTableLookup::newParameters(tableNum(ProdBOM), _ctrl); Query query = new Query(); QueryBuildDataSource qbds = query.addDataSource(tableNum(ProdBOM)); ; qbds.addRange(fieldNum(ProdBOM, ProdId)).value(queryvalue(_prodId)); qbds.addSortField(fieldNum(ProdBOM,

Axapta: Convert utcDateTime to date

≯℡__Kan透↙ 提交于 2019-12-10 10:43:40
问题 What is the best way to convert a utcDateTime value to a date type so I can use the global datetime functions on it? int timeDiff; date _now = systemdateget(); ; select firstOnly myUTCDateTime from _myTable timeDiff = Global::yearDiff(_now, _myTable.myUTCDateTime); info(strfmt('%1', timeDiff); Thanks 回答1: The DateTimeUtil Class has methods for dealing with utcdatetime variables. In your case you would use DateTimeUtil::date . timeDiff = Global::yearDiff(_now, DateTimeUtil::date(_myTable

Make order by with Query in AOT

 ̄綄美尐妖づ 提交于 2019-12-10 10:34:23
问题 I have made a query in AOT. My goal is to print information using Group by "CustGroup" and Order by "count(RecId)" desc of CustTable table. The group by works properly, but the order by does not. I can not understand why... This is what my query looks like: This is code I use: Static void Query(Args _args) { QueryRun qr; CustTable myCustTable; ; qr = new QueryRun(queryStr(MyQuery)); while(qr.next()) { myCustTable = qr.get(tableNum(CustTable)); info(strFmt("Group %1 Num %2", myCustTable

Axapta Dialog Validation

天大地大妈咪最大 提交于 2019-12-09 19:08:22
问题 I've found several posts and articles around the net talking about validating form fields in dialogs, but none of the examples I've found seem to work properly. Can someone post a complete, concise example of x++ code that generates a dialog containing a single text field, performs simple validation (if text = "abc") on it, and either closes the window (returning the field value) if validation passes or generates an Infolog warning without closing the dialog if validation fails. For those of

Advanced query range

久未见 提交于 2019-12-08 21:59:37
问题 How to make a query in Ax with advanced filtering (with x++): I want to make such filter criteria On SalesTable form to show SalesTable.SalesId == "001" || SalesLine.LineAmount == 100 . So result should show SalesOrder 001 AND other salesOrders which has at least one SalesLine with LineAmount = 100? 回答1: The AX select statement supports exists join such as: while select salesTable exits join salesLine where salesLine.SalesId == salesTable.SalesId && salesLine.LineAmount == 100 X++ does not