Thursday, July 26, 2018

AX - How calculate only with opened days in calendar

Use WorkCalendarSched class:
WorkCalendarSched workCalendarSched;
date dateOnlyWorking, dateAll;

workCalendarSched = new workCalendarSched();

dateOnlyWorking = 
  workCalendarSched.schedDate( SchedDirection::Backward, today(), 6, NoYes::Yes, "5x24" );
dateAll = 
  workCalendarSched.schedDate( SchedDirection::Backward, today(), 6, NoYes::No, "5x24" );

info( date2str( dateOnlyWorking, 321, DateDay::Digits2, DateSeparator::Hyphen, 
      DateMonth::Digits2, DateSeparator::Hyphen, DateYear::Digits4 ) );
info( date2str( dateAll, 321, DateDay::Digits2, DateSeparator::Hyphen, 
      DateMonth::Digits2, DateSeparator::Hyphen, DateYear::Digits4 ) );
Output:

Wednesday, July 25, 2018

SSRS - How use labels from AX in SSRS report

1) Click right mouse button on the field, select "Expression..".

2) Use "Labels!" prefix and then the number of AX label:

Tuesday, July 3, 2018

POWERSHELL - How write colored text output

write-host 'This is with red backgroud' -BackgroundColor Red
write-host '..and this is with yellow foretext' -ForegroundColor Yellow
Output:

Monday, July 2, 2018

AX - How to run AX from command line with another language

..here it run it in Russian language:
"C:\Program Files (x86)\Microsoft Dynamics AX\60\Client\Bin\Ax32.exe" -language=ru

Sunday, July 1, 2018

AX - How to use "display" method in forms datasource

This is useful if you need find some value in form. Parameter is source type for DataSource.

public display ItemNameDisplay ItemName( vm_data_detail _vm_data_detail )
{
    return ProdTable::find( _vm_data_detail.ProdId ).ItemName;
}