Saturday, October 15, 2011

Information About Indexes

Important notes to remember on Indexes:

1.       Whenever you are using an index or index hint in the query, specify the fields in the where clause as defined in index otherwise SQL doesn’t use the index specified
2.       If a table index has been disabled by setting the index’s Enabled property to No, the select statement that references the index is still valid. However, the database can’t use the index as a hint for how to sort the data, because the index doesn’t exist in the database.

Unique and Non-Unique Indexes
There are two types of indexes: unique and non-unique. Whether an index is unique is defined by the index’s AllowDuplicates property. When this property is set to No, a unique index is created. The database uses the unique index to ensure that no duplicate key values occur. The database prevents you from inserting records with duplicate key values by rejecting the insert
Setting the index’s AllowDuplicates property to Yes creates a non-unique index. These indexes allow you to enter duplicate values for the indexed fields and are used for performance reasons.

Note
A field of data type memo or container cannot be used in an index.


System Index
Microsoft Dynamics AX requires a unique index on each table so if there are no indexes on a table or all the indexes are disabled, a system index is automatically created. The system index is created on the RecId and DataAreaId fields if the DataAreaId field exists. Otherwise the system index is created on the RecId field. You can see system indexes in the database but they aren’t visible in the AOT.
If there are indexes on a table but none of them are unique, the runtime estimates the average key length of the existing indexes, chooses the index with the smallest key length and appends the RecId column to create a unique index.

Using Index Hints
To use index hints in queries you must first specify the use of hints on the server using the following procedure.
  1. Open Start > Administrative Tools > Microsoft Dynamics AX Server Configuration Utility and select the Database Tuning tab.
  2. Select Allow INDEX hints in queries and click OK.
  3. A message box prompting you to restart the AOS service appears. Click Yes to restart the AOS service. Index hints won’t be enabled until the service is restarted.
Note
A wrong index hint can have a big performance impact. Index hints should only be applied to SQL statements that do not have dynamic where clauses or order by clauses, and where the effect of the hint can be verified.
When an index hint in a select statement refers to a non-clustered index and the WHERE clause contains only the fields that are found in a clustered index on the same table, the clustered index is used instead of the index specified in the hint.


For example, if you run sp_helpindex InventTable in SQL Server Management Studio, you see that the InventTable has a clustered index on the DataAreaId and ItemId columns and a non-clustered index on the DataAreaId, ItemGroupId, and ItemId columns.

Index name
Description
Key columns
I_175ITEMIDX
Clustered, unique, primary key located on PRIMARY
DATAAREAID, ITEMID
I_175GROUPITEMIDX
Nonclustered located on PRIMARY
DATAAREAID, ITEMGROUPID, ITEMID


In the following code the clustered index will be used instead of the non-clustered index specified in the index hint.

static void IndexHint(Args _args)
{
    InventTable inv;
    ;
    select * from inv index hint GroupItemIdx
        where inv.ItemId == ‘B-R14′;
}

Send workflow notification as email

In AX2009, we can email the workflow notifications. The following steps will show you how to set this up:
1. Create an email template for workflow.
Go to Basic –> Setup –> Email Templates. Create a new email template for workflow notification.
image
2. Set workflow to use the template that is created from step 1.
Go to Basic –> Setup –> Settings for workflow. Select the email template on the General tab.
image
3. Enable “Send notifications as e-mail message” for the user.
Tools –> Options.
image

Tips to improve Alexa ranking

Tips to improve Alexa ranking


Alexa ranking for a site is calculated on the basis of how many visitors with the Alexa toolbar installed have visited that particular site, the results can be inaccurate most of the time.

1.) Download the Alexa toolbar and surf your own site.

2.) Have a few friends download the Alexa Toolbar and surf your site.

3.) Shift the focus of your site toward a more webmaster like theme.

4.) Participate in many webmaster forums which allow you to place your site in your signature.

5.) Write articles about webmaster topics and distribute them around the web.

6.) Optimize pages of your site for Alexa and related phrases.

7.) Buy ads on search engines to increase your traffic. Your Alexa traffic rankings will increase.

8.) Write an article with tips on how to increase your Alexa rankings.

9.) Advertise that article on the world's largest network.

10.) Join an autosurf network which exchanges Alexa credits.  this actually exists and they sell off some of the credits. The problem is that those are credits. They are not real visitors. They are not what you need.

Direct Hit failed as a search engine because it based a large portion of its algorithm on web traffic. Alexa ranking is highly inaccurate and easy to manipulate.

The ranking in alexa shows the total traffic being generated in your website. There are various steps involved in improving ranking in alexa. First of all it is suggested to download the alexa toolbar. Then the content, which is written, should include write-ups on alexa search engine. But a low ranking on Alexa does not indicate that the traffic is not being generated on Google, Yahoo and MSN search engines. Given the fact that Alexa ranking for a site is calculated on the basis of how many visitors with the Alexa toolbar installed have visited that particular site, the results can be inaccurate most of the time.

Microsoft Dynamics AX 20012 unsheld

Find information and tools to help you install, upgrade, use, customize, and maintain business management software: Microsoft Dynamics AX 2009. A business solution for all industries.
 
 

Send and recieve parameter string through args in axapta

1. Send
void clicked()
{
    Args  args = new Args();
    ;
    Args.parm("retrive hell");
    new MenuFunction(menuitemdisplaystr(Sunny_Param_String_Recieve), MenuItemType::Display).run(args);
}
2. Receive
public void init()
{
   // super();
    str paramString;
    Args args;
;
    super();
    args = new args();
    paramString = element.args().parm();
    info(strfmt("paramString = %1",paramString));
}

Friday, October 14, 2011

Create & Post Inventory Journal in AX 2009

Following is job which will create and post the Inventory Journal in ax 2009 :-

static void createMovJournal(Args _args)
{ InventJournalTable journalTable;
InventJournalTrans journalTrans;
InventJournalTableData journalTableData;
InventJournalTransData journalTransData;
InventTable inventTable;
InventDim inventDim;
Counter cnt;
InventJournalCheckPost journalCheckPost = new InventJournalCheckPost();
DialogButton dbtn;
;

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 ='1103';    //inventTable.ItemId;
journalTrans.Qty = 100;
journalTrans.CostAmount = 100;
journalTrans.LedgerAccountIdOffset='110170';

// Dimension details

inventDim.InventLocationId = '11';
journalTrans.InventDimId ='00000061_069'; //InventDim::findOrCreate(inventDim).inventDimId;

journalTransData.create();



}

journalTable.insert();

// Call the static method to post the journal
if(InventJournalCheckPost::newPostJournal(journalTable).validate())

if(box::yesNo("Do you want to Post Now?",DialogButton::No)==DialogButton::Yes)
{
InventJournalCheckPost::newPostJournal(journalTable).run();
}
else
{
 box::info("Not Posted");
}
info("done");

}