error : TempDB table field cannot be empty for RecId when running SSRS report

Capture

in my case, the AX business connector configuration on report server is set up to another AOS instance.

i did change the config to the right AOS , and restart SQL Report Server Services.

Advertisements

SUM with condition SSRS expression

using aggregate tablix example

=Sum(IIF(Fields!IsDisplay.Value = "Yes", Fields!AvailPhysical.Value, Nothing))

sum all data on a tablix example

=Sum(IIf(Fields!BankAName.Value = "Standard Chartered Bank"
    , Fields!Amount.Value
    , Nothing)
  , "DataSet1")

source :
http://stackoverflow.com/questions/18530541/ssrs-sum-expression-with-condition

Modify Controller Class for Query Based Report SSRS

public void prePromptModifyContract()
{
    //add a range in the report query  
      SrsReportHelper::addParameterValueRangeToQuery(this.getFirstQuery(),tableNum(SSRSReportDemo),fieldNum(SSRSReportDemo, RecId),SysQuery::value(this.parmArgs().record().RecId));
}

source : https://community.dynamics.com/ax/b/dynamics101trainingcenterax/archive/2014/01/30/using-controller-class-in-developing-ssrs-reports-in-microsoft-dynamics-ax-2012.aspx

How to print barcode Label , SSRS can’t print on Landscape Printer AX 2012r2

Hi there ,
after the report being save to PDF on local drive, i call adobe to print barcode,
i have to did that, because SSRS can’t print on landscape printer.

here is my example code

void clicked()
{
    //AIFD_PrintBarcode
    AI_PrintBarcodeController  aiBarcode = new AI_PrintBarcodeController();
    AI_PrintBarcodeContract    aiContract = new AI_PrintBarcodeContract();
    ProdJournalProd            prodJournalProdLoc;
    SRSPrintDestinationSettings  printSettings = new SRSPrintDestinationSettings();
    PrintJobSettings    printJobSettings = new PrintJobSettings();
    Dialog              dialog = new Dialog();
    DialogField         dialogFileName;
    str                 adobeExe;
    str                 adobeParm;

    str                 fileName;
    int                 fileCount;

    //AIFD
    InteropPermission   permission;
    str errorMessage;
    //END
    real WeightInreal;
    permission = new InteropPermission(InteropKind::ClrInterop);
    permission.assert();

    super();
    try
    {
        prodJournalProdLoc = ProdJournalProd_ds.getFirst(true);

        while (prodJournalProdLoc)
        {
            fileCount++;
            aiBarcode.parmReportName(ssrsReportStr(AI_PrintBarcoderReport,Report));
            aiBarcode.parmShowDialog(false);
            aiContract.parmRecordId(prodJournalProdLoc.RecId);
            aiContract.parmDocumentTitle("x");

            //printSettings = aiBarcode.parmReportContract().parmPrintSettings();
            printSettings.printMediumType(SRSPrintMediumType::File);
            //printSettings.landscape(false);
            //printSettings.printerPageSettings('KRRLabelBarcode');
            //info(strFmt("%1",printSettings.printerPageSettings()));

            fileName = strFmt("D:\\barcode%1.pdf",fileCount);

            printSettings.fileFormat(SRSReportFileFormat::PDF);
            printSettings.fileName(fileName);
            printSettings.printerName("TOSHIBA B-SA4TP TS");
            printSettings.landscape(false);
            printSettings.overwriteFile(true);
            aiBarcode.parmReportContract().parmRdpContract(aiContract);
            aiBarcode.parmReportContract().parmPrintSettings(printSettings);

            aiBarcode.startOperation();

            WeightInReal = sleep(500);
            //printJobSettings.printerSettings('SysPrintForm');
            printJobSettings.setTarget(PrintMedium::Printer);
            printJobSettings.preferredTarget(PrintMedium::Printer);
            adobeExe = WinAPI::findExecutable(fileName);

            adobeParm = strFmt(' /t "%1" "%2" "%3" "%4"',
                               fileName,
                               "TOSHIBA B-SA4TP TS",
                               printJobSettings.printerDriverName(),
                               printJobSettings.printerPortName());

            winAPI::shellExecute(adobeExe,  adobeParm);

            WeightInReal = sleep(500);

            prodJournalProdLoc = ProdJournalProd_ds.getNext();
         }
     CodeAccessPermission::revertAssert();
    }
    catch(Exception::CLRError)
    {
        errorMessage = AifUtil::getClrErrorMessage();

        CodeAccessPermission::revertAssert();

        throw error(errorMessage);
    }
    //END
}

Print SSRS Barcode in AX 2012

Hello there,
just working on project that need to print somekind of barcode label for Production’s Serial Number.

you need to convert your string to Barcode string :

__________________________________________________________

public BarCodeString ShowBarcode(str _text)
{
  Barcode barcode;

  barcode = Barcode::construct(BarcodeType::Code128);
  barcode.string(true, _text);
  barcode.encode();

  return barcode.barcodeStr();
}

_________________________________________________________

then do this on Visual Studio 😀

Untitled

 

result :

Untitled

Happy DAXing !!