Oct 23, 2011
Oct 16, 2011
Microsoft Dynamics AX 2012 Development Introduction Certification
Microsoft Dynamics AX 2012 Development Introduction Certification/Exam is here! Exam MB6-869
Just saw this in Microsoft Learning Site.
Exam MB6-869 (Microsoft Dynamics AX 2012 Development Introduction) Released
About this Exam
This certification exam measures your ability to understand and articulate how to use, maintain, and support Microsoft Dynamics AX 2012 development functionality including understanding Microsoft Dynamics AX 2012 architecture, managing the data dictionary, managing the user interface, managing security, working with X++ control statements, managing objects and classes, accessing the database, and handling exceptions.
Exam Topics Covered
The following list includes the topic areas covered on this exam.
Understanding Dynamics AX 2012 Architecture
Managing the Data Dictionary
Managing the User Interface
Managing Security
Working with X++ Control Statements
Managing Objects and Classes
Accessing the Database
Managing Exception Handling
Find more details regarding Exam/Preparation Materials in the below link
http://www.microsoft.com/learning/en/us/exam.aspx?ID=MB6-869&Locale=en-us#tab1
Just saw this in Microsoft Learning Site.
Exam MB6-869 (Microsoft Dynamics AX 2012 Development Introduction) Released
About this Exam
This certification exam measures your ability to understand and articulate how to use, maintain, and support Microsoft Dynamics AX 2012 development functionality including understanding Microsoft Dynamics AX 2012 architecture, managing the data dictionary, managing the user interface, managing security, working with X++ control statements, managing objects and classes, accessing the database, and handling exceptions.
Exam Topics Covered
The following list includes the topic areas covered on this exam.
Understanding Dynamics AX 2012 Architecture
Managing the Data Dictionary
Managing the User Interface
Managing Security
Working with X++ Control Statements
Managing Objects and Classes
Accessing the Database
Managing Exception Handling
Find more details regarding Exam/Preparation Materials in the below link
http://www.microsoft.com/learning/en/us/exam.aspx?ID=MB6-869&Locale=en-us#tab1
Jul 5, 2011
Global Axapta shortcut keys
Use global Axapta shortcut keys
Printing and saving Press
To save an application object CTRL+S
To print an application object CTRL+P
Cut, copy and paste Press
To cut an application object CTRL+X (SHIFT+DEL)
To copy an application object CTRL+C (CRTL+INS)
To paste an application object CTRL+V (SHIFT+INS)
Opening... Press
Open the drop-down list for a combo-box ALT+DOWN ARROW
Open the local menu for the current field SHIFT+F10
To open the Application Object Tree CTRL+D
Closing... Press
Close the active window F4
Exit Microsoft Axapta ALT+F4
Close form ESC
Close the drop-down list for a combo-box ALT+UP ARROW
Getting Help Press
To get Help on an application object F1
To display What's this? Help on an application object SHIFT+F1
Stop method execution Press
To stop method execution (break) CTRL+BREAK
Toggle.... Press
Toggle between CTRL+SPACE
Toggle between the insert and the overwrite settings INSERT
Docking windows.... Press
Toggle the docking feature for the window ALT+F5
Move focus to the next docking window ALT+F6
Move focus to the previous docking window SHIFT+ALT+F6
Clipboard... Press
Cut the selection and put it on the clipboard CTRL+X SHIFT+DELETE
Copy the selection, and put it on the clipboard CTRL+C CTRL+INSERT
Insert clipboard contents CTRL+V SHIFT+INSERT
Find Press
Repeat the last find F3
Navigation... Press
Move the cursor one line up UP ARROW
Move the cursor one line down DOWN ARROW
Go to the top of this page CTRL+PAGE UP
Go to the bottom of this page CTRL+PAGE DOWN
Go to the start of the line/page/file HOME
Go to the end of the line/page/file END
Move the cursor one line up, and block SHIFT+UP ARROW
Move the cursor one line down, and block SHIFT+DOWN ARROW
Move the cursor one character to the left, and block SHIFT+LEFT ARROW
Move the cursor one character to the right, and block SHIFT+RIGHT ARROW
Go to the top of this page, and block SHIFT+PAGE UP
Go to the bottom of this page, and block SHIFT+PAGE DOWN
Actions Press
Cancel changes CTRL+Q
Activate the local menu from the menu bar F10
Free all data and indexes saved in the computers storage system CTRL+O
Use shortcut keys in forms to locate records
Filter functions Press
Apply the value in the current field as a filter for the current data CTRL+K
To set up a filter CTRL+F3
To clear a filter CTRL+SHIFT+F3
Locating records Press
To create a new record CTRL+N
To find the first record CTRL+HOME
To find the last record CTRL+END
Deleting records
Delete the current line CTRL+L
To delete a record ALT+F9
Use shortcut keys to navigate in forms
Field navigation Press
Open a form where the related record is selected CTRL+ALT+F4
Show the previous page of records (only effective in grids) PAGE UP
Show the next page of records (Only effective in grids) PAGE DOWN
Display the previous page of records ALT+F7
Display the next page of records ALT+F8
Restore the active record F5
Open the node in edit/view mode CTRL+SHIFT+F2
Go to the last record CTRL+END
Go to the first record CTRL+HOME
To go to first field CTRL-SHIFT-HOME
To go to last field CTRL+SHIFT+END
To go to previous field SHIFT+TAB
To go to previous tab CTRL+SHIFT+TAB
To go to next tab TAB
To go to previous group CTRL+PAGE UP
To go to next group CTRL+PAGE DOWN
Use shortcut keys in the Application Object Tree
When you want to... Press
Extend , or reduce the selection CTRL+SPACEBAR
Open AOT CTRL+D
Rename an application object F2
Save as CTRL+ALT+S
Save all CTRL+SHIFT+S
Select all CTRL+A
Filter Records CTRL+F3
Edit node CTRL+SHIFT+F2
Jump to the next error message F4
Open an application object CTRL+O
Compile an application object F7
Go to the previous node UP
Go to the next node DOWN
Move the node up ALT+UP
Move the node down ALT+DOWN
Expand the current node RIGHT
Collapse the current node LEFT
Expand the current node as much as possible Keypad *
Expand or reduce the selection CTRL+SPACE
Collapse the current node as much as possible -
Use editor shortcut keys
To make it easier and faster to use the editor, use these shortcut keys:
When you want to... Press
Save as CRTL+ALT+S
Display Field Help ALT+DOWN ARROW
Delete Delete
Select all CRTL+A
Select area ALT+A
Select columns ALT+O
Select lines ALT+L
Delete line CTRL+L
Delete to end of line CTRL+SHIFT+L
Save text as ALT+S
Insert file CTRL+ALT+H
Run a script ALT+M
Delete word to the left CTRL+BACKSPACE
Abort Tab and discard all changes since the last save F6
Abort Tab and save changes F8
Remove all breakpoints CTRL+SHIFT+F9
Insert or remove a breakpoint F9
Enable or disable a breakpoint CTRL+F9
Remove all breakpoints CTRL+SHIFT+F9
Indent selection TAB
Extend selection/remove indent SHIFT+TAB
Open Help on a class F1
Delete the previous word CTRL+BACKSPACE
Open the Find/Replace dialog CTRL+F
Find the next occurrence F3
Compile F7
Compile and close a method F8
Set and delete a breakpoint F9
Replace CTRL+R
Jump to a method CTRL+SHIFT+SPACEBAR
Mark a column ALT+O
To undo and redo Press
Undo selection ALT+U
Undo CTRL+Z (latest ten actions)
Redo CTRL+Y (latest ten actions)
To go to... Press
Specified page or line CTRL+G
Next page PgUp
Previous page PgDn
Top CTRL+HOME
Bottom CTRL+END
Start of line/page/file HOME
End of line/page/file END
One word to the left CTRL+LEFT ARROW
One word to the right CTRL+RIGHT ARROW
Previous page, and block SHIFT+PgUp
Next page, and block SHIFT+PgDn
Top, and block CTRL+SHIFT+HOME
End, and block CTRL+SHIFT+END
Start of the line/page/file, and block SHIFT+HOME
End of the line/page/file, and block SHIFT+END
One word to the left, and block CTRL+SHIFT+LEFT ARROW
One word to the right, and block CTRL+SHIFT+RIGHT ARROW
The next method CRTL+TAB
The previous method CTRL+SHIFT+TAB
To look up... Press
Breakpoints SHIFT+F9
A label CTRL+ALT+SPACEBAR
A Definition CTRL+SHIFT+SPACEBAR
Properties and methods CTRL+SPACEBAR
To list... Press
Application Objects SHIFT+F11
Extended Data Types CTRL+T
Tables F2
Classes F12
Types F4
Enums F11
Reserved words SHIFT+F2
Built-in functions SHIFT+F4
Use shortcut keys in the reportviewer
Action Press
Go there the specified page or line CTRL+G
Go to the start of the line/page/file HOME
Go to the end of the line/page/file END
Go to the start of the line/page/file, and block SHIFT+HOME
Go to the end of the line/page/file, and block SHIFT+END
Go to the previous page SHIFT+PAGE UP
Go to the next page SHIFT+PAGE DOWN
Go to the first page CTRL+ PAGE UP
Go to the last page CTRL+ PAGE DOWN
Display the previous page of records ALT+F7
Display the next page of records ALT+F8
Use debugger shortcut keys
To make it easier and faster to use the system’s debugger, use these shortcut keys:
When you want to... Press
Go to a specified page or line CTRL+G
Enable or disable a breakpoint CTRL+F9
Remove all breakpoints CTRL+SHIFT+F9
Toggle exploded or unexploded source F3
Run the debugger F5
Set or delete a breakpoint F9
Show breakpoint table SHIFT+F9
Step into F8
Step over SHIFT+F8
Step return CTRL+F8
Open or close the variables window ALT+2
Open or close call stack window ALT+3
Open or close system variable window ALT+4
Switch line numbers on/off F4
Printing and saving Press
To save an application object CTRL+S
To print an application object CTRL+P
Cut, copy and paste Press
To cut an application object CTRL+X (SHIFT+DEL)
To copy an application object CTRL+C (CRTL+INS)
To paste an application object CTRL+V (SHIFT+INS)
Opening... Press
Open the drop-down list for a combo-box ALT+DOWN ARROW
Open the local menu for the current field SHIFT+F10
To open the Application Object Tree CTRL+D
Closing... Press
Close the active window F4
Exit Microsoft Axapta ALT+F4
Close form ESC
Close the drop-down list for a combo-box ALT+UP ARROW
Getting Help Press
To get Help on an application object F1
To display What's this? Help on an application object SHIFT+F1
Stop method execution Press
To stop method execution (break) CTRL+BREAK
Toggle.... Press
Toggle between CTRL+SPACE
Toggle between the insert and the overwrite settings INSERT
Docking windows.... Press
Toggle the docking feature for the window ALT+F5
Move focus to the next docking window ALT+F6
Move focus to the previous docking window SHIFT+ALT+F6
Clipboard... Press
Cut the selection and put it on the clipboard CTRL+X SHIFT+DELETE
Copy the selection, and put it on the clipboard CTRL+C CTRL+INSERT
Insert clipboard contents CTRL+V SHIFT+INSERT
Find Press
Repeat the last find F3
Navigation... Press
Move the cursor one line up UP ARROW
Move the cursor one line down DOWN ARROW
Go to the top of this page CTRL+PAGE UP
Go to the bottom of this page CTRL+PAGE DOWN
Go to the start of the line/page/file HOME
Go to the end of the line/page/file END
Move the cursor one line up, and block SHIFT+UP ARROW
Move the cursor one line down, and block SHIFT+DOWN ARROW
Move the cursor one character to the left, and block SHIFT+LEFT ARROW
Move the cursor one character to the right, and block SHIFT+RIGHT ARROW
Go to the top of this page, and block SHIFT+PAGE UP
Go to the bottom of this page, and block SHIFT+PAGE DOWN
Actions Press
Cancel changes CTRL+Q
Activate the local menu from the menu bar F10
Free all data and indexes saved in the computers storage system CTRL+O
Use shortcut keys in forms to locate records
Filter functions Press
Apply the value in the current field as a filter for the current data CTRL+K
To set up a filter CTRL+F3
To clear a filter CTRL+SHIFT+F3
Locating records Press
To create a new record CTRL+N
To find the first record CTRL+HOME
To find the last record CTRL+END
Deleting records
Delete the current line CTRL+L
To delete a record ALT+F9
Use shortcut keys to navigate in forms
Field navigation Press
Open a form where the related record is selected CTRL+ALT+F4
Show the previous page of records (only effective in grids) PAGE UP
Show the next page of records (Only effective in grids) PAGE DOWN
Display the previous page of records ALT+F7
Display the next page of records ALT+F8
Restore the active record F5
Open the node in edit/view mode CTRL+SHIFT+F2
Go to the last record CTRL+END
Go to the first record CTRL+HOME
To go to first field CTRL-SHIFT-HOME
To go to last field CTRL+SHIFT+END
To go to previous field SHIFT+TAB
To go to previous tab CTRL+SHIFT+TAB
To go to next tab TAB
To go to previous group CTRL+PAGE UP
To go to next group CTRL+PAGE DOWN
Use shortcut keys in the Application Object Tree
When you want to... Press
Extend , or reduce the selection CTRL+SPACEBAR
Open AOT CTRL+D
Rename an application object F2
Save as CTRL+ALT+S
Save all CTRL+SHIFT+S
Select all CTRL+A
Filter Records CTRL+F3
Edit node CTRL+SHIFT+F2
Jump to the next error message F4
Open an application object CTRL+O
Compile an application object F7
Go to the previous node UP
Go to the next node DOWN
Move the node up ALT+UP
Move the node down ALT+DOWN
Expand the current node RIGHT
Collapse the current node LEFT
Expand the current node as much as possible Keypad *
Expand or reduce the selection CTRL+SPACE
Collapse the current node as much as possible -
Use editor shortcut keys
To make it easier and faster to use the editor, use these shortcut keys:
When you want to... Press
Save as CRTL+ALT+S
Display Field Help ALT+DOWN ARROW
Delete Delete
Select all CRTL+A
Select area ALT+A
Select columns ALT+O
Select lines ALT+L
Delete line CTRL+L
Delete to end of line CTRL+SHIFT+L
Save text as ALT+S
Insert file CTRL+ALT+H
Run a script ALT+M
Delete word to the left CTRL+BACKSPACE
Abort Tab and discard all changes since the last save F6
Abort Tab and save changes F8
Remove all breakpoints CTRL+SHIFT+F9
Insert or remove a breakpoint F9
Enable or disable a breakpoint CTRL+F9
Remove all breakpoints CTRL+SHIFT+F9
Indent selection TAB
Extend selection/remove indent SHIFT+TAB
Open Help on a class F1
Delete the previous word CTRL+BACKSPACE
Open the Find/Replace dialog CTRL+F
Find the next occurrence F3
Compile F7
Compile and close a method F8
Set and delete a breakpoint F9
Replace CTRL+R
Jump to a method CTRL+SHIFT+SPACEBAR
Mark a column ALT+O
To undo and redo Press
Undo selection ALT+U
Undo CTRL+Z (latest ten actions)
Redo CTRL+Y (latest ten actions)
To go to... Press
Specified page or line CTRL+G
Next page PgUp
Previous page PgDn
Top CTRL+HOME
Bottom CTRL+END
Start of line/page/file HOME
End of line/page/file END
One word to the left CTRL+LEFT ARROW
One word to the right CTRL+RIGHT ARROW
Previous page, and block SHIFT+PgUp
Next page, and block SHIFT+PgDn
Top, and block CTRL+SHIFT+HOME
End, and block CTRL+SHIFT+END
Start of the line/page/file, and block SHIFT+HOME
End of the line/page/file, and block SHIFT+END
One word to the left, and block CTRL+SHIFT+LEFT ARROW
One word to the right, and block CTRL+SHIFT+RIGHT ARROW
The next method CRTL+TAB
The previous method CTRL+SHIFT+TAB
To look up... Press
Breakpoints SHIFT+F9
A label CTRL+ALT+SPACEBAR
A Definition CTRL+SHIFT+SPACEBAR
Properties and methods CTRL+SPACEBAR
To list... Press
Application Objects SHIFT+F11
Extended Data Types CTRL+T
Tables F2
Classes F12
Types F4
Enums F11
Reserved words SHIFT+F2
Built-in functions SHIFT+F4
Use shortcut keys in the reportviewer
Action Press
Go there the specified page or line CTRL+G
Go to the start of the line/page/file HOME
Go to the end of the line/page/file END
Go to the start of the line/page/file, and block SHIFT+HOME
Go to the end of the line/page/file, and block SHIFT+END
Go to the previous page SHIFT+PAGE UP
Go to the next page SHIFT+PAGE DOWN
Go to the first page CTRL+ PAGE UP
Go to the last page CTRL+ PAGE DOWN
Display the previous page of records ALT+F7
Display the next page of records ALT+F8
Use debugger shortcut keys
To make it easier and faster to use the system’s debugger, use these shortcut keys:
When you want to... Press
Go to a specified page or line CTRL+G
Enable or disable a breakpoint CTRL+F9
Remove all breakpoints CTRL+SHIFT+F9
Toggle exploded or unexploded source F3
Run the debugger F5
Set or delete a breakpoint F9
Show breakpoint table SHIFT+F9
Step into F8
Step over SHIFT+F8
Step return CTRL+F8
Open or close the variables window ALT+2
Open or close call stack window ALT+3
Open or close system variable window ALT+4
Switch line numbers on/off F4
Jul 4, 2010
MICROSOFT DYNAMICS AX FAQ'S
General Overview
- Description of your projects, the challenges you faced and how you resolved it, should be able to tell everything confidently.
- Functionality of the Modules on which you worked.
- Main posting classes in AP, AR, IM, Ledger modules.
FAQ’s
Data dictionary
- What is an EDT, Base Enum, how can we use array elements of an EDT,
- Definition and use of Maps, how AddressMap (with methods) is used in standard AX
- What is the difference between Index and Index hint?
- Utility and use of find method.
- How many types of data validation methods are written on table level?
- How many types of relations are available in Axapta, Explain each of them.
- When the recid is generated, what is its utility, what are the different types of Table groups defined on table properties.
- Difference between Primary & Cluster index.
- How many kind of lookups can be made and how.
- How can we utilize field groups in forms
- How many types of Delete Actions are there in Standard Ax and define the use of each
- If any record is created in table I want to fetch the date & time stamp, how will you do that
- What is the function of super()
Classes
1. What is an abstract class, what is the utility of an abstract method
2. Multiple inheritance possible or not, if not how can we overcome that.
3. What is an interface, Why do we implement it
4. Do we need to write main method, give reasons
5. What is difference between new & construct method
6. What is the utilty of the RunOn property
7. What is main class used in batch process OR which class will you inherit to make a batch job
8. How can we make a batch job occur at regular interval
9. What is the main utility of classes in standard Ax
10. Which class is called when we create a SO/PO
11. What are classes used to write query.
12. What is a static method, why do we make static methods and where can we write it.
13. When do we make methods private or protected.
Forms
1. What is the basic structure of a form
2. Utility of init(), run(), wait() methods
3. What are different types of Link Types available in a form datasource, justify each of them
4. Properties of a form datasource
5. validateWrite() method can be written in form datasource as well as table level, when should we write it in form DS and when in table. Similar in case of write() method
6. How can we call table level methods from form DS (similar methods)
7. What is the difference between form init() & DS init()
8. When a form opens what are the sequential methods called.
9. Where is the best place to write code to perform filter in a form
10. What are the different types of menu items available, explain each of them
11. A action type menu item is attached to a form but in the drop down the menu item is not appearing, what could be the problem
Reports
1. What are the two most important methods
2. When do block the super() method of fetch
3. Can we make a report from wizard, if yes from where
4. What is a Programmable Section, how we use it in reports
5. What is the difference between Auto Design Spec & Generated Design
6. How can we sort the DS, what facility we can get in by placing fields in Ranges
7. What is the role of executeSection
8. What are Queries, how do we use them
Menu Items
1. What is the use of Parameter, Enum TypeParameter/Enum Parameter properties of display
2. Why do we provide Configuration key & Security key
3. Normally what do we attach in Output
4. Normally what do we attach in Action
General Questions
1. What is difference between select & select firstonly statements
2. What are the keywords used to access data from "multiple companies" and "one company to another company".
3. How can we override a lookup
4. How do the following methods work in a form DS.
ds.refresh(), ds.research(), ds.reread(), in what situation we should these methods
5. On closing a form name the methods which are invoked
6. What are security key/configuration keys, how do we use it in Ax
7. How can we provide user level/user group level security
8. What is a virtual company
9. What is Visual MorphXplorer, what do we do with that
10. What is the function of Application Hierarchy Tree
11. If you want to monitor the database activity, where can you get that
12. Where can we find the Label log and what is its utility
13. What are the tools you will use to upgrade any object
14. What is the difference between display() and edit() methods, how do we use each
15. What is the use of System Documentation/Application Developer Documentation/Application Documentation.
Few More Questions on DAX
1.What are the classes,Tables,Forms and Methods used to post the sales orders.
2.What are the classes,Tables,Forms and Methods used to post the purchage orders.
3.What are the classes,Tables,Forms and Methods used to post the Ledgers.
4.What are the classes,Tables,Forms and Methods used to post the Inventory.
5.What is the base class to send the on-boad E-mailing.
6.What are the storage Dimensions?
7.What are the Item Dimensions?
8.What is the difference between RunBase and RunBaseBatch?
9.How do you create a NumberSequence for existing Module and also fro new Module.
10.What is the difference between Insert and doinsert.
11.What is the Runbase Stack?
2.What are the classes,Tables,Forms and Methods used to post the purchage orders.
3.What are the classes,Tables,Forms and Methods used to post the Ledgers.
4.What are the classes,Tables,Forms and Methods used to post the Inventory.
5.What is the base class to send the on-boad E-mailing.
6.What are the storage Dimensions?
7.What are the Item Dimensions?
8.What is the difference between RunBase and RunBaseBatch?
9.How do you create a NumberSequence for existing Module and also fro new Module.
10.What is the difference between Insert and doinsert.
11.What is the Runbase Stack?
Jun 6, 2010
X++ code to write data to Event viewer
X++ code to write data to Event viewer.
Usually it will be difficult to monitor/debug Batch Jobs running on server . For e.g if something goes wrong than we can't find out why.
So we can make use of Eventviewer instead of infolog and monitor the status by checking the eventviewr .
Following Job illustrates how to write to event viewer.
static void Dev_Write2EventViewer(Args _args)
{
System.Diagnostics.EventLog eventlog;
Str logSource;
Str logName;
;
logSource = "Dynamics Ax";
logName = "Dynamics Ax Log";
// check if the log already exists
if(!System.Diagnostics.EventLog::SourceExists(logSource))
{
// create new log
System.Diagnostics.EventLog::CreateEventSource(logSource, logName);
}
eventlog = new System.Diagnostics.EventLog();
eventlog.set_Source(logSource);
eventlog.WriteEntry("Info Message");
eventlog.WriteEntry("Warning Message" , System.Diagnostics.EventLogEntryType::Warning);
eventlog.WriteEntry("Error! Please check the stack trace below. \n\n" +
con2str(xSession::xppCallStack()), System.Diagnostics.EventLogEntryType::Error);
info("Check the event viewer!");
}
Usually it will be difficult to monitor/debug Batch Jobs running on server . For e.g if something goes wrong than we can't find out why.
So we can make use of Eventviewer instead of infolog and monitor the status by checking the eventviewr .
Following Job illustrates how to write to event viewer.
static void Dev_Write2EventViewer(Args _args)
{
System.Diagnostics.EventLog eventlog;
Str logSource;
Str logName;
;
logSource = "Dynamics Ax";
logName = "Dynamics Ax Log";
// check if the log already exists
if(!System.Diagnostics.EventLog::SourceExists(logSource))
{
// create new log
System.Diagnostics.EventLog::CreateEventSource(logSource, logName);
}
eventlog = new System.Diagnostics.EventLog();
eventlog.set_Source(logSource);
eventlog.WriteEntry("Info Message");
eventlog.WriteEntry("Warning Message" , System.Diagnostics.EventLogEntryType::Warning);
eventlog.WriteEntry("Error! Please check the stack trace below. \n\n" +
con2str(xSession::xppCallStack()), System.Diagnostics.EventLogEntryType::Error);
info("Check the event viewer!");
}
Code to Display Expiry date Message at Status Bar.
Code to Display Expiry date Message at Status Bar.
Following job illustrates how you can display custom message in the status bar next to alerts. ( Mean , At bottom where you will find company,layer,currency info).
static void Dev_setStatusLineText(Args _args)
{
str msg;
;
msg = "Expiry date :"+date2str(xinfo::expireDate(),123,2,4,2,4,2);
// Force the text to be shown
xUserInfo::statusLine_CustomText(true);
infolog.writeCustomStatlineItem(msg);
}
Following job illustrates how you can display custom message in the status bar next to alerts. ( Mean , At bottom where you will find company,layer,currency info).
static void Dev_setStatusLineText(Args _args)
{
str msg;
;
msg = "Expiry date :"+date2str(xinfo::expireDate(),123,2,4,2,4,2);
// Force the text to be shown
xUserInfo::statusLine_CustomText(true);
infolog.writeCustomStatlineItem(msg);
}
TextBuffer Class to replace the special characters in string.
TextBuffer Class to replace the special characters in string.
TextBuffer class can be used to replace the text/characters in the string.
Usually its used to replace the special character with escape sequence so that string(data with special character) can be inserted into the database.
Following job illustrates how to achieve this.
static void Dev_ReplaceTxt(Args _args)
{
TextBuffer buffer = new TextBuffer();
Str message;
;
message = " hi hello's how r u's ";
message += " How r u doing........................";
buffer.setText(message);
buffer.replace("[*?']","\\'"); // replace special character with escape sequence
info(buffer.getText());
}
TextBuffer class can be used to replace the text/characters in the string.
Usually its used to replace the special character with escape sequence so that string(data with special character) can be inserted into the database.
Following job illustrates how to achieve this.
static void Dev_ReplaceTxt(Args _args)
{
TextBuffer buffer = new TextBuffer();
Str message;
;
message = " hi hello's how r u's ";
message += " How r u doing........................";
buffer.setText(message);
buffer.replace("[*?']","\\'"); // replace special character with escape sequence
info(buffer.getText());
}
X++ Code to Create Purchase Order and Post the Invoice.
X++ Code to Create Purchase Order and Post the Invoice.
Following Job creates the Purchase order from code and post the invoice by making use of PurchFormLetter class.
If you don't have demo data , please test with your input values.
static void Dev_CreatePO_and_Invoice(Args _args)
{
NumberSeq numberSeq;
Purchtable Purchtable;
PurchLine PurchLine;
PurchFormLetter purchFormLetter;
;
ttsbegin;
numberSeq = NumberSeq::newGetNumFromCode(purchParameters::numRefPurchaseOrderId().NumberSequence,true);
// Initialize Purchase order values
Purchtable.initValue();
Purchtable.PurchId = numberSeq.num();
Purchtable.OrderAccount = '3000';
Purchtable.initFromVendTable();
if (!Purchtable.validateWrite())
{
throw Exception::Error;
}
Purchtable.insert();
// Initialize Purchase Line items
PurchLine.PurchId = Purchtable.PurchId;
PurchLine.ItemId = 'B-R14';
PurchLine.createLine(true, true, true, true, true, false);
ttscommit;
purchFormLetter = purchFormLetter::construct(DocumentStatus::Invoice);
purchFormLetter.update(purchtable, // Purchase record Buffer
"Inv_"+purchTable.PurchId, // Invoice Number
systemdateget()); // Transaction date
if (PurchTable::find(purchTable.PurchId).DocumentStatus == DocumentStatus::Invoice)
{
info(strfmt("Posted invoiced journal for purchase order %1",purchTable.PurchId));
}
}
Change the documentstatus to packingSlip , if you want to post packing slip.
Following Job creates the Purchase order from code and post the invoice by making use of PurchFormLetter class.
If you don't have demo data , please test with your input values.
static void Dev_CreatePO_and_Invoice(Args _args)
{
NumberSeq numberSeq;
Purchtable Purchtable;
PurchLine PurchLine;
PurchFormLetter purchFormLetter;
;
ttsbegin;
numberSeq = NumberSeq::newGetNumFromCode(purchParameters::numRefPurchaseOrderId().NumberSequence,true);
// Initialize Purchase order values
Purchtable.initValue();
Purchtable.PurchId = numberSeq.num();
Purchtable.OrderAccount = '3000';
Purchtable.initFromVendTable();
if (!Purchtable.validateWrite())
{
throw Exception::Error;
}
Purchtable.insert();
// Initialize Purchase Line items
PurchLine.PurchId = Purchtable.PurchId;
PurchLine.ItemId = 'B-R14';
PurchLine.createLine(true, true, true, true, true, false);
ttscommit;
purchFormLetter = purchFormLetter::construct(DocumentStatus::Invoice);
purchFormLetter.update(purchtable, // Purchase record Buffer
"Inv_"+purchTable.PurchId, // Invoice Number
systemdateget()); // Transaction date
if (PurchTable::find(purchTable.PurchId).DocumentStatus == DocumentStatus::Invoice)
{
info(strfmt("Posted invoiced journal for purchase order %1",purchTable.PurchId));
}
}
Change the documentstatus to packingSlip , if you want to post packing slip.
Connecting MSSQL DataBase with X++ Code.
Connecting MSSQL DataBase with X++ Code.
As part of Customer requirements , sometimes we need to connect to DataBase otherthan Axapta DataBase. So let us explore how it can be done with X++ code.
In Ax using ODBCConnection and LoginProp its possible to connect to Database on remote server, as illustrated in the following example.I tried the following code on MSSQL Server.
static void test_ODBCConnection(Args _args)
{
LoginProperty loginProp;
ODBCConnection conn;
Resultset resultSet, resultSetCount; // get record
Statement statement1, statement2; // Create SQL Statement
ResultSetMetaData metaData ; // get Record metadate like columnname.
;
// Set Server Database
loginProp = new LoginProperty();
loginProp.setServer('SON15092');
loginProp.setDatabase('AdventureWorksDW');
// Create Connection and SQL Statement
conn = new ODBCConnection(loginProp);
statement1 = conn.createStatement();
resultSet = statement1.executeQuery("SELECT * from DimTime");
while (resultSet.next())
{
metaData = resultSet.getMetaData();
info("Column Name :"+metaData.getColumnName(1)+" Value ="+resultSet.getString(1));
}
}
As part of Customer requirements , sometimes we need to connect to DataBase otherthan Axapta DataBase. So let us explore how it can be done with X++ code.
In Ax using ODBCConnection and LoginProp its possible to connect to Database on remote server, as illustrated in the following example.I tried the following code on MSSQL Server.
static void test_ODBCConnection(Args _args)
{
LoginProperty loginProp;
ODBCConnection conn;
Resultset resultSet, resultSetCount; // get record
Statement statement1, statement2; // Create SQL Statement
ResultSetMetaData metaData ; // get Record metadate like columnname.
;
// Set Server Database
loginProp = new LoginProperty();
loginProp.setServer('SON15092');
loginProp.setDatabase('AdventureWorksDW');
// Create Connection and SQL Statement
conn = new ODBCConnection(loginProp);
statement1 = conn.createStatement();
resultSet = statement1.executeQuery("SELECT * from DimTime");
while (resultSet.next())
{
metaData = resultSet.getMetaData();
info("Column Name :"+metaData.getColumnName(1)+" Value ="+resultSet.getString(1));
}
}
File Operation using WinAPI in Dynamics Ax
File Operation using WinAPI in Dynamics Ax
Finding files with WinAPI
Axapta’s WinAPI class has a bunch of static methods to handle files. The code example below shows how to utilize some of these methods to find files.
The two methods used to fetch all files matching the search criteria are findFirstFile() and findNextFile(). Don’t forget to clean up after yourself with findClose().
The code also uses three different find methods:
*
fileExists(_name) returns true, if _name is an existing file
*
folderExists(_name) returns true, if _name is an existing file or folder
*
pathExists(_name) returns true, if _name is an existing folder
The example uses the infolog for output. As with any infolog beware of performance and limitation to 10.000 lines.
static void Test_WINAPI(Args _args)
{
#File
FileName fullFileName(FileName _path, FileName _fileName)
{
FileName pathName;
FileName fileName;
FileName fileExtension;
;
[pathName,fileName,fileExtension] = fileNameSplit(_fileName);
return _path + '\\' + fileName + fileExtension;
}
void findFiles(FileName _path,
FileName _fileName,
boolean _inclSubDir = true,
FileName _prefix = fullFileName(_path,_fileName))
{
FileName fileName;
int hdl;
;
setprefix(_prefix);
if (WinAPI::folderExists(_path))
{
[hdl,fileName] = WinApi::findFirstFile(fullFileName(_path,_fileName));
while (fileName)
{
if (WinAPI::fileExists(fullFileName(_path,fileName)))
info(fileName);
fileName = WinApi::findNextFile(hdl);
}
WinApi::findClose(hdl);
if (_inclSubDir)
{
[hdl, fileName] = WinAPI::findFirstFile(_path+'\\'+#AllFiles);
while (fileName)
{
if (strlwr(fileName) != strlwr(_fileName) &&
strlwr(fileName) != strlwr('.') &&
strlwr(fileName) != strlwr('..') &&
WinAPI::pathExists(fullFileName(_path,fileName)))
findFiles(fullFileName(_path,fileName), _fileName, _inclSubDir,
fileName);
fileName = WinApi::findNextFile(hdl);
}
WinApi::findClose(hdl);
}
}
}
findFiles('c:\\Program Files','*.doc');
}
Finding files with WinAPI
Axapta’s WinAPI class has a bunch of static methods to handle files. The code example below shows how to utilize some of these methods to find files.
The two methods used to fetch all files matching the search criteria are findFirstFile() and findNextFile(). Don’t forget to clean up after yourself with findClose().
The code also uses three different find methods:
*
fileExists(_name) returns true, if _name is an existing file
*
folderExists(_name) returns true, if _name is an existing file or folder
*
pathExists(_name) returns true, if _name is an existing folder
The example uses the infolog for output. As with any infolog beware of performance and limitation to 10.000 lines.
static void Test_WINAPI(Args _args)
{
#File
FileName fullFileName(FileName _path, FileName _fileName)
{
FileName pathName;
FileName fileName;
FileName fileExtension;
;
[pathName,fileName,fileExtension] = fileNameSplit(_fileName);
return _path + '\\' + fileName + fileExtension;
}
void findFiles(FileName _path,
FileName _fileName,
boolean _inclSubDir = true,
FileName _prefix = fullFileName(_path,_fileName))
{
FileName fileName;
int hdl;
;
setprefix(_prefix);
if (WinAPI::folderExists(_path))
{
[hdl,fileName] = WinApi::findFirstFile(fullFileName(_path,_fileName));
while (fileName)
{
if (WinAPI::fileExists(fullFileName(_path,fileName)))
info(fileName);
fileName = WinApi::findNextFile(hdl);
}
WinApi::findClose(hdl);
if (_inclSubDir)
{
[hdl, fileName] = WinAPI::findFirstFile(_path+'\\'+#AllFiles);
while (fileName)
{
if (strlwr(fileName) != strlwr(_fileName) &&
strlwr(fileName) != strlwr('.') &&
strlwr(fileName) != strlwr('..') &&
WinAPI::pathExists(fullFileName(_path,fileName)))
findFiles(fullFileName(_path,fileName), _fileName, _inclSubDir,
fileName);
fileName = WinApi::findNextFile(hdl);
}
WinApi::findClose(hdl);
}
}
}
findFiles('c:\\Program Files','*.doc');
}
X++ Code to find OnHand Stock for Item
X++ Code to find OnHand Stock for Item
In Dynamics Ax , use InventOnHand class for finding the stock of an item as shownbelow
static void findOnHand(Args _args)
{
InventDim inventDim;
InventDimParm inventDimParm;
Itemid itemid;
InventOnHand inventOnHand = new InventOnHand();
;
// take a sample item for testing
itemid = "20 MM RMC";
// take a combination of dimension , against which you want to find the stock
inventDim.InventLocationId = "GW";
//Set the flag for the selected dimensions as active.
inventDimParm.initFromInventDim(inventDim);
//initialize the inventonhand with item,dimension and dim paramter
inventOnHand.parmItemId(itemid);
inventOnHand.parmInventDim(inventDim);
inventOnHand.parmInventDimParm(inventDimParm);
// Retrieve the onhand info
info(strfmt("Available Physical: %1",
inventOnhand.availPhysical()));
info(strfmt("On order: %1",inventOnhand.onOrder()));
}
In Dynamics Ax , use InventOnHand class for finding the stock of an item as shownbelow
static void findOnHand(Args _args)
{
InventDim inventDim;
InventDimParm inventDimParm;
Itemid itemid;
InventOnHand inventOnHand = new InventOnHand();
;
// take a sample item for testing
itemid = "20 MM RMC";
// take a combination of dimension , against which you want to find the stock
inventDim.InventLocationId = "GW";
//Set the flag for the selected dimensions as active.
inventDimParm.initFromInventDim(inventDim);
//initialize the inventonhand with item,dimension and dim paramter
inventOnHand.parmItemId(itemid);
inventOnHand.parmInventDim(inventDim);
inventOnHand.parmInventDimParm(inventDimParm);
// Retrieve the onhand info
info(strfmt("Available Physical: %1",
inventOnhand.availPhysical()));
info(strfmt("On order: %1",inventOnhand.onOrder()));
}
X++ code to find the Stock of Item by Date
X++ code to find the Stock of Item by Date
static void findOnHand_ByDate(Args _args)
{
InventDim inventDim;
InventDimParm inventDimParm;
Itemid itemid;
InventOnHand inventOnHand = new InventOnHand();
InventSumDateDim inventSumDateDim;
TransDate transDate;
;
// take a sample item for testing
itemid = "20 MM RMC";
transDate = 13\01\2010;
// take a combination of dimension , against which you want to find the stock
inventDim.InventLocationId = "GW";
//Set the flag for the selected dimensions as active.
inventDimParm.initFromInventDim(inventDim);
//initialize the inventSumDateDim with Date,item,dimension and dim paramter
inventSumDateDim = InventSumDateDim::newParameters(transDate,
itemid,
inventDim,
inventDimParm);
// Retrieve the onhand info
info(strfmt("PostedQty: %1",inventSumDateDim.postedQty()));
info(strfmt("DeductedQty: %1",inventSumDateDim.deductedQty()));
info(strfmt("ReceivedQty: %1",inventSumDateDim.receivedQty()));
}
static void findOnHand_ByDate(Args _args)
{
InventDim inventDim;
InventDimParm inventDimParm;
Itemid itemid;
InventOnHand inventOnHand = new InventOnHand();
InventSumDateDim inventSumDateDim;
TransDate transDate;
;
// take a sample item for testing
itemid = "20 MM RMC";
transDate = 13\01\2010;
// take a combination of dimension , against which you want to find the stock
inventDim.InventLocationId = "GW";
//Set the flag for the selected dimensions as active.
inventDimParm.initFromInventDim(inventDim);
//initialize the inventSumDateDim with Date,item,dimension and dim paramter
inventSumDateDim = InventSumDateDim::newParameters(transDate,
itemid,
inventDim,
inventDimParm);
// Retrieve the onhand info
info(strfmt("PostedQty: %1",inventSumDateDim.postedQty()));
info(strfmt("DeductedQty: %1",inventSumDateDim.deductedQty()));
info(strfmt("ReceivedQty: %1",inventSumDateDim.receivedQty()));
}
X++ code to create a customized lookup on form
X++ code to create a customized lookup on form
Override the lookup method on Formdatasource field(on which you want to show lookup) , and copy the following code to your method.
Comment the super() method in the lookup.
public void lookup(FormControl _formControl, str _filterStr)
{
SysTableLookup sysTableLookup; // systemclass to create //customlookup
Query query;
QueryBuildDataSource qbd;
;
sysTableLookup = SysTableLookup::newParameters(
tablenum(InventTable),
_formcontrol);
// Construct query on the table,
// whose records you want to show as lookup.
query = new Query();
qbd = query.addDataSource(tablenum(InventTable));
qbd.addRange(fieldnum(InventTable,ItemType)).value(SysQuery::value(enum2str
(ItemType::Item)));
// add the fields to the lookup list
sysTableLookup.addLookupfield(fieldnum(InventTable,ItemId));
sysTableLookup.addLookupfield(fieldnum(InventTable,ItemName));
// pass the query as parameter
// system will show the records in the lookup
// as per your query
sysTableLookup.parmQuery(query);
sysTableLookup.performFormLookup();
}
Override the lookup method on Formdatasource field(on which you want to show lookup) , and copy the following code to your method.
Comment the super() method in the lookup.
public void lookup(FormControl _formControl, str _filterStr)
{
SysTableLookup sysTableLookup; // systemclass to create //customlookup
Query query;
QueryBuildDataSource qbd;
;
sysTableLookup = SysTableLookup::newParameters(
tablenum(InventTable),
_formcontrol);
// Construct query on the table,
// whose records you want to show as lookup.
query = new Query();
qbd = query.addDataSource(tablenum(InventTable));
qbd.addRange(fieldnum(InventTable,ItemType)).value(SysQuery::value(enum2str
(ItemType::Item)));
// add the fields to the lookup list
sysTableLookup.addLookupfield(fieldnum(InventTable,ItemId));
sysTableLookup.addLookupfield(fieldnum(InventTable,ItemName));
// pass the query as parameter
// system will show the records in the lookup
// as per your query
sysTableLookup.parmQuery(query);
sysTableLookup.performFormLookup();
}
X++ code to create and post Inventory Movement Journal
X++ code to create and post Inventory Movement Journal
Following is the sample job to show how we can create and post movement journal by making use of available api's in the Dynamics Ax.
static void createMovJournal(Args _args)
{ InventJournalTable journalTable;
InventJournalTrans journalTrans;
InventJournalTableData journalTableData;
InventJournalTransData journalTransData;
InventTable inventTable;
InventDim inventDim;
Counter cnt;
InventJournalCheckPost journalCheckPost = new InventJournalCheckPost();
;
journalTableData = JournalTableData::newTable(journalTable);
journalTransData = journalTableData.journalStatic().newJournalTransData(journalTrans,journalTableData);
// Init JournalTable
journalTable.clear();
journalTable.JournalId = journalTableData.nextJournalId();
journalTable.JournalType = InventJournalType::Movement;
journalTable.JournalNameId = journalTableData.journalStatic().standardJournalNameId(journalTable.JournalType);
journalTableData.initFromJournalName(journalTableData.journalStatic().findJournalName(journalTable.JournalNameId));
// Init JournalTrans
select firstonly inventTable;
for(cnt=1;cnt<10;cnt++)
{
journalTrans.clear();
journalTransData.initFromJournalTable();
journalTrans.TransDate = systemdateget() + 1 div 2;
journalTrans.ItemId = inventTable.ItemId;
journalTrans.Qty = 100;
journalTrans.CostAmount = 100;
// Dimension details
inventDim.InventLocationId = 'GW';
journalTrans.InventDimId = InventDim::findOrCreate(inventDim).inventDimId;
journalTransData.create();
}
journalTable.insert();
// Call the static method to post the journal
if(InventJournalCheckPost::newPostJournal(journalTable).validate())
InventJournalCheckPost::newPostJournal(journalTable).run();
}
Following is the sample job to show how we can create and post movement journal by making use of available api's in the Dynamics Ax.
static void createMovJournal(Args _args)
{ InventJournalTable journalTable;
InventJournalTrans journalTrans;
InventJournalTableData journalTableData;
InventJournalTransData journalTransData;
InventTable inventTable;
InventDim inventDim;
Counter cnt;
InventJournalCheckPost journalCheckPost = new InventJournalCheckPost();
;
journalTableData = JournalTableData::newTable(journalTable);
journalTransData = journalTableData.journalStatic().newJournalTransData(journalTrans,journalTableData);
// Init JournalTable
journalTable.clear();
journalTable.JournalId = journalTableData.nextJournalId();
journalTable.JournalType = InventJournalType::Movement;
journalTable.JournalNameId = journalTableData.journalStatic().standardJournalNameId(journalTable.JournalType);
journalTableData.initFromJournalName(journalTableData.journalStatic().findJournalName(journalTable.JournalNameId));
// Init JournalTrans
select firstonly inventTable;
for(cnt=1;cnt<10;cnt++)
{
journalTrans.clear();
journalTransData.initFromJournalTable();
journalTrans.TransDate = systemdateget() + 1 div 2;
journalTrans.ItemId = inventTable.ItemId;
journalTrans.Qty = 100;
journalTrans.CostAmount = 100;
// Dimension details
inventDim.InventLocationId = 'GW';
journalTrans.InventDimId = InventDim::findOrCreate(inventDim).inventDimId;
journalTransData.create();
}
journalTable.insert();
// Call the static method to post the journal
if(InventJournalCheckPost::newPostJournal(journalTable).validate())
InventJournalCheckPost::newPostJournal(journalTable).run();
}
X++ code to Read/Write Dynamics Ax data to excel
X++ code to Read/Write Dynamics Ax data to excel
Writing Data to Excel file
How it works
1. Use SysExcelApplication class to create excel file.
2. Use SysExcelWorkbooks and SysExcelWorkbook to create a blank workbook(by
default 3 worksheets will be available).
3. Use SysExcelWorkSheets to select worksheet for writing data.
4. SysExcelCells to select the cells in the excel for writing the data.
5. SysExcelCell to write the data in the selected cells.
6. Once you done with write operation use SysExcelApplication.visible to open
file.
static void Write2ExcelFile(Args _args)
{
InventTable inventTable;
SysExcelApplication application;
SysExcelWorkbooks workbooks;
SysExcelWorkbook workbook;
SysExcelWorksheets worksheets;
SysExcelWorksheet worksheet;
SysExcelCells cells;
SysExcelCell cell;
int row;
;
application = SysExcelApplication::construct();
workbooks = application.workbooks();
workbook = workbooks.add();
worksheets = workbook.worksheets();
worksheet = worksheets.itemFromNum(1);
cells = worksheet.cells();
cells.range('A:A').numberFormat('@');
cell = cells.item(1,1);
cell.value("Item");
cell = cells.item(1,2);
cell.value("Name");
row = 1;
while select inventTable
{
row++;
cell = cells.item(row, 1);
cell.value(inventTable.ItemId);
cell = cells.item(row, 2);
cell.value(inventTable.ItemName);
}
application.visible(true);
}
Reading Data from Excel File
static void ReadExcel(Args _args)
{
SysExcelApplication application;
SysExcelWorkbooks workbooks;
SysExcelWorkbook workbook;
SysExcelWorksheets worksheets;
SysExcelWorksheet worksheet;
SysExcelCells cells;
COMVariantType type;
int row;
ItemId itemid;
Name name;
FileName filename;
;
application = SysExcelApplication::construct();
workbooks = application.workbooks();
//specify the file path that you want to read
filename = "C:\\item.xls";
try
{
workbooks.open(filename);
}
catch (Exception::Error)
{
throw error("File cannot be opened.");
}
workbook = workbooks.item(1);
worksheets = workbook.worksheets();
worksheet = worksheets.itemFromNum(1);
cells = worksheet.cells();
do
{
row++;
itemId = cells.item(row, 1).value().bStr();
name = cells.item(row, 2).value().bStr();
info(strfmt('%1 - %2', itemId, name));
type = cells.item(row+1, 1).value().variantType();
}
while (type != COMVariantType::VT_EMPTY);
application.quit();
}
Writing Data to Excel file
How it works
1. Use SysExcelApplication class to create excel file.
2. Use SysExcelWorkbooks and SysExcelWorkbook to create a blank workbook(by
default 3 worksheets will be available).
3. Use SysExcelWorkSheets to select worksheet for writing data.
4. SysExcelCells to select the cells in the excel for writing the data.
5. SysExcelCell to write the data in the selected cells.
6. Once you done with write operation use SysExcelApplication.visible to open
file.
static void Write2ExcelFile(Args _args)
{
InventTable inventTable;
SysExcelApplication application;
SysExcelWorkbooks workbooks;
SysExcelWorkbook workbook;
SysExcelWorksheets worksheets;
SysExcelWorksheet worksheet;
SysExcelCells cells;
SysExcelCell cell;
int row;
;
application = SysExcelApplication::construct();
workbooks = application.workbooks();
workbook = workbooks.add();
worksheets = workbook.worksheets();
worksheet = worksheets.itemFromNum(1);
cells = worksheet.cells();
cells.range('A:A').numberFormat('@');
cell = cells.item(1,1);
cell.value("Item");
cell = cells.item(1,2);
cell.value("Name");
row = 1;
while select inventTable
{
row++;
cell = cells.item(row, 1);
cell.value(inventTable.ItemId);
cell = cells.item(row, 2);
cell.value(inventTable.ItemName);
}
application.visible(true);
}
Reading Data from Excel File
static void ReadExcel(Args _args)
{
SysExcelApplication application;
SysExcelWorkbooks workbooks;
SysExcelWorkbook workbook;
SysExcelWorksheets worksheets;
SysExcelWorksheet worksheet;
SysExcelCells cells;
COMVariantType type;
int row;
ItemId itemid;
Name name;
FileName filename;
;
application = SysExcelApplication::construct();
workbooks = application.workbooks();
//specify the file path that you want to read
filename = "C:\\item.xls";
try
{
workbooks.open(filename);
}
catch (Exception::Error)
{
throw error("File cannot be opened.");
}
workbook = workbooks.item(1);
worksheets = workbook.worksheets();
worksheet = worksheets.itemFromNum(1);
cells = worksheet.cells();
do
{
row++;
itemId = cells.item(row, 1).value().bStr();
name = cells.item(row, 2).value().bStr();
info(strfmt('%1 - %2', itemId, name));
type = cells.item(row+1, 1).value().variantType();
}
while (type != COMVariantType::VT_EMPTY);
application.quit();
}
X++ code to write data to XML File
X++ code to write data to XML File
static void CreateXml(Args _args)
{
XmlDocument xmlDoc; //to create blank XMLDocument
XmlElement xmlRoot; // XML root node
XmlElement xmlField;
XmlElement xmlRecord;
XMLWriter xmlWriter;
InventTable inventTable;
DictTable dTable = new DictTable(tablenum(InventTable));
DictField dField;
int i, fieldId;
str value;
#InventTags
;
xmlDoc = XmlDocument::newBlank();
xmlRoot = xmlDoc.createElement(#ItemRootNode);
// Loop through all the records in the inventTable
while select inventTable
where inventTable.ItemGroupId == "Parts"
{
// Create a XmlElement (record) to hold the
// contents of the current record.
xmlRecord = xmlDoc.createElement(#ItemRecords);
// Loop through all the fields in the record
for (i=1; i<=dTable.fieldCnt(); i++)
{
fieldId = dTable.fieldCnt2Id(i);
// Find the DictField object that matches
// the fieldId
dField = dTable.fieldObject(fieldId);
// Skip system fields
if (dField.isSystem())
continue;
// Create a new XmlElement (field) and
// have the name equal to the name of the
// dictField
xmlField = xmlDoc.createElement(dField.name());
// Convert values to string. I have just added
// a couple of conversion as an example.
// Use tableName.(fieldId) instead of fieldname
// to get the content of the field.
switch (dField.baseType())
{
case Types::Int64 :
value = int642str(inventTable.(fieldId));
break;
case Types::Integer :
value = int2str(inventTable.(fieldId));
break;
default :
value = inventTable.(fieldId);
break;
}
// Set the innerText of the XmlElement (field)
// to the value from the table
xmlField.innerText(value);
// Append the field as a child node to the record
xmlRecord.appendChild(xmlField);
}
// Add the record as a child node to the root
xmlRoot.appendChild(xmlRecord);
}
// Add the root to the XmlDocument
xmlDoc.appendChild(xmlRoot);
// Create a new object of the XmlWriter class
// in order to be able to write the xml to a file
xmlWriter = XMLWriter::newFile(@"c:\Items.xml");
// Write the content of the XmlDocument to the
// file as specified by the XmlWriter
xmlDoc.writeTo(xmlWriter);
//Open the file in Internet Explorer
WINAPI::shellExecute("c:\Items.xml");
}
static void CreateXml(Args _args)
{
XmlDocument xmlDoc; //to create blank XMLDocument
XmlElement xmlRoot; // XML root node
XmlElement xmlField;
XmlElement xmlRecord;
XMLWriter xmlWriter;
InventTable inventTable;
DictTable dTable = new DictTable(tablenum(InventTable));
DictField dField;
int i, fieldId;
str value;
#InventTags
;
xmlDoc = XmlDocument::newBlank();
xmlRoot = xmlDoc.createElement(#ItemRootNode);
// Loop through all the records in the inventTable
while select inventTable
where inventTable.ItemGroupId == "Parts"
{
// Create a XmlElement (record) to hold the
// contents of the current record.
xmlRecord = xmlDoc.createElement(#ItemRecords);
// Loop through all the fields in the record
for (i=1; i<=dTable.fieldCnt(); i++)
{
fieldId = dTable.fieldCnt2Id(i);
// Find the DictField object that matches
// the fieldId
dField = dTable.fieldObject(fieldId);
// Skip system fields
if (dField.isSystem())
continue;
// Create a new XmlElement (field) and
// have the name equal to the name of the
// dictField
xmlField = xmlDoc.createElement(dField.name());
// Convert values to string. I have just added
// a couple of conversion as an example.
// Use tableName.(fieldId) instead of fieldname
// to get the content of the field.
switch (dField.baseType())
{
case Types::Int64 :
value = int642str(inventTable.(fieldId));
break;
case Types::Integer :
value = int2str(inventTable.(fieldId));
break;
default :
value = inventTable.(fieldId);
break;
}
// Set the innerText of the XmlElement (field)
// to the value from the table
xmlField.innerText(value);
// Append the field as a child node to the record
xmlRecord.appendChild(xmlField);
}
// Add the record as a child node to the root
xmlRoot.appendChild(xmlRecord);
}
// Add the root to the XmlDocument
xmlDoc.appendChild(xmlRoot);
// Create a new object of the XmlWriter class
// in order to be able to write the xml to a file
xmlWriter = XMLWriter::newFile(@"c:\Items.xml");
// Write the content of the XmlDocument to the
// file as specified by the XmlWriter
xmlDoc.writeTo(xmlWriter);
//Open the file in Internet Explorer
WINAPI::shellExecute("c:\Items.xml");
}
Dynamics Ax Systemclass for RECID
Dynamics Ax Systemclass for RECID
As you all know that Dynamics Ax uses recid(Record Id)to uniquelly identify a record in the database.
Advantage of RecId
1.By default system uses Recid as primary index,so if query optimizer didn't find any index to use then it will use RecId.
Dyamics Ax uses SystemSequence class(AOT->SystemDocumentation->Classes) to generate recId for table.
Using SystemSequence class you can reserve RECID's for your table.
Ax Kernel uses SystemSequences Table to generate the Recid for table as shown below
Goto AOT->SystemDocumentation->Tables->SystemSequences ,
As you all know that Dynamics Ax uses recid(Record Id)to uniquelly identify a record in the database.
Advantage of RecId
1.By default system uses Recid as primary index,so if query optimizer didn't find any index to use then it will use RecId.
Dyamics Ax uses SystemSequence class(AOT->SystemDocumentation->Classes) to generate recId for table.
Using SystemSequence class you can reserve RECID's for your table.
Ax Kernel uses SystemSequences Table to generate the Recid for table as shown below
Goto AOT->SystemDocumentation->Tables->SystemSequences ,
Security Keys in Ax
Security Keys in Ax
Dynamics Ax provides following keys to provide the security for application
1.License Keys :
First Level Security , specifies what all featues/modules/developemnt tools we can access in the standard product.License Keys will be used after installation to unlock the product.License Keys will be issued by the microsoft for partners/vendors to develop vertical/generic solutions.
2.Configuration Keys :
Second Level Security , To Enable/Disable the object/feature for all the users.
3.Security Keys :
If you want to enable/disable object/features to group of users.
4. Record Level security :
Basically it deals with the data , if you want to restrict the viewing of records per user group than we setup record level security.
Dynamics Ax provides following keys to provide the security for application
1.License Keys :
First Level Security , specifies what all featues/modules/developemnt tools we can access in the standard product.License Keys will be used after installation to unlock the product.License Keys will be issued by the microsoft for partners/vendors to develop vertical/generic solutions.
2.Configuration Keys :
Second Level Security , To Enable/Disable the object/feature for all the users.
3.Security Keys :
If you want to enable/disable object/features to group of users.
4. Record Level security :
Basically it deals with the data , if you want to restrict the viewing of records per user group than we setup record level security.
Subscribe to:
Posts (Atom)