x++

How to do unit testing in Microsoft Dynamics AX 2012 in a real world project

半世苍凉 提交于 2019-12-04 13:54:18
问题 Dynamics AX 2012 comes with unit testing support. To have meaningful tests some test data needs to be provided (stored in tables in the database). To get a reproducable outcome of the unit tests we need to have the same data stored in the tables every time the tests are run. Now the question is, how can we accomplish this? I learned that there is the possibility of setting the isolation level for the TestSuite to SysTestSuiteCompanyIsolateClass . This will create an empty company and delete

How to create a lookup with fields from more than one datasource?

谁说胖子不能爱 提交于 2019-12-04 11:56:08
I need to create Dynamic lookup in my form field which should display fields from two different datasources.. I am trying to perform it as: public void lookup() { query = new Query(); sysTableLookup = SysTableLookup::newParameters(tableNum(smmBusRelTable), this); qbds = query.addDataSource(tablenum(smmBusRelTable)); // qbds.addDataSource(tableNum(DirPartyTable)); //qbds.relations(true); sysTableLookup.parmQuery(query); sysTableLookup.addLookupField(fieldNum(smmBusRelTable, Busrelaccount)); //sysTableLookup.addLookupfield(fieldNum(DirPartyTable, Name)); sysTableLookup.performFormLookup(); }

Table Update Event Handler

给你一囗甜甜゛ 提交于 2019-12-04 07:48:46
I am investigating the capabilities of the new delegate & event subscription pattern in AX 2012. At the moment I am looking to detect when a particular field has been modified, for example when SalesTable.SalesStatus is changed to SalesStatus::Invoiced . I have created the following post-event handler and attatched to the SalesTable.Update method; public static void SalesTable_UpdatePosteventHandler(XppPrePostArgs _args) { Info("Sales Update Event Handler"); } Now I know I can get the SalesTable from the _args , but how can I detect a field has changed? I could really use a before & after

Nested notExists joins X++ (Dynamics AX3.0)

馋奶兔 提交于 2019-12-03 22:11:45
When the following code executes: select sum(qty) from inventTrans index hint TransTypeIdx where inventTrans.ItemId == itemId && inventTrans.TransType == InventTransType::Sales && inventTrans.InventDimId == inventDimId notExists join custTable where custTable.AccountNum == inventTrans.CustVendAC && custTable.CustGroup == custGroupId notExists join salesTable where salesTable.SalesId == inventTrans.TransRefId && salesTable.Extraordinary == NoYes::Yes; The sql generated nests the second notExists join (salesTable) into the where clause of the first notExists join (custTable). ie SELECT SUM(A.QTY

Microsoft Dynamics AX 2009 development [closed]

对着背影说爱祢 提交于 2019-12-03 11:53:20
问题 As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance. Closed 6 years ago . I'm new to Microsoft Dynamics AX development and I'd like to learn basic things about it. I have a virtual machine with the '09

“this” vs. “element” keyword in X++

杀马特。学长 韩版系。学妹 提交于 2019-12-03 10:54:34
When writing code in X++ you sometimes need to reference this.functionYouWant() and sometimes it is element.FunctionYouWant() . Sometimes both are in scope. I often try one and if the function I want isn't there I try the other. Is there a rule that explains when to use this and when to use element ? Allan Iversen this can be used in any objects to reference the current object and member methods. MorphX forms and reports are composite objects. In forms the collection of objects is contained within a FormRun object. You can reference members in the outer FormRun object by using the element

How to do unit testing in Microsoft Dynamics AX 2012 in a real world project

别来无恙 提交于 2019-12-03 08:01:35
Dynamics AX 2012 comes with unit testing support. To have meaningful tests some test data needs to be provided (stored in tables in the database). To get a reproducable outcome of the unit tests we need to have the same data stored in the tables every time the tests are run. Now the question is, how can we accomplish this? I learned that there is the possibility of setting the isolation level for the TestSuite to SysTestSuiteCompanyIsolateClass . This will create an empty company and delete the company after the tests have been run. In the setup() method I can fill my testdata into the tables

Microsoft Dynamics AX 2009 development [closed]

一曲冷凌霜 提交于 2019-12-03 02:13:53
I'm new to Microsoft Dynamics AX development and I'd like to learn basic things about it. I have a virtual machine with the '09 version installed. Is it essential to get familiarized with the language (X++) from the beginning? What should I start with (tutorials, videos, overviews, guided tours) and where do I find it? I'd like links, tips, or anything that may help! Is it easy to find step by step tutorials? Any links for that? Because SO does not let me to post many links I have posted it to Axaptapedia Download the "Inside Dynamics Ax 4" free ebook from microsoft and read then read What's

D365 FO Simple Query for expiring contract

微笑、不失礼 提交于 2019-12-02 09:49:00
I need to create simple query which will show all contracts which will expire in next 3 months. I know how to do that with SQL, but how to do that in Visual Studio when I create query. I added data source Contract table. Added range. Column where is date about expiring is VALIDTO. So, something to write up in value, or how to do that ? Solved with two ranges on VALIDTO column. Used (MonthRange(0,3)) with (Day(0)) formulas. 来源: https://stackoverflow.com/questions/56854909/d365-fo-simple-query-for-expiring-contract

Update records that can be retrieved by multiple joins in x++

大兔子大兔子 提交于 2019-12-02 08:53:10
So I have a complete x++ script that aims to update records based on the retrieved result set made with select query with multiple joins and using crosscompany As I have been told, it is not a good idea to update records when there is crosscompany. Can you give expert advice on how to do it the best practice way considering my current script. here is the script static void UpdateSample(Args _args) { InventTable a; InventTableModule b; EcoResProduct c; EcoResProductCategory d; EcoResCategory e; EcoResCategoryHierarchy f; int i = 0; while select crossCompany a exists join b where a.ItemId == b