web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

Community site session details

Community site session details

Session Id :
Microsoft Dynamics SL (Archived)

Generate copies of a label - Crystal Reports SL

(0) ShareShare
ReportReport
Posted on by 101

Hello, I use this code to generate a label, but I need to print a label number, 1 of 3, 2 of 3, 3 of 3 etc.

Call MessBox("¿Imprimir Etiqueta?", MB_YESNO, "Confirmación")
Response = MessResponse()

If Response = IDYES Then
      cad = " 11600/RUN " + PRMSEP + " 39codeT/FORMAT " + PRMSEP
      cad = cad & "{XAVw_EtiquetaProd.refnbr} = " + SParm(GetObjectValue("crefnbr")) + "/WHERE"
      cad = cad & PRMSEP + "/PSCRN"
      serr1 = Launch("ROI" + cad, 1, 1, 1)
End If

i try to add a parameter to the rpt but when trying to print it manually asks for the number of labels to print but that process must be automatic

try to pass the number of labels as a parameter but it only works for the sql statement and not for the RPT

If Response = IDYES Then

           cad = " 11600/RUN " + PRMSEP + " 39codeT/FORMAT " + PRMSEP
           cad = cad & "{Table1.refnbr} = " + SParm(GetObjectValue("crefnbr")) +  " and NumLabel="+ " SParm(GetObjectValue("NumLabels")) " +"/WHERE"
           cad = cad & PRMSEP + "/PSCRN"
           serr1 = Launch("ROI" + cad, 1, 1, 1)
      End If

I try using a loop to print the label but it does not work, ROI.exe crashes

dim NumLabel as integer

NumLabel = val(GetObjectValue("NumLabels"))

If Response = IDYES Then
      cad = " 11600/RUN " + PRMSEP + " 39codeT/FORMAT " + PRMSEP
      cad = cad & "{XAVw_EtiquetaProd.refnbr} = " + SParm(GetObjectValue("crefnbr")) + "/WHERE"
      cad = cad & PRMSEP + "/PSCRN"

      For VAR = 1 To NumLabel
           serr1 = Launch("ROI" + cad, 1, 1, 1)

     Next VAR


End If

 

thanks for your help

 

*This post is locked for comments

I have the same question (0)
  • Verified answer
    Erich Strelow F Profile Picture
    16 on at

    If you are setup to print labels on a zebra-like printer, I have to warn you that CrystalReports is known to be pretty clumsy at this.

    Having said that, the results cardinality on Crystal Reports is always data-driven. You can print several copies, but that's of no use if you need to print the label sequence number.

    A dirty trick should be like this:

    1. Establish a stored procedure pre-process using the RunBefore feature.
    2. The stored procedure pre-process can then setup a loop in order to populate a temporary table (LabelRun sounds just right) with a row for every label you need.  You should use RI_ID as part of the key to avoid collisions.
    3. Set the temporary table as part of the join on your rpt. The label number must be a field on the temporary table.
    4. You should setup a RunAfter stored procedure to clean up the temporary table.

    The real dirty trick is how to actually pass the NumLabel parameter. You can abuse the WHERE clause:

    cad = cad & "{XAVw_EtiquetaProd.refnbr} = " + SParm(GetObjectValue("crefnbr")) + " and " + SParm(GetObjectValue("NumLabels")) + "=" + SParm(GetObjectValue("NumLabels")) + "/WHERE"

    You are reading right. If you need 4 labels, this will push a bogus "4=4" to the where clause. This can then be read by the RunBefore stored procedure from the RptRunTime.RI_WHERE field.

  • develop Profile Picture
    101 on at

    Hello Mr. Erich Strelow, as you say, use a function in SQL that returns the number of rows = the number of labels needed,

    When executing the view in sql it shows the total number of labels and the numbering 1 to N so that when generating the report in a normal way, it shows N numbered pages

    I appreciate your time very much

    have a nice day

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Congratulations to our 2025 Community Spotlights

Thanks to all of our 2025 Community Spotlight stars!

Leaderboard > 🔒一 Microsoft Dynamics SL (Archived)

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans