[AX2012 R3] using QR codes in SSRS reports

Source: Internet
Author: User
Tags microsoft dynamics

AX2012 is a class that comes with QR code generation, which can be conveniently used in SSRS reports, which shows how to use a QR code in an RDP report, starting with the definition of a temporary table:

The field URL is the string to be used for the QR code, and QRCode is the container type that holds the resulting binary data of the two-dimensional code graphic.

DP class:

classTESTQRCODEDP extends srsreportdataproviderbase{testqrcodetmp qrcodetmp;} [Srsreportdatasetattribute (Tablestr (testqrcodetmp))] Publictestqrcodetmp getqrcodetmp () {Selectqrcodetmp; returnqrcodetmp;} Public voidProcessreport () {container imagecontainer; str URL='http://www.cnblogs.com/duanshuiliu/'; EFDOCQRCODE_BR QRCode=NewEfdocqrcode_br (); Imagecontainer=qrcode.generateqrcode (URL);    Qrcodetmp.clear (); Qrcodetmp.url=URL; Qrcodetmp.qrcode=Imagecontainer; Qrcodetmp.insert ();}

This uses the class EFDOCQRCODE_BR to generate two-dimensional code images and saved in the container, from the suffix name should be the Brazilian region feature, the image default to BMP format. This class is a wrapper for the Microsoft.Dynamics.QRCode.Encoder class of. NET, and the AOT's C # Engineering QRCode contains the complete code.

EFDOCQRCODE_BR internally calls the Microsoft.Dynamics.QRCode.Encoder.GetTempFile (), which saves the QR code image after the temporary file, Using Bindata to read temporary file contents to container in Microsoft Dynamics AX, if you do not want to use this temporary file method, you want to implement directly in memory, you can use. NET encoder as follows:

 Public voidProcessreport () {Microsoft.Dynamics.QRCode.Encoder QRCode=NewMicrosoft.Dynamics.QRCode.Encoder ();    System.Drawing.Bitmap Bitmap;    Container Imagecontainer; str URL='http://www.cnblogs.com/duanshuiliu/'; System.IO.MemoryStream MemoryStream=NewSystem.IO.MemoryStream ();Bitmap=qrcode.encode (URL); Bitmap.    Save (MemoryStream, System.drawing.imaging.imageformat::get_png ()); Imagecontainer=Binary::constructfrommemorystream (MemoryStream). GetContainer ();    Qrcodetmp.clear (); Qrcodetmp.url=URL; Qrcodetmp.qrcode=Imagecontainer; Qrcodetmp.insert ();}

The generated QR code image is encoded in PNG format saved in container, and finally inserted into the temporary table.

Create an SSRS report that uses this RDP as a dataset, which can be used on precision design or auto desgin, such as the following auto design:

The source of the set image is database, and the corresponding MIME type,expression is the data field of the dataset's QR code.

The final preview effect:

Take out your phone and sweep it.

[AX2012 R3] using QR codes in SSRS reports

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.