Skip Label

SevententhSevententh Member Posts: 10
Hi all,

I am trying to create a standard Label Report with 3 columns, based on table Purch. Rcpt Line. The label sheet contains: 3 columns x 6 rows
This has been created successfully (aligned and printing as it should)

Problem: If a sheet has previously had the first 5 labels used, how can I get the report to skip printing on the 1st column + 1st row and start at label 6..?
I have created a C/AL Global variable StartAtLabel where a user can enter the number to start printing the labels from, but my code only skips the first label!

Comments

  • SogSog Member Posts: 1,023
    This is what I read

    You've created a custom report with custom code and custom functionality, based on Purch. Rcpt Line.
    You have unwanted behaviour due to one of your functions functioning incorrectly, and you want us to help you.

    Based on this information alone, only a supernatural person might help you. (one that can read minds)
    Here is what I miss: The actual code.
    If that's not available, at leas the dataitems, with identifying what dataitem fills the labels and what dataitem prints the labels.
    If it's fully custom we have nothing to go on (save the purch. rcpt. line.
    |Pressing F1 is so much faster than opening your browser|
    |To-Increase|
  • SevententhSevententh Member Posts: 10
    OK then - as stated in first post - I've created a NEW Label Report, with 1 dataitem - Purch. Rcpt Line

    The report, self generates a little bit of code on Purch. Rcpt Line - OnAfterGetRecord
    RecordNo := RecordNo + 1;
    ColumnNo := ColumnNo + 1;
    
    Addr[ColumnNo][1] := FORMAT("Document No.");
    Addr[ColumnNo][2] := FORMAT("No.");
    Addr[ColumnNo][3] := FORMAT(Description);
    Addr[ColumnNo][4] := FORMAT(Quantity);
    Addr[ColumnNo][5] := FORMAT("Order No.");
    
    COMPRESSARRAY(Addr[ColumnNo]);
    
    IF RecordNo = NoOfRecords THEN
      BEGIN
        FOR i := ColumnNo + 1 TO NoOfColumns
          DO
            CLEAR(Addr[i]);
    
        ColumnNo := 0;
      END
    ELSE
      BEGIN
        IF ColumnNo = NoOfColumns THEN
          ColumnNo := 0;
      END;
    
    I have NO custom code, I really didn't think it was a difficult question!
    Q: How do you SKIP printing on the Nth label..???
  • SogSog Member Posts: 1,023
    First,the definition of custom: any object that can't be found in a standard NAV and any object that is modified.
    Second, you can't skip with just 1 dataitem. Because it's fetch record, no print, fetch next , not print, fetch next, print 3, ...
    You want to skip to say 5, then you have to have print empty labels (Row 1 = 1 to 3), next you want to skip the first label of row 2 and then start fetching records...

    So before the purchline dataitem: you'll have to add an integer dataitem, with 1 empty section as high as the labels section.
    onpredataitem integer
    setrange(number,1, round(startatlabel/noofcolumns,1,'<') //= 5/3 = 1,x rounded down to 1 
    
    onaftergetrecord of purch rcpt line. (before the Addr[columno][1])
    if columno < startatlabel mod noofcolumns then //(5 mod 3 = 2, meaning start at 2) 
      columno +=1; 
    

    This posting is as is, code has not been checked nor tested nor cared for
    |Pressing F1 is so much faster than opening your browser|
    |To-Increase|
  • SevententhSevententh Member Posts: 10
    Thanks for your help, it really helped. I had to modify the onaftergetrecord of purch rcpt line, as this calc does not work if
    StartAtLabel = 6
    NoOfColumns = 3
    (StartAtLabel MOD NoOfColumns) = 0 so it would always start at column 1 not column 3 (the 6th label)
          CASE (StartAtLabel MOD NoOfColumns) OF
            1:
              ColumnNo := 1;
            2:
              ColumnNo := 2;
            0:
              ColumnNo := 3;
           END;
    
Sign In or Register to comment.