Langsung ke konten utama

Postingan

Menampilkan postingan dengan label dynamics Ax 2012

Use X++ wildcard (LIKE and NOT LIKE) in X++ select statement

For x++ select statements:  select firstOnly batchHistory      where batchHistory.Caption  LIKE  "*Test*"  For x++ queries:  queryBuildRange.value(*Test*); Note the LIKE instead of a '==' and the wildcards inside of the quotations. All other combinations of wildcard usage will work here. This is the same functionality as what the users would put in the grid filtering(eg. '*TEST*' in the caption field filter on the batch tasks form).  However, if you want to find all Captions that do not have the word Test in them (NOT LIKE, !LIKE), you will have to modify the above example slightly.  For x++ select statements:  select firstOnly batchHistory      where  !( batchHistory.Caption LIKE "*TEST*" ) ;  For x++ queries:  queryBuildRange.value(!*Test*);

Breakpoint in Info.add()

This trick is probably the first every X++ developer learns, so it deserves to be the first on the  list of X++ Debugging Tips and Tricks . Suppose an X++ exception occurs and you want to know why. The error is written to the Infolog. Double-clicking the line in the Infolog window will bring you to the line that threw the exception. Sometimes it is trivial to see the cause just by looking at the code. Other times it is not, and you will need the entire context including the call stack and variables to figure out what the cause is. Set a breakpoint in the  add  method on the  Info  class – and rerun the scenario. When the exception is thrown your breakpoint is hit, and you can perform the autopsy.

To Read and Write From Serial Port C#

using System ; using System . IO . Ports ; using System . Windows . Forms ; namespace SerialPortExample { class SerialPortProgram { // Create the serial port with basic settings private SerialPort port = new SerialPort ( "COM1" , 9600 , Parity . None , 8 , StopBits . One ); [ STAThread ] static void Main ( string [] args ) { // Instatiate this class new SerialPortProgram (); } private SerialPortProgram () { Console . WriteLine ( "Incoming Data:" ); // Attach a method to be called when there // is data waiting in the port's buffer port . DataReceived += new SerialDataReceivedEventHandler ( port_DataReceived ); // Begin communications port . Open (); // Enter an application loop to keep this thread alive Application . Run (); } private void port_DataReceived ( object sender , SerialDataR...

String to hexadecimal and back C#

This is code to convert String to Hex and Back using System; using System.Collections.Generic; using System.Linq; using System.Text.RegularExpressions; namespace hexTester {     public class Program     {         public static void Main(string[] args)         {             string a = "testing";             Console.WriteLine(a);             string hex = ConvertStringToHex(a);             Console.WriteLine(hex);             Console.WriteLine(ConvertHexToString(hex));         }                 public static string ConvertStringToHex(string asciiString)         {             string hex = "";             foreach (char c in as...

AX 2012 Call API

Below code helps you to call the Restful API using basic authentication method of adding Authorization header using HTTP Post method. static void ConsumingRestService(Args _args) { str destinationUrl = 'Json Url here', requestXml, responseXml; System.Net.HttpWebRequest request; System.Net.HttpWebResponse response; CLRObject clrObj; System.Byte[] bytes; System.Text.Encoding utf8; System.IO.Stream requestStream, responseStream; System.IO.StreamReader streamReader; System.Exception ex; System.Net.WebHeaderCollection httpHeader; str byteStr; System.Byte[] byteArray; System.IO.Stream stream; System.IO.Stream dataStream; byteStr = strfmt('%1:%2', "USERNAME", "PASSWORD"); requestXml = " { \"storeId\": 25001, \"terminalId\":\"012\", \"transactionSeque...

Query with aggregate function

Query in SQL = Select  AccountNum, sum(AmountCur), sum(AmountMST) from CustTrans group by AccountNum where CustTrans.AccountNum == 'US-018' ;

FATAL EXCEPTION PERFORMING AXRDCE TRANSFORMATION STEP. THE REPORT CANNOT BE RENDERED. PLEASE CONTACT YOUR SYSTEM ADMINISTRATOR.

FATAL EXCEPTION PERFORMING AXRDCE TRANSFORMATION STEP. THE REPORT CANNOT BE RENDERED. PLEASE CONTACT YOUR SYSTEM ADMINISTRATOR. Today I came with new issue in AX Report. Few days back my report was working fine. But today it showed me something weird information while opening the report. Fatal exception performing AXRDCE transformation step. The report cannot be rendered. Please contact your system administrator. I was just googled, there is no luck. Finally I figured out the issue. First this SSRS report was developed with Query Dataset type. Few days before I just deleted one field from my table. but I checked in (Visual Studio) SSRS–> MyReport –> dataset –>fields  still my deleted field is exist in this report dataset. This is the only reason i got this error. I have tried to delete the unavailable field, but there is no option to delete the field from Report dataset. Here is the solution if you have same scenario.  Export the ...

How to make Relation in Extended Data Type and add 'View Details' for field on a form in AX 2012

Because AX 2012 is not support  for add relation to Extended Data Type like in AX 2009. This is my solution how to do it in 2012: - Duplicate an EDT have relation in AX 2012: ex SalesId and change name. relation table, reference table to yours -> you have an EDT with relation **** If your project have been customized already and have a lot tables with field extend from your EDT, you don't need to change  EDT property in each table (because it takes lot of time). Follow these steps: - Export your Proj xpo (with old EDT too) - Delete old EDT, rename duplicated EDT to your EDT ( now tables with fields extended by your EDT lost all EDT property) - Import project  without old EDT  ( auto fill property for all extend field) The filed with EDT have relation aut o add 'View Details function on form ( Right-click a field in a form, and then click  View details) ***1 more way to add 'View Details' with field not extend from EDT Open the form in the AOT, expa...

How to Create SSRS Report with Report Data Provider (RDP) Class in MS Dynamics Ax 2012

There are different ways to create SSRS report in MS Dynamics Ax 2012, mostly depending upon different type of data source used for creating report. There are several ways to retrieve data for reports. One of them is to use the Report Data Provider Class or RDP Class. The SQL Reporting Services solution for Microsoft Dynamics AX 2012 includes a data source type called Report Data Provider (RDP) which can be used to build reports that have data from an X++ class as the source. Custom business logic to be rendered in reports using predefined X++ classes. Also, can bind parameter elements to Report Definition Language (RDL) expressions using the expression editor. The following two classes are required to be able to set Report Data Provider as data source type on a report with parameters. Report Data Provider (RDP) Class : A report data provider (RDP) class is an X++ class that is used to access and process data for a report. A RDP class processes the business logic based on a ...