Monthly Archives: May 2016

AX 2012 R3: Convert Images (JPEG) to Base64

How to convert images to base 64

public str (RefRecId _refRecId, RefTableId _refTableId)

{
System.Drawing.Image image;
System.IO.MemoryStream memoryStream;
str filePath = ”;
Filename fileName = ”;
DocuRef docuRef;
;

select docuRef
where docuRef.RefRecId == _refRecId
&& docuRef.RefTableId == _refTableId;

if (docuRef)
{

// Get Images complete File Name
fileName = docuRef.completeFilename();

image = System.Drawing.Image::FromFile(@Filename);
memoryStream = new System.IO.MemoryStream();
image.Save(memoryStream, System.Drawing.Imaging.ImageFormat::get_Jpeg());
filePath = System.Convert::ToBase64String(memoryStream.ToArray());
}

return filePath;
}

Screen Shot:

Capture

 

Note:

Assuming parameters _refRecId and _refTableId came from InventTable where the Product Images is set in Released Product under Product Image function. See image below:

Untitled

 

Removed Failed Report Name in Report Queue Status of Management Reporter 2012

Removed Failed Report Name in Report Queue Status of Management Reporter.

MR Report Queue Status Failed

Solution

  • Go to SQL Server and Find Management Reporter Database. Usually default name is ManagementReporter.
  • Run a new query on it, and type the following:

DELETE REPOSITORY  WHERE StatusType <> 0

  • Go to Management Reporter Designer and check again Report Queue Status.

AX 2012: Client found response content type of “, but expected ‘text/xml’. The request failed with an empty response.

Error while calling SSRS  Reports in AX 2012

Error Details:

Client found response content type of “, but expected ‘text\xml’. The request failed with an empty response.

The attempt to connect to the report server failed. Check your connection information and that the report server is a compatible version.

Error Screen Shots:

Client found response content type of

 

Solution (Based on my experiences):

  1. Check your Reporting Server, check local drive where your Reporting Server Files are stored. Check if there still available spaces.
  2. In my case, Client found response content type of (sol)
  3. After I cleaned my Local Disk (C:), error is resolved.

AX 2012: Get Exchange Rates

 

Get Exchange Rates in AX 2012

Parameters are CurrencyCode and TransDate.

 

public ExchRate getExchRateFind(CurrencyCode _currencyCode = ”, TransDate _transDate = systemDateGet())
{
ExchangeRateType ExchangeRateType;
ExchangeRateCurrencyPair ExchangeRateCurrencyPair;
ExchangeRateHelper exchangeRateHelper;
CurrencyExchangeRate exchangeRate1;
CurrencyExchangeRate exchangeRate;
;

exchangeRateHelper = ExchangeRateHelper::newExchangeDate(Ledger::current(), _currencyCode, _transDate);
exchangeRate1 = exchangeRateHelper.getExchangeRate1();
exchangeRate = exchangeRateHelper.displayStoredExchangeRate(exchangeRate1);

return exchangeRate;
}

AX 2012 R3: Logon Error, A user session on the server could not be created.

Logon error

A user session on the server could not be created. Try to start the client again. If the problem continues, contact the Microsoft Dynamics AX Administrator.

Warning Details:

This usually caused by Hard-disk failure due to Not Accessible, Out of Memory Spaces or even corrupted drives.

Microsoft Dynamics AX cannot create  a session record in the Databases and you will not be able to open or access Microsoft Dynamics AX Client.

A user session on the server could not be created

 

Solution Details:

  • Check your SQL Server where your Microsoft Dynamics AX Databases was stored.
  • Check if local drives where AX Databases stored are accessible and still enough memory spaces. If full try to clean some temporary log files or try to increase your local drive spaces.

 

Show’s Data(D:) is already full and no enough spaces to create any records.

Before

A user session on the server could not be created (sol)

 

After

A user session on the server could not be created (sol 2)

 

Try again to open Microsoft Dynamics AX Client.

 

Regards,
Ariston Javier