Professional Documents
Culture Documents
ReplacementKey
This key is used to define the replacement fields to display in your design when you referred to
some relation using the Recid.
ex:-
Table B is referring to Table A where the TableB have the Refrecid from Table A, but when you open the
form for TableB We cant show the Recid of the TableA in the Presentation,So whatever the field that you
want to display, you will define one index on TableA with the fields that you want to show and and index
alternateKey property to Yes. define the Replacement key property for the table A as this index.
If a ReplacementKey is chosen, its fields can appear on forms to helpfully identify each record.
The ReplacementKey should be a set of fields that represent the natural key.
Q.6) What are the relations available in AX 2012? Differentiate each of them?
Ans) Define conditional table relations to filter the records in either the primary or the related table.
Following are the conditional table relations that can be specified when you define the fields in a table
relation:
• Field fixed
• Related field fixed
Relation
Format Description
Type
Field fixed Field fixed Restricts the records selected in the primary table.
(Table.Field == Only records that meet the condition are selected.
<EnumValue>) The condition is ANDed with your relation.
Related field Related field fixed Restricts the records selected in the related table.
fixed (<EnumValue> == Only records that meet the condition are selected.
Table.Field) The condition is ANDed with your relation.
1. For Normal, enter the following in the Field Relation property pages:
· In the Field property, select the field in the primary table that relates to a field in the related table.
· In the Related Field property, select the field in the related table.
2. For Field Fixed, enter the following in the Field Relation property pages:
· In the Field property, select the field in the primary table to use to restrict the records.
· In the Value property, enter the value of the selected field as the filter. This relates only records in the
primary table that match that field value. Only numeric values can be entered in the Valueproperty. Field
fixed relations can be created only on numeric fields.
Each of the related fields are ANDed in the table relation.
3. For Related Field Fixed, enter the following in the Field Relation property pages:
· In the Value property, enter the filter value of the selected field. This causes only records in the related
table that match that field value to be related. Only numeric values can be entered in the Valueproperty.
Related field fixed relations can be created only on numeric fields.
· In the Field property, select the field in the related table to restrict the records.
Q.7) What are the Delete actions available in AX 2012? Explain them?
Ans) Delete actions on a table are used for two purposes
• Restrict the deletion of a record based on related records in another table
• Cascade the deletion of a record to related tables to ensure data-consistency
There are four different types of delete actions
• None
• Cascade
• Restricted
• Cascade+Restricted
None
A None deletion action will delete selected row in the table but nothing occurs to the table that relate to
this table.
Cascade
A cascading deletion action will delete all records in the related table, where the foreign key is equivalent
to the primary key of the current table. That is, deleting the ''parent'' record will also delete the ''child''
record(s) in the related table.
This cascading will take place whether the deletion is performed in code or directly by a user through the
user interface.
Restricted
A restricting delete action will raise an error message if the user tries to delete a record, where records
exist in the related table where the foreign key is equivalent to the primary key of the current table.
This error will only appear if the deletion is performed through the user interface. A deletion from X++
code will be allowed to proceed and will '''not''' be cascaded to the related table. In this case the
programmer should call .validateDelete() themselves prior to the call to .delete()
Cascade+Restricted
The delete action performs an restricted, if the record of the table will be deleted directly and performs an
cascade, if the record of the table will be deleted through a cascade delete action of a other table.
e.g.:
tableA (Customer) (a cascade deleteaction to tableB)
tableB (SalesOrder) (a cascade+restricted deleteaction to tableC)
tableC (SalesLine)
When a record of tableB will be deleted, the restricted part of the deleteaction will be performed. The
record of tableB can only be deleted, if no record in tableC exist for the record in tableB. (The SalesOrder
can only be deleted, if no SalesLine exist for the SalesOrder).
A record in tableA will be deleted, so the cascade deleteaction to tableB will be performed. In this case,
the cascade part of the deleteaction to tableC will be performed. (When a Customer will be deleted, the
SalesOrders and SalesLines will also be deleted)
So, the performing action of a cascade+restriced deleteaction depends on the kind of deletion of the
record. (direct:restricted, cascading:cascade)
Restricted Vs Cascade + Restricted Example:
Suppose we have 3 table , table1 , table2 , table3
Scenario 1 :
Table1 is having a restricted delete actions with table2 and table3 is having a cascadedelete action with
table1.
Now if we try to delete the record in table3 , and if record exists in table2 , we will get error
“The record may not be deleted. Transactions exist in table ‘Table2′.”
Scenario 2:
Table1 is having a cascade + restricted delete actions with table2 and table3 is having a cascade delete
action with table1.
Now if we try to delete the record in table3 , and if record exists in table2, records will be deleted from
table 3 , table 1 and table 2 as well.
One more thing , if you will try to delete the data from table1 and record exist in table2 , you cannot
delete the data in table1 (now cascade + restricted will behave like restricted)
Scenario 3:
we have three tables Person ,Customer & Order
Now Person is a parent of Customer table, and Customer is a parent of Order table having (One-To-
Many) relations.
If I set a Delete action property on Person table to “CASCADE” for customer table and If I set a Delete
Action property on a CUSTOMER table for Order table to “CASCADE +RESTRICTED”.
So if I delete a record from Customer table then It will first check the record in the child table(order table)
and if exist that warning prompt saying that first we need to delete a record from child table.
But if I delete a record from Person table it will automatically delete a record in Customer table and all
records related to customer table in Order table would also be deleted.
The Cascade+Restricted delete action is used in the standard application for LedgerJournalTrans on
LedgerJournalTable.
This type of delete action is useful when you prefer a total clean-up—when you delete a customer, you
also delete all the transactions associated with that customer.
Parameter:
The table contains data primarily used as parameters or setup information for one of the main tables (a
table that has aTableGroup property of Main).
The table typically contains only one record per company.
Ex: CustParameter, VendParameter
Group:
The table contains data primarily used to categorize one of the main tables (a table that has
a TableGroup property ofMain).
There is a one-to-many relationship between a Group table and a Main table.
Ex: CustGroup, VendGroup
Main:
The table is one of the principal tables in the application and contains data for a central business object.
The table typically holds static, base information.
There is a one-to-many relationship between a Main table and a Transaction table.
Ex: CustTable VendTable
Transaction:
The table contains transaction data. The table is typically not used for data entry directly.
Ex: CustTrans, VendTrans
WorkSheetHeader:
The table typically categorizes information in the WorkSheetLine tables.
There is a one-to-many relationship between a WorkSheetHeader table and a WorkSheetLine table.
Ex: SalesTable
WorkSheetLine :
The table contains information to be validated and made into transactions.
In comparison to the data contained in a Transaction table, the data in WorkSheetLine tables is temporary
and may be deleted without affecting system stability.
Ex: SalesLine
Miscellaneous:
The table does not fit in any of the other categories. This is the default value for a new table.
Ex: TableExpImpDef
Q.12) What is the difference between Transaction Table and Worksheet Line?
Ans) The table contains transaction data. The table is typically not used for data entry directly.
Ex: CustTrans, VendTrans
6.Now we have to check the number sequence is correctly working for that write a job:
Run the above job.We will find the generated Number sequence. .
super(append);
if (!extern)
{
element.numberSeqFormHandler().formMethodDataSourceCreate(true);
}
}
Delete()
public void delete()
{
element.numberSeqFormHandler().formMethodDataSourceDelete();
super();
}
Write()
public void write()
{
super();
element.numberSeqFormHandler().formMethodDataSourceWrite();
}
Validate Write()
public boolean validateWrite()
{
boolean ret;
ret = super();
ret = element.numberSeqFormHandler().formMethodDataSourceValidateWrite(ret) && ret;
if (ret)
{
CarTable.validateWrite();
}
return ret;
}
Link Active()
public void linkActive()
{
;
element.numberSeqFormHandler().formMethodDataSourceLinkActive();
super();
}
Now our numberseqence is generated .
*** Set the field or Tabpage Allowedit property to No.
***Check the continues on wizard.
• Dynamic Query
Q.16) What are the main classes that should be called while creating an X++ Query?
Ans) There different classes called while creating the dynamic query are
Query, QueryRun, QueryBuildDataSource, QueryBuildRange, QueryBuildLink
Note
Views are read-only. The data fields and tables that a view uses cannot be updated from that view.
Views are synchronized like tables. When you synchronize a view, the view definition is saved to the
database. Synchronization of an existing view causes the definition of that view to be dropped and re-
created in the database.
To use X++ code to retrieve cross-company data from a view, you have to use
the crossCompany keyword in the X++ select statement. For more information about how to retrieve
cross-company data that uses a view, seeCross-Company Queries for Views.
View Elements
Views are located in the Application Object Tree (AOT) under the Data Dictionary\Views node. A view
contains four primary nodes:
• Metadata
• Fields
• Field Groups
• Methods
Metadata
The Metadata node contains the query or data source that the view uses to retrieve data. A metadata
query or data source is referred to as the view query. For more information about how to use a query or
data source, see the View Query section later in this document.
Fields
The Fields node specifies the data fields that the view returns. For example, the data source for the view
namedLedgerCustPaymProposal retrieves many fields from the table named LedgerJournalTrans.
However, the view returns a small subset of the available fields. For more information about how to add
fields to a view, see How to: Create a View Based on a Query.
A view can return aggregate fields that use the functions SUM, MIN, MAX, AVG, and COUNT. Field
aggregation is specified in the Aggregation property of the field. In Microsoft Dynamics AX, views support
only field-level aggregation.
Note
To use the aggregation functions of COUNT, AVG, or SUM, the data field must be a data type
of Integer or Real. If you try to use one of these aggregation functions on a field of any other data
type, you will receive an error.
Field Groups
The Field Groups node contains the field groups for a view. A field group enables you to associates fields
that logically belong together into named groups. Field groups in views work just like they do in tables.
However, you can only add fields to a field group if those fields are returned by the view (each field must
be located in the Fields node of that view). For more information about field groups, see Best Practices for
Field Groups, Defining Field Groups, and How to: Create a Field Group.
Methods
The Methods node displays all the methods available from a view. Use this node to add a new method or
override methods on the xRecord kernel class. Methods enable you to add code that customizes a view.
I have created a Form using the above two tables. This form demonstrates the effects of joining two
datasources in a form.
Setting the property JoinSource and LinkType in form JoinDetail DataSources level
InnerJoin: Retrieves a record from the main table that matches records in the joined table and vice versa.
There is one record for each match. Records without related records in the other data source are
eliminated from the result.
OuterJoin: Retrieves records from the main table whether they have matching records in the joined table.
ExistJoin: Retrieves a record from the main table for each matching record in the joined table.
The differences between InnerJoin and ExistJoin are as follows:
• When the join type is ExistJoin, the search ends after the first match has been found.
• When the join type is InnerJoin, all matching records are searched for.
NotExistJoin: Select records from the main table that do not have a match in the joined table.
Active: The data source is updated immediately when a new record in the parent data source is selected.
Continuous updates consume lots of resources.
Passive: Linked child data sources are not updated automatically. Updates of the child data source must
be programmed on the active method of the master data source.
Delayed: A pause is inserted before linked child data sources are updated. This enables faster navigation
in the parent data source because the records from child data sources are not updated immediately.
For example, you can scroll a list of orders where you do not want to review the lines associated with the
order until you stop scrolling.
Ans) An Abstract Class does not have implementation, i.e., there is no body in a method. And we cannot
modify an abstract class directly, we have to inherit it and write the implementation in the extended class.
Q.41) What is the calling class while posting invoices from Accounts Payable and Accounts
Receivable?
Ans) Accounts Receivable Accounts Payable
SalesFormLetter PurchFormLetter
SalesFormLetter_Invoice PurchFormLetter_Invoice
Q.49) Do you know how to setup a new dimension in AX 2012? If “Yes” explain in brief?
Ans) To setup financial dimensions. Go to General Ledger Module > Setup > Financial Dimensions >
Financial Dimensions
Q.51) What is the methodology that you followed while implementing module?
Q.57) What are the classes that are useful for creating SSRS Reports?
Ans) Different classes used for creating SSRS Reports are RDP class, Contract Class, Controller Class, UI
Builder Class.
Q.60) How many temporary tables can be used for creating reports?
Ans) We can use any number of temporary tables in a report.
Q.61) What is the main method that fills data for report?
Ans) ProcessReprot() is the main method that fill the data.
Q.62) On the report header section, there are two combo boxes, 2 nd combo box values to be filled
according to the modified 1st combo box’s value, and based on the 2nd combo box’s selected values
need to generate the report. Where to write the logic for the combo boxes?
Ans) In a controller class, we have several methods, we can write the code in a build method of a
controller class.
One can also deploy the report in the Visual studio, In the solution explorer > right click the report and
deploy the report, then add the report to the AOT
Q.67) Explain about the MenuItem properties to be set for a SSRS Report created from Classes?
Array: Similar to the X++ language array type except that it can hold values of any single type, including
objects and records. Objects are accessed in a specific order.
http://msdn.microsoft.com/EN-US/library/array.aspx
http://msdn.microsoft.com/EN-US/library/list.aspx
Map: The Map class allows you to associate one value (the key) with another value.
Both the key and value can be any valid X++ type, including objects.
The types of the key and the value are specified in the declaration of the map.
The way in which maps are implemented means that access to the values is very fast.
http://msdn.microsoft.com/EN-US/library/map.aspx
Struct: A struct holds several values of any X++ type, to group the information about a specific entity.
http://msdn.microsoft.com/EN-US/library/struct.aspx
Set: The Set class is used for the storage and retrieval of data from a collection in which the values of the
elements contained are unique and serve as the key values according to which the data is automatically
ordered.
http://msdn.microsoft.com/EN-US/library/set.aspx
http://blogs.msdn.com/b/x/archive/2011/09/07/changes-to-the-collection-classes-in-dynamics-ax-
2012.aspx
Ans) Set is faster when compared to other collection classes because, it has unique values, it cannot store
duplicate values, which makes it faster to use as a key in fetching or retrieving.
Ans) Enumerator is used for traversing through the collection class to fetch the element in the collection
class, both enumerator and iterator does the same.
Q.76) Different Tables, Classes involved in Creating, Posting Sales Order and Purchase Order?
Ans) SalesTableType and SaleslineType classes will get called while creating the Sales Orders.
SalesFormLetter_Confirm
SalesFormLetter_Invoice
SalesFormLetter_PackingSlip
SalesFormLetter_PickingLlst
classes will be used to post the sales order at various document status (packing, invoice etc).
Tables:
SalesTable contains all Sales Order headers regardless whether they have been posted or not.
The SalesParmTable and SalesParmLine contain detailed information regarding posting sales headers
and Lines.
CustConfirmJour and CustConfirmTrans tables contain all Sales Confirmation headers and Lines
posted in Dynamic Ax originating from Sales Orders and Lines.
CustPackingSlipJour and CustPackingSlipTrans tables contain all sales Packing Slip headers and Lines
posted in Dynamic Ax originating from Sales Orders and Lines.
CustInvoiceJour and CustInvoiceTrans tables contain all sales all Sales Invoice headers and Lines posted
in Dynamic Ax originating from Sales Orders and Lines.
Regular: The default value. These are permanent Tables.These tables are used for storing data
permanently in database.
InMemory: These temporary tables are hosted in the client, the data will wipe out as soon as instance of
the form or report is closed.
Joins and other Set operations with InMemory tables are usefull inefficient.
These tables are same thing as what was previously called a temporary table in ax 2009.
An InMemory table is held in memory until its size reaches 128 KB. The dataset is then written to a disk file
on the server tier.
The disk file for an InMemory table has the naming convention $tmp<nnnnnnnn>.$$$.
http://msdn.microsoft.com/EN-US/library/bb314749.aspx
TempDB: This is the new type of temporary table that is hosted in the sql server database.
These temporary tables can be joined in the database with regular tables.
Joins and other Set operations on TempDB tables are can be efficient.This was the joining problem we
have InMemory Tables.
http://msdn.microsoft.com/EN-US/library/gg845661.aspx
• An index is of no benefit if you are working with only a few records. In such cases a container might
involve less overhead and perform faster than an InMemory table.
Another important difference between InMemory tables and containers is how they are used in method
calls.
When you pass an InMemory table into a method call, it is passed by reference.
Containers are passed by value.
When a variable is passed by reference, only a pointer to the object is passed into the method.
When a variable is passed by value, a new copy of the variable is passed into the method. If the computer
has a limited amount of memory, it might start swapping memory to disk, slowing down application
execution. When you pass a variable into a method, an InMemory table may provide better performance
than a container.
Q.80) What are the different Set Based Operations used in Ax?
Ans) insert_recordset:
insert_recordset is a record set-based operator, which performs operations on multiple records at a time.
However, it can fall back to record-by-record operations in many situations.
insert_recordset copies data from one or more tables directly into one resulting destination table on a
single server trip.
Using insert_recordset is faster than using an array insert. However, array inserts are more flexible if you
want to handle the data before you insert it.
Example:
update_recordset resembles delete_from in X++ and to UPDATE SET in SQL. It works on the database
server-side on an SQL-style record set, instead of retrieving each record separately by fetching, changing,
and updating.
AOT-->Tables-->SlaesTable-->Methods-->updateDeadlineOnline()
delete_from:
You can delete multiple records from a database table by using a delete_from statement.
This can be more efficient and faster than deleting one record at a time by using
the xRecord.delete method in a loop.
If you have overridden the delete method, the system interprets the delete_from statement into code
that calls the delete method one time for each row that is deleted.
AOT-->Tables-->SlaesTable-->Methods-->deleteAllLines
public static void deleteAllLines(SalesId _salesId)
{
SalesLine salesLine;
ttsbegin;
delete_from salesLine where salesLine.SalesId == _salesId;
ttscommit;
}
Q.80) What are the different Method modifiers in Ax?
Ans) There are several modifiers that can be applied to method declarations.
Public: Methods that are declared as public are accessible anywhere the class is accessible and can be
overridden by subclasses. Methods that have no access modifier are implicitly public.
Private: Methods that are declared as private can be called only from methods in the class where the
private method is declared.
Protected: Methods that are declared as protected can only be called from methods in the class and in
subclasses that extend the class where the method is declared.
final: Indicates that the method cannot be overridden in any class that derives from its class.
Server: Establishes the location where the method is to be executed (on the server).
Can only be used on static methods. If the method is not static, you need to specify the location using the
class property RunOn.
Client: Establishes the location where the method is to be executed (on the client).
Can only be used on static methods. If the method is not static, specify the location by using the class
property RunOn.
abstract : The method is declared but not implemented in a parent class. The method must be overridden
in subclasses.
If you try to create an object from a subclass where one or more of the abstract methods belonging to the
parent class have not been overridden, you will get a compiler error.
Ex: SalesFormLetter
static: Specifies that the method is a class method and does not operate on an object.
static methods cannot refer to instance variables and are invoked by using the class name rather than on
an instance of the class (MyClass::aStaticProcedure()).
Display: Indicates that the method's return value is to be displayed on a form or a report. The value
cannot be altered in the form or report. The return value is typically a calculated value,
for example, a sum.
edit: Indicates that the method's return type is to be used to provide information for a field that is used in
a form. The value in the field can be edited.
InventJournalTable inventJournalTable;
InventJournalTrans inventJournalTrans;
InventJournalNameId inventJournalName;
InventDim inventDim;
JournalCheckPost journalCheckPost;