Alfasith AX

Alfasith AX
اللَّهُمَّ انْفَعْنِي بِمَا عَلَّمْتَنِي، وَعَلِّمْنِي مَا يَنْفَعُنِي، وَزِدْنِي عِلْمًا

Monday, December 25, 2017

Code to print attachment Notes in AX 2012

Hi,

static void Job75(Args _args)
{
    DocuRefSearch        docuRefSearch;
    SalesQuotationTable     quotationTable;
    quotationTable = SalesQuotationTable::find('CBI-000039');
    docuRefSearch = DocuRefSearch::newTypeIdAndRestriction(quotationTable, 'note', DocuRestriction::External);
           
    //    projActivityCostSummaryTmp.Notes                = Docu::concatDocuRefNotes(docuRefSearch);
    print Docu::concatDocuRefNotes(docuRefSearch);
    print DocuRef::find(quotationTable.dataAreaId,quotationTable.RecId).Notes;
    pause;
}

Regards

Saturday, December 16, 2017

Unretrieved Values in Grid AX 2012

Hi,

You may face this kind of error / bugs during newly added fields to the table.

Case 1:
If the record is Unretrieved in table level-  Sync issue
Solution:
Right click and select synchronize that concern table.

Case 2:
If it not let you to open that table
Solution:
Synchronize entire AOT.

Case 3.
If it says Unretrieved Values in Grid
Solution:
Restart the AOS.

Thanks & Regards,



Wednesday, November 22, 2017

From date and To date time conversion in AX 2012

Hi,

print  DateTimeUtil::newDateTime(fromDare,0);

This will return day start time 12:00 AM

print DateTimeUtil::newDateTime(ToDate,86400);

This will return day end time 11:59 PM

Regards,

Tuesday, November 21, 2017

Cannot insert the value NULL into column message in insert_recordset in AX 2012

Hi,

When you are trying to insert the insert the record in to a table using insert_recordset method in the case of joining to table either pulling from view or a query then we cannot assign null vaues.

Example:
2 tables are joined in view and some filed in child table values may not be available on join which will result in null, in that case we need to insert null values in target table using insert_recordset.

Solution:
Ignore those fields on insert_recordset selection later update if there is a record using update_recordset.

Sample.
In the below example Building,Community,Project,RetailStore,Unit  are dimension, so values may not come always.

insert_recordset custVendPDCTmp (LedgerDimension, JournalNum, PDCStatus, StopPayment, AmountCurCredit,
        AmountCurDebit, BankChequeNum, BankAccountId, CurrencyCode, DefaultDimension,
        LineNum,MaturityDate,
        PaymentStatus,PaymentRealizedStatus,Voucher,IsReplacementCheck
        // Building,Community,Project,RetailStore,Unit,
        )
        select LedgerDimension,JournalNum, PDCStatus,StopPayment,AmountCurCredit,
        AmountCurDebit,BankChequeNum,BankAccountId,CurrencyCode,DefaultDimension,
        LineNum,MaturityDate,
        PaymentStatus,PaymentRealizedStatus,Voucher,IsReplacementCheck
        //Building,Community,Project,RetailStores,Unit,
            from custVendPDCQueryView where custVendPDCQueryView.AccountType == accountType;

Solution:


update_recordSet custVendPDCTmp
        setting Building = custVendPDCQueryView.Building
        Join custVendPDCQueryView
        where custVendPDCQueryView.DefaultDimension == custVendPDCTmp.DefaultDimension &&            custVendPDCQueryView.Building != "";

Thursday, October 26, 2017

Conditional based decimal in SSRS

Hi,

=iif(Fields!CurrencyCode.Value ="USD",(FormatNumber(Fields!TotalAmountSumDebit.Value,2)),(FormatNumber(Fields!TotalAmountSumDebit.Value,4)))

Regards,

Tuesday, October 17, 2017

Find number of hits and data usage in SQL * Applicable for all the applications (SQL as DB)

Hi,

Right click on the DB and select script and page below one.

SELECT
tables.NAME AS TableName,
indexes.name as IndexName,
sum(partitions.rows) as NumberOfRows,
sum(allocation_units.total_pages) as TotalPages,
sum(allocation_units.used_pages) as UsedPages,
sum(allocation_units.data_pages) as DataPages,
(sum(allocation_units.total_pages) * 8) / 1024 as TotalSizeMB,
(sum(allocation_units.used_pages) * 8) / 1024 as UsedSizeMB,
(sum(allocation_units.data_pages) * 8) / 1024 as DataSizeMB
FROM
sys.tables
INNER JOIN     
sys.indexes ON tables.OBJECT_ID = indexes.object_id
INNER JOIN
sys.partitions ON indexes.object_id = partitions.OBJECT_ID AND indexes.index_id = partitions.index_id
INNER JOIN
sys.allocation_units ON partitions.partition_id = allocation_units.container_id
GROUP BY
tables.NAME, indexes.object_id, indexes.index_id, indexes.name
ORDER BY
TotalSizeMB DESC

Get a table ID in SQL / table browser - D365

Hi select ID from SysTableIdView where  SysTableIdView .Name = 'CustTable' <URL>/?cmp=<CompanyID>&mi=sysTableBrowser...