Creating new NumberSequences in AX (Existing Modules)
Suppose you have created a new Form (Employee) in HRM Module and want to set up NumberSequences on that form.
Here is what you do:1. Create a new EDT called mk_empNumEDT.
2. Create a Table mk_EmployeeTable using this EDT.
3. Create a relation on the EDT.
4. Append \Classes\NumberSeqReference_HRM\loadModule() method and add the following code at the end
//==========================================numRef.DataTypeId = typeId2ExtendedTypeId(typeid(mk_empNumEDT)); // The new EDT you madenumRef.ConfigurationKeyId = configurationkeynum(Your Config Key); // Any Configuration key you madenumRef.ReferenceHelp = literalstr("Your label."); // Label you want to appear on the Parameters FormnumRef.WizardContinuous = true;numRef.WizardManual = NoYes::No;numRef.WizardAllowChangeDown = NoYes::No;numRef.WizardAllowChangeUp = NoYes::No;numRef.SortField = 12; // Sorting on the Parameters FormnumRef.WizardHighest = 999999;this.create(numRef);//==========================================
5. Goto \Basic\Setup\Number sequences\Number sequences and create a new record.
6. Goto \Menus\Basic\Setup\Number sequences\References and select Number sequence code created in step 5.
7. Create a new Method in the mk_EmployeeTable created.\Data Dictionary\Tables\newTable\Methods\ initValue ()
//==========================================public void initValue()
{
this.EmpNum = NumberSeq::newGetNum(NumberSeqReference::findReference(typeId2ExtendedTypeId(typeid(mkEMPNum)))).num();
// this.EmpNum = NumberSeq::newGetNumFromCode('Huma_136').num();// second option we can use.
super();
}//==========================================
8. Create a form and add this table to data source and use it.
This Blog contains information regarding Dynamics AX 365 Finance and Operations AX (Axapta) Development and code that is frequently used. You can post any type of Queries related X++,EP, SSRS and AIF.
Tuesday, 24 June 2008
Thursday, 27 March 2008
Pretty cool stuff in AX 5.0
Pretty cool stuff in AX 5.0
1. Site is set-up as a dimension
2. Product builder
a. Site is designed to work with the product Builder
b. There is a new Rule Debugger that will allow you to track values in the model and that allows you to debug while you test the configuration and test values – real time at the same time in the background
c. New feature in Product Builder – table and ranges and a lot of conditional logic in defining values – all new
3. Master schedule would run across all site
a. Planning parameters by site
b. Can put Forecast Demand at the Site Level and if Site is a Warehouse can roll-up to Manufacturing Facility
c. Ghant simulation – updated – still requires job scheduling – previously it would re-plan with every change – new release has type of simulation so that you can do changes before committing and a new undo and get latest to go back to the starting point – the save feature would commit – right click is good at workflow to go to work order
d. We will definitely want to consider using Job Scheduling for High Tech and set-up one Job Schedule for each operation
e. Gantt chart WILL NOT work with operation scheduling
f. Gantt chart has drag and drop capabilities to reschedule orders – very nice
g. Question – do you need to use job scheduling to get the gantt chart
4. Production Execution
a. Work Center and Work Center groups live within sites
b. And new routes defined by sites
c. You can only assign workcenters that live on the same site as the route
d. BOM’s can be defined at the site or company level
e. Production Units
i. If you want to split up responsibility
ii. Assign to unique production manager
iii. Work center consumption – will enable to use local production staging inventory for backfilling
iv. AX would look at the production unit and use the warehouse defined to the production unit
5. Sales Order Processing - site specific order settings
a. Site Enabled order processing
b. You can default site on customers and vendors
c. Default settings by item
d. Default warehouses and quantities
e. New concept of over riding parameters – the override allows you to set at a specific value for example ATP parameters
f. New ATP information – allows you to see the horizon ahead, I am not sure how this is different – it is a “Look Ahead” option to make better decisions
g. Enhanced Delivery Date Feature
6. Purchase Requisition
a. Create a New Purchase requisition from item catalog
b. Or create it based on an item that does not exist
c. Submit the requisition
d. New workflow is initiated
7. Purchasing
a. Same site capabilities as sales order
b. New RFQ process
c. Involve multiple vendors
d. Save quotes
e. There is something about being able to select multiple vendors – not 100% sure if that is just for getting quotes??
f. You can accept a vendor offer or decline it
8. Inventory Management
a. Site enabled replenishment
i. Min/max
ii. Coverage groups
iii. You can override the planned order type to be used by each site
iv. Lead times for each item for each site
b. Arrival Journals
i. Great new screen – it is a workbench to do receipts of inventory
ii. You can filter based on certain types of parts
iii. Saved by user
iv. System will estimate total volume, weight
v. Once you filter the lines you want to receipt
1. Arrival journal is created
2. Much easier process
9. Quality Management (QMS) system
a. QMS module
b. Included in Advanced management package
c. New features in Inventory
d. Key components
i. Quality Order
ii. Test results
iii. Correction
iv. If conforming can provide Certificate of Analysis
v. Non Conformation – Corrective Action
vi. Related Operations
e. Quality Associations
i. How you link a quality process to specific documents
ii. Describe testing, vendors, customers, - test group
iii. Quality order can be generated based on Sales order for example
iv. Document handling can include specifications on how test should be executed
f. Picking and Shipping
i. Outbound Process (Sales Orders, Production Orders, Transfer Orders – without having WMS)
1. Issue Orders
2. Reserved – Output Orders (Batch Job) – I think that this might be helpful
3. Picked - Picking Rout
4. Staged/Loaded – two stage shipping process stage 1
5. Deducted– two stage shipping process stage 2
ii. When running WMS 2 –
1. New shipment sequences for control of reservations of warehouse
2. You can define a sequence as to how you want to reserve from
3. Shipment confirmation reservations
4. Very powerful – Good for PML
iii. Outbound Rules
1. Staging and Loading processes
2. Outbound Rules define the steps you want to include in the process
3. Can be external and or internal staging
4. New default location on warehouse group when you deliver item to the production floor
5. Added functionality to handle variations
a. Unload
b. Load
c. Really define what goes out the dock
d. Will really allow definition of what has been fixed
6. Shipment Carriers
a. Based on delivery and payments
b. Share data with shipment carriers
c. Receive ASN information
d. Assign tracking numbers
e. New Mode of deliver to a carrier definition – link
f. Standard integration to Fedex, UPS and UPS Ground
10. New Dispatch board – part of the service module
a. Create an agreement
b. System calculates expected
c. New option to dispatch service persons to jobs
d. Rmb – to get to sales order
e. Can move in drag and drop to reschedule service orders
f. Can undo or reset
11. Return Order Features
i. Create return order and can take specific actions
1. Send RMA to the customer to confirm that return has been accepted
2. Return item can be received using a specific type through the arrival
3. You can scrap, put into inventory or test
4. Can create a Sales order to drive sending new product to the customer
5. New reports to assess your returns metrics
12. Product Costing Features
a. New Standard Costing Model in the new release
b. Will comply more to best practices
c. Lots of stuff
d. Model does not require inventory closing
e. Can be run at any time and give accurate results
f. New Model for PPV and all of the other variances - they are easily identified
g. Transactions can be backdated and the standard cost at the time will be used for back dated transactions
h. Enabled by site – each site can have a different site
i. Costing Versions
i. Effective Dating
ii. New Costs – held in pending and not released – used for what if pricing and simulations
iii. Lots of costs types – Cost, Indirect etc.
iv. New costing sheet
1. Used to define to show a tree structure as to how costs are defined
2. Look at all cost components – direct material, direct labor and indirect costs
3. Production Overheads
4. All costs are rolled up into cost
5. Look at variances by production order (from production order)
13. General Feature
a. Async batch transactions
i. Master Scheduling
ii. Inventory Closing
iii. Sales order Processing
iv. Product builder – big performance improvement if you have complex models
b. Role Centers
i. Users can be configured with dedicated role centers
ii. Cubes and Graphs
iii. Easily configurable
iv. Possible to Role Centers to favorite reports
1. MS SQL Server Reports – much greater functionality over std ax reports
2. Pivot Tables – expand and combine options
c. New Office Ribbons describing actions that can be selected
i. 46 list (workbenches) pages including views across the supply chain area
Thanks
Mallik
1. Site is set-up as a dimension
2. Product builder
a. Site is designed to work with the product Builder
b. There is a new Rule Debugger that will allow you to track values in the model and that allows you to debug while you test the configuration and test values – real time at the same time in the background
c. New feature in Product Builder – table and ranges and a lot of conditional logic in defining values – all new
3. Master schedule would run across all site
a. Planning parameters by site
b. Can put Forecast Demand at the Site Level and if Site is a Warehouse can roll-up to Manufacturing Facility
c. Ghant simulation – updated – still requires job scheduling – previously it would re-plan with every change – new release has type of simulation so that you can do changes before committing and a new undo and get latest to go back to the starting point – the save feature would commit – right click is good at workflow to go to work order
d. We will definitely want to consider using Job Scheduling for High Tech and set-up one Job Schedule for each operation
e. Gantt chart WILL NOT work with operation scheduling
f. Gantt chart has drag and drop capabilities to reschedule orders – very nice
g. Question – do you need to use job scheduling to get the gantt chart
4. Production Execution
a. Work Center and Work Center groups live within sites
b. And new routes defined by sites
c. You can only assign workcenters that live on the same site as the route
d. BOM’s can be defined at the site or company level
e. Production Units
i. If you want to split up responsibility
ii. Assign to unique production manager
iii. Work center consumption – will enable to use local production staging inventory for backfilling
iv. AX would look at the production unit and use the warehouse defined to the production unit
5. Sales Order Processing - site specific order settings
a. Site Enabled order processing
b. You can default site on customers and vendors
c. Default settings by item
d. Default warehouses and quantities
e. New concept of over riding parameters – the override allows you to set at a specific value for example ATP parameters
f. New ATP information – allows you to see the horizon ahead, I am not sure how this is different – it is a “Look Ahead” option to make better decisions
g. Enhanced Delivery Date Feature
6. Purchase Requisition
a. Create a New Purchase requisition from item catalog
b. Or create it based on an item that does not exist
c. Submit the requisition
d. New workflow is initiated
7. Purchasing
a. Same site capabilities as sales order
b. New RFQ process
c. Involve multiple vendors
d. Save quotes
e. There is something about being able to select multiple vendors – not 100% sure if that is just for getting quotes??
f. You can accept a vendor offer or decline it
8. Inventory Management
a. Site enabled replenishment
i. Min/max
ii. Coverage groups
iii. You can override the planned order type to be used by each site
iv. Lead times for each item for each site
b. Arrival Journals
i. Great new screen – it is a workbench to do receipts of inventory
ii. You can filter based on certain types of parts
iii. Saved by user
iv. System will estimate total volume, weight
v. Once you filter the lines you want to receipt
1. Arrival journal is created
2. Much easier process
9. Quality Management (QMS) system
a. QMS module
b. Included in Advanced management package
c. New features in Inventory
d. Key components
i. Quality Order
ii. Test results
iii. Correction
iv. If conforming can provide Certificate of Analysis
v. Non Conformation – Corrective Action
vi. Related Operations
e. Quality Associations
i. How you link a quality process to specific documents
ii. Describe testing, vendors, customers, - test group
iii. Quality order can be generated based on Sales order for example
iv. Document handling can include specifications on how test should be executed
f. Picking and Shipping
i. Outbound Process (Sales Orders, Production Orders, Transfer Orders – without having WMS)
1. Issue Orders
2. Reserved – Output Orders (Batch Job) – I think that this might be helpful
3. Picked - Picking Rout
4. Staged/Loaded – two stage shipping process stage 1
5. Deducted– two stage shipping process stage 2
ii. When running WMS 2 –
1. New shipment sequences for control of reservations of warehouse
2. You can define a sequence as to how you want to reserve from
3. Shipment confirmation reservations
4. Very powerful – Good for PML
iii. Outbound Rules
1. Staging and Loading processes
2. Outbound Rules define the steps you want to include in the process
3. Can be external and or internal staging
4. New default location on warehouse group when you deliver item to the production floor
5. Added functionality to handle variations
a. Unload
b. Load
c. Really define what goes out the dock
d. Will really allow definition of what has been fixed
6. Shipment Carriers
a. Based on delivery and payments
b. Share data with shipment carriers
c. Receive ASN information
d. Assign tracking numbers
e. New Mode of deliver to a carrier definition – link
f. Standard integration to Fedex, UPS and UPS Ground
10. New Dispatch board – part of the service module
a. Create an agreement
b. System calculates expected
c. New option to dispatch service persons to jobs
d. Rmb – to get to sales order
e. Can move in drag and drop to reschedule service orders
f. Can undo or reset
11. Return Order Features
i. Create return order and can take specific actions
1. Send RMA to the customer to confirm that return has been accepted
2. Return item can be received using a specific type through the arrival
3. You can scrap, put into inventory or test
4. Can create a Sales order to drive sending new product to the customer
5. New reports to assess your returns metrics
12. Product Costing Features
a. New Standard Costing Model in the new release
b. Will comply more to best practices
c. Lots of stuff
d. Model does not require inventory closing
e. Can be run at any time and give accurate results
f. New Model for PPV and all of the other variances - they are easily identified
g. Transactions can be backdated and the standard cost at the time will be used for back dated transactions
h. Enabled by site – each site can have a different site
i. Costing Versions
i. Effective Dating
ii. New Costs – held in pending and not released – used for what if pricing and simulations
iii. Lots of costs types – Cost, Indirect etc.
iv. New costing sheet
1. Used to define to show a tree structure as to how costs are defined
2. Look at all cost components – direct material, direct labor and indirect costs
3. Production Overheads
4. All costs are rolled up into cost
5. Look at variances by production order (from production order)
13. General Feature
a. Async batch transactions
i. Master Scheduling
ii. Inventory Closing
iii. Sales order Processing
iv. Product builder – big performance improvement if you have complex models
b. Role Centers
i. Users can be configured with dedicated role centers
ii. Cubes and Graphs
iii. Easily configurable
iv. Possible to Role Centers to favorite reports
1. MS SQL Server Reports – much greater functionality over std ax reports
2. Pivot Tables – expand and combine options
c. New Office Ribbons describing actions that can be selected
i. 46 list (workbenches) pages including views across the supply chain area
Thanks
Mallik
Wednesday, 5 March 2008
Dynamics Ax 4.0 Session Types
Dynamics Ax 4.0 Session Types
In this blog post I will provide details on the management of the various user sessions inside the Dynamics Ax server (AOS). I will use the Online users form as a reference to provide context to the material provided below. I hope to provide answers to some of your questions regarding various session types with my post.
Background and Basics
In versions prior to 4.0, Dynamics Ax used to persist the session information in a file which had a “.udb “extension. This file was stored along with the other application files and it had data about the current servers and rich clients (Ax32.exe) currently running in a deployment. Due to scalability and stability concerns we changed the architecture significantly in 4.0 and moved this information to the backend database.
In the 4.0 release the following database components are responsible for persisting and managing the session information in the database
· SysServerSessions table – This table is used to manage the AOS instances. Each running AOS in an installation has a row in this table with the STATUS column equal to 1.
· SysClientSessions table – This table is used to manage the various client sessions connected to different AOS servers. Each client session has a row in this table with the STATUS column equal to 1.
· CREATESERVERSESSIONS stored procedure – This stored procedure is used to populate the SysServerSessions table. This stored procedure is invoked during the startup of an AOS server.
· CREATEUSERSESSIONS stored procedure – This stored procedure is used to populate the SysClientSessions table. This stored procedure is invoked each time a client is launched.
The stored procedures main purpose is to provide a unique ID which is used as an identifier for each session in the AOS. They are also used to enforce the license checks which limit the number of concurrent active sessions based on the numbers specified in the license file.
You don’t need to access the database to get a glimpse of the session data as most of this information is exposed via the Online users form that is available to administrators. You can also use the xSession API to programmatically access the session related information.
Online Users Form – Server Instances
You can use this tab in the form to get information on both the current AOS instances and client sessions. Let’s first take a quick look at the Server Instances tab.
Most of the information is quite obvious but there is couple of things I would like to point out.
· Server instance name is based on the name that is specified in the server configuration. You can use this name to identify each AOS in your installation, you can also use the port information if you are running multiple AOS installations on the same machine.
· Status – This column should indicate “Alive” which represents an active AOS server that is accepting new clients. There are 2 other special states that you should be aware of. These are:
o Dead – Each AOS server has a background thread that pings the database periodically at an interval of 5 minutes. If the AOS does not ping the database then its status is set to “Dead” in the form. Usually this will happen if the AOS has terminated due to an unexpected situation. After an interval of 6 hours one of the other AOS servers running in the same database will update the STATUS column in the SysClientSessions table to 0 for the client sessions rows belonging to the dead AOS server. This prevents a dead AOS from forever consuming licenses by making the system count the client sessions that were still connected to it when it went down.
o Draining – In this state the AOS will not accept new clients and you can trigger the AOS to enter this state by clicking the “Reject new clients” button. You should use this button to manage the load balancing properties of an AOS.
Now let’s look at the other tab containing client sessions information, this tab has lot more interesting data that can be sometimes used for troubleshooting session related issues.
Online Users Form – Client Sessions
You can this form to keep track of all the active client sessions in the system. You can check when the client logged on, the AOS it is connect to and its session id.
I will now describe some of the interesting columns from this grid.
· Session type – This column is used to provide information on the client type. The following client types are valid client types in Dynamics Ax.
o User – This corresponds to the rich client (Ax32.exe). For each rich client instance that is running there will be a row in this tab representing that client with this user type.
o Business Connector – This is used to represent the session that is established when the Logon or LogonAs methods are called using the Business Connector (BC).
o Worker – This session type is overloaded to represent different session types but it is primarily seen in the context of the Business Connector. When BC is used to connect to an AOS, 2 sessions are initially created. The Worker session type corresponds to the main session that is used to represent the BC process. Each time a Logon related method is called a Business Connector session is created, when LogOff is called then the Business Connector session type is removed from the AOS memory and in the database. But the Worker session will be present as long as the BC process is active. This is the reason why there are at 2 sessions shown in the Online users form when connecting using BC.
o Web user – This session type corresponds to an Enterprise Portal (EP) session which is created when using a web browser. EP uses BC as the underlying infrastructure to connect to the AOS so you will see a corresponding Business Connector session in the Online users form. The Business Connector session that is created when using EP is actually a Worker session inside the AOS but it is represented as a Business Connector session in the database because of the way licenses are counted for EP sessions. I will provide more details about the number of licenses consumed for different session types in a later post. One thing to note is that the web user sessions are transient in nature because EP uses session caching and the web user sessions have a very short lifetime as they often map to web page based requests.
o Impersonated session – This session type is created when using the RunAs method in X++.
· Status – This represents the status of the client session. Currently the only value that this column shows is “Running” which represents an active client.
· SPIDs – This column give you the SPID of the connection currently being used by that client. The Ax server uses a connection pool where connections are given to a session on an on-demand basis from a cache. One consequence of this functionality is that if you might not see any SPID for a particular session at that instant if that session is not executing a SQL statement. SPIDS are valuable to troubleshoot database deadlock issues and you can use the functionality provided by the “End Sessions” button to terminate any blocking user. There are various tools available to troubleshoot deadlocks and investigate database blocking issues but I will address that in greater detail in a separate post.
I hope this information has helped you in understanding some aspects of session management inside Dynamics Ax. We are making some enhancements to the online users form in the next release and we would like to hear your comments and feedback in this area.
We plan to have more articles on related areas explaining topics like load balancing, database deadlock troubleshooting etc. We would also like to know if there are any specific topics that you will like to be covered using this forum.
Thanks,
Mallik
In this blog post I will provide details on the management of the various user sessions inside the Dynamics Ax server (AOS). I will use the Online users form as a reference to provide context to the material provided below. I hope to provide answers to some of your questions regarding various session types with my post.
Background and Basics
In versions prior to 4.0, Dynamics Ax used to persist the session information in a file which had a “.udb “extension. This file was stored along with the other application files and it had data about the current servers and rich clients (Ax32.exe) currently running in a deployment. Due to scalability and stability concerns we changed the architecture significantly in 4.0 and moved this information to the backend database.
In the 4.0 release the following database components are responsible for persisting and managing the session information in the database
· SysServerSessions table – This table is used to manage the AOS instances. Each running AOS in an installation has a row in this table with the STATUS column equal to 1.
· SysClientSessions table – This table is used to manage the various client sessions connected to different AOS servers. Each client session has a row in this table with the STATUS column equal to 1.
· CREATESERVERSESSIONS stored procedure – This stored procedure is used to populate the SysServerSessions table. This stored procedure is invoked during the startup of an AOS server.
· CREATEUSERSESSIONS stored procedure – This stored procedure is used to populate the SysClientSessions table. This stored procedure is invoked each time a client is launched.
The stored procedures main purpose is to provide a unique ID which is used as an identifier for each session in the AOS. They are also used to enforce the license checks which limit the number of concurrent active sessions based on the numbers specified in the license file.
You don’t need to access the database to get a glimpse of the session data as most of this information is exposed via the Online users form that is available to administrators. You can also use the xSession API to programmatically access the session related information.
Online Users Form – Server Instances
You can use this tab in the form to get information on both the current AOS instances and client sessions. Let’s first take a quick look at the Server Instances tab.
Most of the information is quite obvious but there is couple of things I would like to point out.
· Server instance name is based on the name that is specified in the server configuration. You can use this name to identify each AOS in your installation, you can also use the port information if you are running multiple AOS installations on the same machine.
· Status – This column should indicate “Alive” which represents an active AOS server that is accepting new clients. There are 2 other special states that you should be aware of. These are:
o Dead – Each AOS server has a background thread that pings the database periodically at an interval of 5 minutes. If the AOS does not ping the database then its status is set to “Dead” in the form. Usually this will happen if the AOS has terminated due to an unexpected situation. After an interval of 6 hours one of the other AOS servers running in the same database will update the STATUS column in the SysClientSessions table to 0 for the client sessions rows belonging to the dead AOS server. This prevents a dead AOS from forever consuming licenses by making the system count the client sessions that were still connected to it when it went down.
o Draining – In this state the AOS will not accept new clients and you can trigger the AOS to enter this state by clicking the “Reject new clients” button. You should use this button to manage the load balancing properties of an AOS.
Now let’s look at the other tab containing client sessions information, this tab has lot more interesting data that can be sometimes used for troubleshooting session related issues.
Online Users Form – Client Sessions
You can this form to keep track of all the active client sessions in the system. You can check when the client logged on, the AOS it is connect to and its session id.
I will now describe some of the interesting columns from this grid.
· Session type – This column is used to provide information on the client type. The following client types are valid client types in Dynamics Ax.
o User – This corresponds to the rich client (Ax32.exe). For each rich client instance that is running there will be a row in this tab representing that client with this user type.
o Business Connector – This is used to represent the session that is established when the Logon or LogonAs methods are called using the Business Connector (BC).
o Worker – This session type is overloaded to represent different session types but it is primarily seen in the context of the Business Connector. When BC is used to connect to an AOS, 2 sessions are initially created. The Worker session type corresponds to the main session that is used to represent the BC process. Each time a Logon related method is called a Business Connector session is created, when LogOff is called then the Business Connector session type is removed from the AOS memory and in the database. But the Worker session will be present as long as the BC process is active. This is the reason why there are at 2 sessions shown in the Online users form when connecting using BC.
o Web user – This session type corresponds to an Enterprise Portal (EP) session which is created when using a web browser. EP uses BC as the underlying infrastructure to connect to the AOS so you will see a corresponding Business Connector session in the Online users form. The Business Connector session that is created when using EP is actually a Worker session inside the AOS but it is represented as a Business Connector session in the database because of the way licenses are counted for EP sessions. I will provide more details about the number of licenses consumed for different session types in a later post. One thing to note is that the web user sessions are transient in nature because EP uses session caching and the web user sessions have a very short lifetime as they often map to web page based requests.
o Impersonated session – This session type is created when using the RunAs method in X++.
· Status – This represents the status of the client session. Currently the only value that this column shows is “Running” which represents an active client.
· SPIDs – This column give you the SPID of the connection currently being used by that client. The Ax server uses a connection pool where connections are given to a session on an on-demand basis from a cache. One consequence of this functionality is that if you might not see any SPID for a particular session at that instant if that session is not executing a SQL statement. SPIDS are valuable to troubleshoot database deadlock issues and you can use the functionality provided by the “End Sessions” button to terminate any blocking user. There are various tools available to troubleshoot deadlocks and investigate database blocking issues but I will address that in greater detail in a separate post.
I hope this information has helped you in understanding some aspects of session management inside Dynamics Ax. We are making some enhancements to the online users form in the next release and we would like to hear your comments and feedback in this area.
We plan to have more articles on related areas explaining topics like load balancing, database deadlock troubleshooting etc. We would also like to know if there are any specific topics that you will like to be covered using this forum.
Thanks,
Mallik
Monday, 11 February 2008
X++ code for Export Table Data to Excel sheet.
static void ExportCurrencyExchangeRates(Args _args){
dteExchRates ldteExchRates;
SysExcelApplication excelApplication;
SysExcelWorkbooks excelWorkBooks;
SysExcelWorkbook excelWorkBook;
SysExcelWorksheets excelWorkSheets;
SysExcelWorksheet excelWorkSheet;
SysExcelRange range;
SysExcelCell SysExcelCell;
SysExcelCells SysExcelCells;
int lineNum=1; // int DataRowNum=1;
Amount exchRate;
Array arr;
Date EDate;
;
excelApplication = SysExcelApplication::construct();
excelWorkBooks = excelApplication.workBooks();
excelWorkBook = excelWorkBooks.add();
excelWorkSheets = excelWorkBook.worksheets();
excelWorkSheet = excelWorkSheets.add();
//excelApplication.visible(TRUE);
EDate = str2date('2050-01-01',321);
while select ldteExchRates where ldteExchRates.ToDate == EDate
{
lineNum++;
arr = new Array(Types::String);
range = excelWorkSheet.Range(strfmt("A%1:F%1", lineNum));
//arr.value( 1, num2str(ldteExchRates.ExchRate,18,2,0,0));
//if(LineNum==1)
// { SysExcelCell = ExcelWorksheet.cells().item(1,1);
SysExcelCell.value( "CurrencyCode");
SysExcelCell = ExcelWorksheet.cells().item(1,2);
SysExcelCell.value( "ExchRate");
SysExcelCell = ExcelWorksheet.cells().item(1,3);
SysExcelCell.value("FromDate");
SysExcelCell = ExcelWorksheet.cells().item(1,4);
SysExcelCell.value("ToDate");
// }
// else
//{
SysExcelCell = ExcelWorksheet.cells().item(lineNum,1);
SysExcelCell.value(ldteExchRates.CurrencyCode);
SysExcelCell = ExcelWorksheet.cells().item(lineNum,2);
exchRate = ldteExchRates.ExchRate/100;
SysExcelCell.value(num2str(exchRate,18,8,0,0));
SysExcelCell = ExcelWorksheet.cells().item(lineNum,3);
SysExcelCell.value( date2str(ldteExchRates.FromDate,321,2,-1,2,-1,4));
SysExcelCell = ExcelWorksheet.cells().item(lineNum,4);
SysExcelCell.value( date2str(ldteExchRates.ToDate,321,2,-1,2,-1,4));
// }
}
excelApplication.visible(TRUE);
}
Thanks
Mallik Gudidevuni
dteExchRates ldteExchRates;
SysExcelApplication excelApplication;
SysExcelWorkbooks excelWorkBooks;
SysExcelWorkbook excelWorkBook;
SysExcelWorksheets excelWorkSheets;
SysExcelWorksheet excelWorkSheet;
SysExcelRange range;
SysExcelCell SysExcelCell;
SysExcelCells SysExcelCells;
int lineNum=1; // int DataRowNum=1;
Amount exchRate;
Array arr;
Date EDate;
;
excelApplication = SysExcelApplication::construct();
excelWorkBooks = excelApplication.workBooks();
excelWorkBook = excelWorkBooks.add();
excelWorkSheets = excelWorkBook.worksheets();
excelWorkSheet = excelWorkSheets.add();
//excelApplication.visible(TRUE);
EDate = str2date('2050-01-01',321);
while select ldteExchRates where ldteExchRates.ToDate == EDate
{
lineNum++;
arr = new Array(Types::String);
range = excelWorkSheet.Range(strfmt("A%1:F%1", lineNum));
//arr.value( 1, num2str(ldteExchRates.ExchRate,18,2,0,0));
//if(LineNum==1)
// { SysExcelCell = ExcelWorksheet.cells().item(1,1);
SysExcelCell.value( "CurrencyCode");
SysExcelCell = ExcelWorksheet.cells().item(1,2);
SysExcelCell.value( "ExchRate");
SysExcelCell = ExcelWorksheet.cells().item(1,3);
SysExcelCell.value("FromDate");
SysExcelCell = ExcelWorksheet.cells().item(1,4);
SysExcelCell.value("ToDate");
// }
// else
//{
SysExcelCell = ExcelWorksheet.cells().item(lineNum,1);
SysExcelCell.value(ldteExchRates.CurrencyCode);
SysExcelCell = ExcelWorksheet.cells().item(lineNum,2);
exchRate = ldteExchRates.ExchRate/100;
SysExcelCell.value(num2str(exchRate,18,8,0,0));
SysExcelCell = ExcelWorksheet.cells().item(lineNum,3);
SysExcelCell.value( date2str(ldteExchRates.FromDate,321,2,-1,2,-1,4));
SysExcelCell = ExcelWorksheet.cells().item(lineNum,4);
SysExcelCell.value( date2str(ldteExchRates.ToDate,321,2,-1,2,-1,4));
// }
}
excelApplication.visible(TRUE);
}
Thanks
Mallik Gudidevuni
Sunday, 10 February 2008
Export data from Ax to Excel spread sheets.
This document addresses how to export Currency exchange rates data from Ax to Excel spread sheets.
Step1:
Click on
\Menus\Administration\Periodic\Data export/import\Excel spreadsheets\Template Wizard
This will open a new Wizard.
Step 2:
Click on Next Button
Step 3:
Give the file Path and file name to be created and Click Next Button.
Step 4:
· Select show all Tables radio button.
· Select Currency and ExchRates Tables and click on “>” Button. Then Click on Next Button.
Step 5:
Click Next Button.
Step 6:
Select the fields to be imported by expanding Table or just click on Next Button if you want full fields. By default all fields will be selected.
Step 7:
Click Next Button.
Step 8:
Check “Export Data” check box and Click Next Button.
Step 9:
Click on Finish Button this will show the excel file with the data.
Step1:
Click on
\Menus\Administration\Periodic\Data export/import\Excel spreadsheets\Template Wizard
This will open a new Wizard.
Step 2:
Click on Next Button
Step 3:
Give the file Path and file name to be created and Click Next Button.
Step 4:
· Select show all Tables radio button.
· Select Currency and ExchRates Tables and click on “>” Button. Then Click on Next Button.
Step 5:
Click Next Button.
Step 6:
Select the fields to be imported by expanding Table or just click on Next Button if you want full fields. By default all fields will be selected.
Step 7:
Click Next Button.
Step 8:
Check “Export Data” check box and Click Next Button.
Step 9:
Click on Finish Button this will show the excel file with the data.
Subscribe to:
Posts (Atom)
Import and Export file from BLOB storage Account(Azure) in D365 F&O using X++
Import and Export file from BLOB storage Account in D365 F&O using X++ Import: /// <summary> /// MKInventQualityOrderLineService...
-
In the below example we will see how we can get the default financial dimension values from Purch line table. Here we are using AxdDimensi...
-
It is very common to use Like Operator in SQL SELECT column1, column2, ... FROM table_name WHERE columnN LIKE pattern ; N...
-
Get temp data from class to form Data source AX 2012 + X++ In the below example we will see how we can use the temporary table as form da...