OnBeforePrint - Question ...

In my report I have the following code for OnBeforePrint …

private void OnBeforePrint(object sender, System.Drawing.Printing.PrintEventArgs e)
{
xrLabel8.Text = string.Format("{0} ({1}) {2}", (“Technician’s”), DetailReport.GetCurrentColumnValue(“LT_WorkorderItemLabor_Label_UserID”), (“Service Notes”));
}

It displays fine but the technician’s name is not coming through? Can you tell me what I might be missing?

Hi

I’m not sure without seeing it in context.

Do always attach a copy of the report template you are experiencing an issue with or have a question about, and always identify the exact field and its band. This way I am not guessing where you may have placed a field, or what is occurring, and able to see from the details you provide exactly what is occurring.

Do attach a copy of the report template, identify the field that script is tied to and what band it is in.

  • Joyce

Ont he attached template - It is on the “Detail5” band - There is a text box named Technician. In that field there is a OnBeforePrint script.

Hi again

Thanks - I will download and take a look and get back to you.

  • Joyce

Hi again

The reason why your script was not working was that you had identified the band as DetailReport, whereas in your report template the band where the Labor fields are in the band called DetailReport3.

If you edit your script to use DetailReport3 instead, then the user name will display.

Do that and let me know that now works.

Just when I thought I was getting good at this … I miss something so obvious :frowning: Thanks for the help - Worked like a charm.

Hi again

I liked your use of the combination string - I’m sure other AyaNova users will see how you used it here and will now also use it in their custom report templates.

Glad I could help.

  • Joyce