OMFG, I can’t believe that you gave me the answers to my questions and allowed me to solve my problem. I have been working on this for over a year. I really did not think it was possible to do what you helped me do. You are amazing. What you did is worth a million dollars to me.
Besides me giving you a million dollars, what can I do to return this favor?
I finally tested the label print direct to a label printer using SSRSCLIENTPRINT as PDF and it prints teeny, tiny. If I print it using SSRSPREVIEW and print it on regular paper or print to the label printer after previewing, it prints correctly. What am I doing wrong?
It could be related to the printer/page settings being passed with the SubmitToAgent call. I passed those to the BPM from a customization, here’s the code I used in the customization:
using Ice.Lib.Report;
using System.Text.RegularExpressions;
using System.Drawing.Printing;
PrinterSettings printerSettings = new PrinterSettings(); //pulls in printer settings from printers installed on client
String labelPrinter = "";
for (int i = 0; i < PrinterSettings.InstalledPrinters.Count; i++){ //loop through installed printers to find zebra label printer
bool isZebraPrinter = Regex.IsMatch(PrinterSettings.InstalledPrinters[i], ".*ZDesigner.*" , RegexOptions.IgnoreCase ); //check for zebra printer
if(isZebraPrinter){
labelPrinter = PrinterSettings.InstalledPrinters[i]; //set printer name when printer is matched/found
break;
}
}
EpiDataView callContextBpm = (EpiDataView)(oTrans.EpiDataViews["CallContextBpmData"]); //set up callContextBpm data to pass to BPM
System.Data.DataRow callContextBpmRow = callContextBpm.CurrentDataRow;
if ((callContextBpmRow != null)){
callContextBpmRow.BeginEdit();
if(labelPrinter != ""){
printerSettings.PrinterName = labelPrinter; //set the printerSetting's printerName. This is analagous to selecting a printer; the settings for this printer name gets passed to the BPM
callContextBpmRow["Character01"] = printerSettings.PrinterName; //set the printer name, printer settings, and page settings
callContextBpmRow["Character03"] = EpiPageSettings.FromPageSettings(printerSettings.DefaultPageSettings).Serialize();
callContextBpmRow["Character04"] = EpiPrinterSettings.FromPrinterSetting(printerSettings).Serialize();
}
else {
callContextBpmRow["Character01"] = "No Printer Found";
}
callContextBpmRow.EndEdit();
}
I get 2 errors after I put your new code into my customization.
Error: CS0103 - line 74 (490) - The name ‘EpiPageSettings’ does not exist in the current context
Error: CS0103 - line 75 (491) - The name ‘EpiPrinterSettings’ does not exist in the current context
I have these usings:
using System;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Windows.Forms;
using Ice.BO;
using Ice.UI;
using Ice.Lib;
using Ice.Adapters;
using Ice.Lib.Customization;
using Ice.Lib.ExtendedProps;
using Ice.Lib.Framework;
using Ice.Lib.Searches;
using Ice.UI.FormFunctions;
using Ice.Lib.Report;
using System.Text.RegularExpressions;
using System.Drawing.Printing;
I added this line to my BPM:
baqRptDS.BAQReportParam[0].RptPageSettings = “Color=False,Landscape=False,PaperSize=[Kind=“Custom” PaperName=“Custom” Height=600 Width=400],PaperSource=[SourceName=“Manual feed” Kind=“Manual”],PrinterResolution=[Kind=“Custom” X=203 Y=203]”;
When I did a check syntax, I got these errors. Without this line I get syntax ok.
Thanks,
Richard
||CS1002|; expected|
||CS1002|; expected|
||CS1002|; expected|
||CS1002|; expected|
||CS1002|; expected|
||CS1002|; expected|
||CS1002|; expected|
||CS1002|; expected|
||CS1002|; expected|
||CS1002|; expected|
||CS0103|The name ‘Custom’ does not exist in the current context|
||CS0103|The name ‘Custom’ does not exist in the current context|
||CS0246|The type or namespace name ‘Manual’ could not be found (are you missing a using directive or an assembly reference?)|
||CS0103|The name ‘Manual’ does not exist in the current context|
||CS0103|The name ‘Custom’ does not exist in the current context|
||CS0201|Only assignment, call, increment, decrement, and new object expressions can be used as a statement|
I have a new twist to calling a BAQ report from BPM data directive using c# code. Instead of calling a BAQ report, I want to call a Epicor report, specifically RcvLabel. Below is the trace when I run it from Receipt Entry, Actions, Print Label.
I figured it out, see below. After adding the RcvLabel reference and substituting baqreport with RcvLabel I go it to work! With a little education and a lot of help from you, I think that everything is now falling in place for me.
Printing a report from a data directive is akin to use a cannon to kill a mosquito. It’ll probably work but it’s a bad idea
Data directives are basically database triggers and as such they are meant to be very very fast
I would recommend you look at moving this to a method directive or an async function call or something else for performance sake
There definitely seems to be some crossover between bpm and form customizations in this thread, but it seems that the code is still working for some in a BPM.
I’m not sure if it’s the version I’m using . but I can’t access the objects as a DataSet, but rather the svc contracts are resulting in a Tableset instead.
Everything else seems good, but my xml filter keeps failing and System Monitor shows an error.
My xml looks good though using Newtonsoft to conver to a JObject and then to XML.