Wednesday, November 19, 2014

SQL Server:Inner Join using 'Where' 'Is Not Null' and sorting conditions




SELECT Table1.weborder, Table2.weborder,Table2.web_promocode,Table2.web_cost,Table2.web_price,Table2.web_quantity,Table1.web_ordertime,Table2.web_unitcost
FROM Table1
INNER JOIN web_details
ON Table1.weborder=Table2.weborder where Table2.web_promocode is not null and Table2.web_ordertime>'11/01/2014' and Table2.web_unitcost>0
ORDER BY Table1.web_ordertime desc;

Not Equal to Null or Is Not Null Condition in SQL Server

Query:

select * from Employeetable where emp_date is not null

Thursday, November 13, 2014

Application Object Tree in AX

The Application Object Tree (AOT) is the development menu in Axapta. All objects used in the application are stored in the AOT and presented to the developer in a tree organized by object type. Axapta uses a layer technology to store objects. This layers help differentiate the objects in Axapta as a typical Axapta installation is built up using not just the standard objects from Microsoft, but also objects provided by Solution Providers, partners and as those developed by customers themselves.  
When expanding a node in the AOT, the sub nodes at the next level will be cached. This may take a few seconds the first time a node is expanded. You only cache the nodes used. When a cached node is later expanded you will find that it responds far more quickly.  
The AOT is accessed by pressing ctrl+d or clicking the icon  in the top menu. Notice that if you are running a demo installation of Axapta, you will not have access to the AOT. You must have the license codes  and X++ installed.
To create a new object, right-click a node in the AOT and choose new. A red vertical bar next to the object node indicates that the node has not been saved. The red mark is also set when a node is modified. All nodes modified or recently created can be saved by clicking the save all icon  in top of the AOT window.
Objects, fields and methods may be duplicated within the AOT. Methods and fields may also be copied. The copy and duplicate functions are accessed by right-clicking on the node and selecting the desired function. When you duplicate a node, the system will create a copy of the selected node in the AOT prefixed with copyOf. This is especially useful when you want to test a possible modification and would like to preserve the prior state of the object as a fallback should the change not function as desired.  
The AOT also supports drag and drop. When adding controls to forms and reports, it is often much faster to drag the fields used for the controls to the form or the report directly from a data source, rather than create them from scratch.
Regardless of which node you select in the AOT, you will always have access to a context menu by right-clicking the current node. The menu is named SysContextMenu in the AOT and can be found under the Menu node. When browsing the menu from the AOT all menu items available in the Context menu will be listed. Depending on the selected node in the AOT you will have additional menu items available to perform context specific activities, like creating a new object, opening a new window or accessing the tools sub menu Add-Ins. Opening a new window provides a root node based on the current selected node in the AOT. You can open as many windows as needed. This feature can be used while dragging new objects to a form or a report, or simply to have cursors positioned in different places in the AOT.   

Thursday, November 6, 2014

How to create Item or Product and Product master in Dynamics AX 2012

Here we are going to discuss how to create a product and Product master(Items).
In 2012, ‘Item’ is replaced with ‘Product’. One cannot find an item master in Inventory Management Module, there is a separate module for item/product creation. The Name of that module is ‘Product Information Management’.
There are two types of Products in 2012. They are
1. Product
2. Product Master
1. Product:
These are clearly identifiable products that do not have variations associated with them. You can think of them as standard or base products. Use the Products list page in the Product information management module to view and manage products.
2. Product Master:
These serve as templates or models for variants. The variants of a product master can be either predefined or created in sales scenarios by using a product configurator. A product master is associated with one or more product dimensions, or for some configurators, product attributes. Use the Product master’s list page in the Product information management module to view and manage product masters
To access Product and Product Masters go to Product Information Management à Common Forms à Products à Products /Products Masters.
 
Product Creation Process:
  • To create product go to Product Information Management à Common Forms à Products à Products.
  • Click on New Button, a new product form is opened. In that form select the product type as Item/Service.
    • Item- A Tangible item which has inventory transactions and On-hand inventory.
    • Service- an Intangible item which has no On-hand inventory.
    • Now select Product sub-type, (note- if you open new product form from ‘all products and product master’ then you will be displayed with two option product/product masters in this drop down menu)
    • Enter Product Number.
    • Press ok and the current form closes and a new line is created in the products list page.

Product/Product Master Creation Process:
  • To create product go to Product Information Management à Common Forms à Products à Products.
  • Click on New Button, a new product form is opened. In that form select the product type as Item/Service.
    • Item- A Tangible item which has inventory transactions and On-hand inventory.
    • Service- an Intangible item which has no On-hand inventory.
    • Now select Product sub-type, (note- if you open new product form from all products and product master  then you will be displayed with two option product/product masters in this drop down menu)
    • Enter Product Number and all the related fields.
    • In the product variants section, select product dimensions group and configuration technology.
    • Press ok and the current form closes and a new line is created in the products list page.


Assigning Dimensions Groups to a Product Master:
  • In the product list page, double click on the product.
  • In the product details form opened, on the top of the form you will find Dimension Group Button.
  • Click on Dimensions group Button will open a drop down menu.
  • In the drop down menu you find three fields
    • Product Dimension group
    • Storage Dimension group
    • Tracking Dimension group
    • Select the appropriate groups from these menus.
 
Note:
Please don’t get confused between a ‘Product’ and ‘Product Master’; they are two different product types in AX 2012.
We can assign Product ‘Dimension Group’ to ‘Product Master’ but we can’t assign ‘Dimension Group’ to ‘Product’. ‘Product’ is a unique item which doesn’t have any variants.
Creating Product Dimensions and creating dimension combinations:
  • In the product details form, in the product master field press product dimensions button.
  • In the Product dimensions form in the left pane, all the dimensions related to that product will be displayed.
  • Click on one dimension, the right pane will display the dimension already entered if any.
  • If you are entering dimensions for the first time, the right pane will be empty.
  • Now press new button, a new blank line is created. Enter the dimensions.
  • For example, if you select configuration in the left pane then enter the configuration dimension of the product in the right pane.
  • Similarly repeat the steps for all the product dimensions.
 
Product dimension combinations (Product Variants):
  • Once you create all the dimensions for a product, in ax 2009 we need to create item combinations.
  • Similarly in ax2012 we use Product Variants.
  • You can find product variants button in the product master section of the product master details form.
  • Please refer to the below screenshot
  • In the product variants form, you can create product dimension combinations using two methods,
    • By directly clicking on new button and selecting appropriate configurations. (OR)
    • By clicking on ‘Variant Suggestions’ will open a new form displaying all the possible combinations. Just check the select checkbox on the combinations you want and press OK.
Release product to legal entities:
  • Once you have created the product you need to release that product for use by your companies.
  • To release a product, go to that product in the product master form and on the top of the form in Product Authorization section press on ‘Release Product for Legal Entities’ button.
  • Release Products form is opened. Please see the screenshot for your reference.
 
  • In the left hand side of the form, press ‘select products’. In the right hand side, all the products will be displayed. Further right to that, you will find all the product variants.
  • Select the required products or product variants.
  • Now Press ‘Select Companies’ from left hand side pane.  All the companies in the ax will be displayed.
  • Now select the companies in which you want to use this product and after finishing press OK.
  • Now you have Released your Product for further use.
Assigning Item Model Group & Item Groups to a Product Master:
  • In the Released products form (go to product information management module à common forms à Released Products) select your product and click on ‘Edit’ button on top left.
  • In the Released product details form, in the General Fast Tab , you will find ‘Item Model Group’ Field
  • From the drop down menu, select an item model group.
  • In the same form , in ‘Manage costs’ tab posting, field you will find ‘Item Groups’ Field.
  • From the drop down menu select an Item Group.
  • Now the item or Product or Product master is ready for further transactions.

Wednesday, November 5, 2014

C#: Convert Excel File to Unreadable format or .err file

   public string Excelfilepath = string.Empty;          
Excelfilepath = @"C:\Users\abc\Desktop\xyz\pqr.xls";
FileInfo f = new FileInfo(Excelfilepath);
                string filefullname = f.Name;
                string fileextension = f.Extension;
                string filename = string.Empty;
                filename = filefullname.Substring(0, filefullname.Length - fileextension.Length);
                if (File.Exists(f.DirectoryName + "\\" + filename + ".err"))
                {
                    File.Delete(f.DirectoryName + "\\" + filename + ".err");

                }
                if (File.Exists(f.DirectoryName + "\\" + filename + ".xls"))
                {
                    f.MoveTo(Path.ChangeExtension(Excelfilepath, ".err"));
                }

The 'Microsoft.ACE.OLEDB.12.0' provider is not registered on the local machine

Solution:

Application-->Properties-->Build-->Change Platform target from Any CPU to-->x86