Wednesday 30 December 2015

Container functions in AX

condel
Use condel to delete one or more items from a container.

confind
Use confind to locate a sequence of items in a container.

conins
Use conins to insert some items into a container.

conlen
Use conlen to find out how many items there are in a container.

connull
Use connull to explicitly dispose of the contents of a container.

conpeek
Use conpeek to extract an item from a container, and to convert it into another data type, if necessary.

conpoke
Use conpoke to replace (poke) an item in a container.

Tuesday 29 December 2015

Get application and kernel version of AX

Get application and kernel version of AX, follow these steps:
· Open the AX2012 client
. In the top right of the client window, you should see a “?” in a blue circle. Click on it.
. In the dropdown select “About Microsoft Dynamics AX” link.





In the form that opens you will see the Application and Kernel version numbers listed.


strRem Function - Delete a Character from String

strRem Function - Delete a Character from String

The following code searches a specified string character and deletes it.
This function is case sensitive.


str strRem(str text1, str text2)

text1:-  The string from which to remove characters.
text2:-  The characters to exclude from the output string.

For example:

strRem("MicrosoftDynamicsAX","aX"); //Returns the string "MicrosoftDynmicsA".

Export data from AX to txt file using X++

static void exportData(Args _args)
{
    CustTable custTable;
    BinData binData;
    TextBuffer textBuffer;
    ;
 
    textBuffer = new TextBuffer();
    textBuffer.setText('');

    while select custTable
    {
        textBuffer.appendText(strFmt('%1;%2;%3\r\n',custTable.AccountNum,custTable.name(),custTable.CustGroup));
    }

    textBuffer.getText();

    binData = new BinData();
    binData.setStrData(textBuffer.getText());
    binData.saveFile(strFmt("%1%2",ExportFilePath,"/"+curext()+date2str(systemDateGet(),123,2,0,2,0,4)+".txt"));
    info("File is exported successfully.");
}

Monday 28 December 2015

Get tableId from tableName

static void getTableId(Args _args)
{
    int64 tableId;
    ;

    tableId = tableName2Id(tableStr(CustTable));

    info(strFmt("%1",tableId));

}

strRTrim Function

strRTrim Function [AX 2012]


Removes the trailing space characters from the end of a string.
str strRTrim(str _text)

Parameters

Parameter
Description
_text
The string from which to remove the trailing space characters.

Return Value

A copy of the specified string without trailing space characters.

Remarks

  • strRTrim("ABC-DEFG- "); //Returns the string "ABC-DEFG-".
  • strRTrim(" CD "); //Returns " CD".
The strRTrim function is complementary to the strLTrim function.

Thursday 24 December 2015

Steps to create Weight Embedded bar code in AX 2012 R2 & R3




Steps to create Weight Embedded bar code in AX 2012 R2 & R3

1. Go to Retail -> Setup -> Bar codes and labels


2. Set up Barcode Mask Characters

Bar code mask characters are alphabetical characters that are replaced with numbers when Microsoft Dynamics AX uses a bar code mask to generate a bar code. Use different bar code mask characters to generate different types of bar codes, such as bar codes for products, customers, or employees. A single mask character, such as a mask character that represents the item number, can add several characters to the bar code.

1. Click Retail > Setup > Bar codes and labels > Mask characters.
2. Press CTRL+N to create a new bar code mask character.
3. In the Type field, select the type of mask character. Then, in the Character field, type a character           between A and Z.
4.In the Description field, type a description of the mask character.

3. Setup Barcode Mask

Use bar code masks to create and check bar codes, and to reduce bar code errors. You can set up masks for both standard bar codes and custom bar codes, which are also referred to as in-house bar codes. Bar code masks consist of an optional prefix and one or more segments.

In-house bar code masks
When you set up custom bar code masks, you must know the requirements of the scanners that are used in your stores. Some scanners only validate bar codes that have a specific format and check digit.

When you create a bar code mask for an item that has variants, Microsoft Dynamics AX can generate the bar codes for each size, color, and style combination.

Standard bar code masks
Bar codes often have a fixed structure. For example, the last digit of standard EAN bar codes is a modulus check digit. When a bar code is entered, Microsoft Dynamics AX checks the validity of the input. Microsoft Dynamics AX also calculates the check digit and converts the input to a standard EAN bar code, if these steps are required.

Supported standards
Bar code masks can be based on any of the following bar code standards:
No bar code
EAN128/UCC128
Code 39
Interleaved 2 of 5
Code 128
UPC A
UPC E
EAN13
EAN8
PDF417
Maxicode

Set up bar code masks
1.Click Retail > Setup > Bar codes and labels > Bar code mask setup.
2.Press CTRL+N to create a new bar code mask.
3.In the Mask ID field, type an ID number, and then, in the Description field, type a description.
4.In the Type field, select the type of bar code mask.
5.On the General FastTab, in the Bar code standard field, select the bar code standard for the mask.
6.In the Prefix field, enter an optional prefix. For example, prefixes are often used to identify the manufacturer.
7.On the Bar code mask segment FastTab, click Add to create a new segment, and then specify information about the segment.
8.The Length field displays the total number of characters in the bar code mask, which is the sum  of the characters in the segments and the prefix.

    Repeat step 7 for each additional segment that you must create.



4. Configure Bar Code setups

1.Click Retail > Setup > Bar codes and labels > Bar code setup.
2.Press CTRL+N to create a new setup for bar codes.
3.In the Bar code setup field, type an ID for the setup.
4.On the General FastTab, in the Bar code type field, select a standard type for the bar code.
5.In the Mask ID field, select a mask for the bar code.
6.In the Font and Size fields, select a font for the bar code, and type a size for the font.
7.In the Minimum length and Maximum length fields, type the minimum and maximum number of characters that the bar code can contain.

    For example, a bar code of the EAN-8 type always contains eight characters when it is printed. Therefore, for an EAN-8 bar code, both the minimum length and the maximum length are 8. For a bar code that contains a fixed string of five characters plus a number from 1 to 100, the minimum length is 6, and the maximum length is 8.



5. Create bar code for specific product

1.Click Retail > Setup > Bar codes and labels > Bar codes.
2.Press CTRL+N to create a new bar code for a product.
3.On the General tab, under Item, select the item number, dimension number, and unit of the product that you are creating the bar code for.
4.Under Bar code, select the bar code to use.
5.Under Setup, select the setup for the bar code.

    If you want the bar code number to appear on the Retail FastTab of the Released product details form, select the Display check box. If this check box is not selected for any bar code number, Microsoft Dynamics AX automatically displays the smallest bar code number for the item.

 Under Product dimensions, specify the product's dimensions.





6. Run Job N-1040 from Distribution Schedule.



get firstName,middleName and lastName in AX 2012 using X++

static void getName(Args _args)
{
    str firstName;
    str middleName;
    str lastName;
    ;
 
    [firstName, middleName, lastName] = DirPerson::splitNameParts("Test Test1 Test2");
 
    info(strFmt("%1",firstName));
    info(strFmt("%1",middleName));
    info(strFmt("%1",LastName));
}