8 Eylül 2014 Pazartesi

AX 2012 - New taxtrans table structure

Taxtrans table structure changed with AX 2012. There's a good white paper of Microsoft about this. There's a sample join below:


    select generalJournalAccountEntry
            join generalJournalEntry
        where generalJournalEntry.RecId == generalJournalAccountEntry.GeneralJournalEntry &&
              generalJournalEntry.RecId == _RecId
            join subledgerVoucherGeneralJournalEntry
        where subledgerVoucherGeneralJournalEntry.GeneralJournalEntry == generalJournalEntry.RecId
            join dimensionAttributeValueCombination
        where dimensionAttributeValueCombination.RecId == generalJournalAccountEntry.LedgerDimension
            join mainAccount
        where mainAccount.RecId == dimensionAttributeValueCombination.MainAccount;
 




AX 2012 - Where's LedgerTrans?

LedgerTrans gone with AX 2012 and came some new tables. You have to join these tables. There's a good  white paper of Microsoft's about this issue. Some fields renamed and/or moved different tables, all of these explained at this white paper. There's a sample join below:


select generalJournalAccountEntry
            join generalJournalEntry
        where generalJournalEntry.RecId == generalJournalAccountEntry.GeneralJournalEntry &&
              generalJournalEntry.AccountingDate  >=  beginDate && generalJournalEntry.AccountingDate <= endDate
            join subledgerVoucherGeneralJournalEntry
        where subledgerVoucherGeneralJournalEntry.GeneralJournalEntry == generalJournalEntry.RecId
            join dimensionAttributeValueCombination
        where dimensionAttributeValueCombination.RecId == generalJournalAccountEntry.LedgerDimension
        join mainAccount
        where mainAccount.RecId == dimensionAttributeValueCombination.MainAccount &&
              mainAccount.MainAccountId == myAccount

3 Eylül 2014 Çarşamba

AX 2012 - Set voucher to LedgerJournalTrans table

When use AXLedgerJournalTrans class, voucher set as automatically. But if you add record directly to table you have to set voucher:

numberSeq   = numberSeq::newGetVoucherFromCode(NumberSequenceTable::find(ledgerJournalTable.ledgerJournalName().NumberSequenceTable).NumberSequence);
 LedgerJournalTrans.Voucher     = numberSeq.voucher();

2 Eylül 2014 Salı

AX 2012 - Add splitter to form

It's more easy to add splitter control to AX 2012 than 2009. I'll tell horizontal splitter:


Add a group for top part of form. I named it as Hsplitter. Set AutoDeclaration = Yes and  Style = SplitterHorizontalContainer. Add another group for down part of form. Give a name to top group. I named it as TopGroup, also set AutoDeclaration = Yes for this group too. Make bottom groups Height as Column Height. Splitter group should be betwen of other two.

Add this line to form's classDeclaration:

SysFormSplitter_Y                       HorizontalSplitter;

If splitter will be vertical should be SysFormSplitter_X.

Add this line to form's init method:

HorizontalSplitter = new SysFormSplitter_Y(HSplitter,TopGroup, element);

If vertical, should be new SysFormSplitter_X ...

That's all...

8 Ağustos 2014 Cuma

AX 2012 - CIL Error 351

Sometimes you can get this error:

Description: CIL generation: The given key was not present in the dictionary.

Path: \XppIL

Line: 1

Method/Property: XppIL

Error: Err:351

Sync DataDictionary and remove all errors at AOT.
Down AOS. Delete all files from this directory except subfolders:

C:\Program Files\Microsoft Dynamics AX\60\Server\AX2012R2_Dev\bin\XppIL

5 Ağustos 2014 Salı

AX 2012 - Add defaultdimension control to form

You can look for LedgerJournalTable form for how to do.
Add a relation with DimensionAttributeValueSet table's RecId  field for which field added from DimensionDefault EDT.

Add a tab page named tabFinancialDimensions and change properties like below:

AutoDeclaration = true
caption = @SYS101181
HideIfEmpty = No
NeedPermission = Manual

Add this line to forms classDeclaration method:

DimensionDefaultingController       dimensionDefaultingController;

Add this code part to forms init method:

public void init()
{

   boolean allowEdit = true;
    super();
    dimensionDefaultingController = DimensionDefaultingController::constructInTabWithValues(false, true, allowEdit, 0, this, tabFinancialDimensions, "@SYS101181");
    dimensionDefaultingController.parmAttributeValueSetDataSource(MyTable_ds, fieldStr(MyTable, DefaultDimension));
    dimensionDefaultingController.parmValidateBlockedForManualEntry(true);
}


Add this method to tab page:

public void pageActivated()
{
    dimensionDefaultingController.pageActivated();
    super();
}


Update table data source methods like below:

public void delete()
{
    super();
    DimensionDefaultingController.deleted();
}

public void write()
{
    ttsBegin;
    DimensionDefaultingController.writing();
    super();
    ttsCommit;
}

public int active()
{
    int ret;

    ret = super();
    DimensionDefaultingController.activated();
    return ret;
}


4 Ağustos 2014 Pazartesi

AX 2012 - SSRS How to suppress zero as blank?

Put this instead of put field (At this time PurchPrice) itself:

=IIF(Fields!PurchPrice.Value = 0 ,"",Fields!PurchPrice.Value)