Options

Filter Contact-Labels with Mailing Group

neckitneckit Member Posts: 24
Hi everybody!
I'm new in Navision and this forum and hope, you can help me.
I have to print labels filtered by Mailing Groups. But there is only a field "No. of Mailing Groups" in the contact table.

How can i give the user the chance to choose a "Mailing Group" in the request form of the report 5056 ?

Thanks in advance!

Comments

  • ara3nara3n Member Posts: 9,258
    Hello Neckit. You need to design the report. I'm not sure how much experience you have with reports. So I'll try to explain how I would do it.

    Ok so once the report is designer mode You'll see Contact as first dataitem.
    On the line below add "Contact Mailing Group" then click the -> button at the bottom this will indent the Contact Mailing Group. Next you are going to click on property button in the menu button.
    Change the DataItemLink to Contact No.=FIELD(No.)
    Change ReqFilterFields to Mailing Group Code

    then click on Contact dataitem and go to property and change
    PrintOnlyIfDetail to Yes

    then click on View->Section. At the bottom you'll see Contact Mailing Group Body section. Select it and hit f4. which will ask to delete the body section. Select Yes.

    That's it. Save the report and run it. On second tab you should be able filter by Mailing list group
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
  • ara3nara3n Member Posts: 9,258
    I've attached the report bellow. It's US version. So you can take a look at it. You can renumber and rename it and import it compile and compare it. Just for reference.
    This is the US version and does not have German Language.
    OBJECT Report 5056 Contact - Labels
    {
      OBJECT-PROPERTIES
      {
        Date=09/14/06;
        Time=[ 6:16:18 PM];
        Modified=Yes;
        Version List=NAVW13.60;
      }
      PROPERTIES
      {
        CaptionML=[ENU=Contact - Labels;
                   ESM=Contacto - Etiquetas;
                   FRC=Contacts : ?tiquettes;
                   ENC=Contact - Labels];
      }
      DATAITEMS
      {
        { PROPERTIES
          {
            DataItemTable=Table5050;
            PrintOnlyIfDetail=Yes;
            OnPreDataItem=BEGIN
                            CASE LabelFormat OF
                              LabelFormat::"36 x 70 mm (3 columns)",LabelFormat::"37 x 70 mm (3 columns)":
                                NoOfColumns := 3;
                              LabelFormat::"36 x 105 mm (2 columns)",LabelFormat::"37 x 105 mm (2 columns)":
                                NoOfColumns := 2;
                            END;
                            NoOfRecords := COUNTAPPROX;
                            RecordNo := 0;
                          END;
    
            OnAfterGetRecord=BEGIN
                               RecordNo := RecordNo + 1;
                               ColumnNo := ColumnNo + 1;
                               FormatAddr.ContactAddr(ContAddr[ColumnNo],Contact);
                               IF RecordNo = NoOfRecords THEN BEGIN
                                 FOR i := ColumnNo + 1 TO NoOfColumns DO
                                   CLEAR(ContAddr[i]);
                                 ColumnNo := 0;
                               END ELSE BEGIN
                                 IF ColumnNo = NoOfColumns THEN
                                   ColumnNo := 0;
                               END;
                             END;
    
            ReqFilterFields=No.,Name,Type,Salesperson Code,Post Code,Territory Code,Country Code;
          }
          SECTIONS
          {
            { PROPERTIES
              {
                SectionType=Body;
                SectionWidth=20500;
                SectionHeight=3600;
                KeepWithNext=No;
                OnPreSection=BEGIN
                               CurrReport.SHOWOUTPUT((ColumnNo = 0) AND (LabelFormat = LabelFormat::"36 x 70 mm (3 columns)"));
                             END;
    
              }
              CONTROLS
              {
                { 1   ;TextBox      ;0    ;0    ;6500 ;423  ;FontSize=9;
                                                             SourceExpr=ContAddr[1][1] }
                { 2   ;TextBox      ;0    ;423  ;6500 ;423  ;FontSize=9;
                                                             SourceExpr=ContAddr[1][2] }
                { 3   ;TextBox      ;0    ;846  ;6500 ;423  ;FontSize=9;
                                                             SourceExpr=ContAddr[1][3] }
                { 4   ;TextBox      ;0    ;1269 ;6500 ;423  ;FontSize=9;
                                                             SourceExpr=ContAddr[1][4] }
                { 5   ;TextBox      ;0    ;1692 ;6500 ;423  ;FontSize=9;
                                                             SourceExpr=ContAddr[1][5] }
                { 6   ;TextBox      ;0    ;2115 ;6500 ;423  ;FontSize=9;
                                                             SourceExpr=ContAddr[1][6] }
                { 7   ;TextBox      ;7000 ;0    ;6500 ;423  ;FontSize=9;
                                                             SourceExpr=ContAddr[2][1] }
                { 8   ;TextBox      ;7000 ;423  ;6500 ;423  ;FontSize=9;
                                                             SourceExpr=ContAddr[2][2] }
                { 9   ;TextBox      ;7000 ;846  ;6500 ;423  ;FontSize=9;
                                                             SourceExpr=ContAddr[2][3] }
                { 10  ;TextBox      ;7000 ;1269 ;6500 ;423  ;FontSize=9;
                                                             SourceExpr=ContAddr[2][4] }
                { 11  ;TextBox      ;7000 ;1692 ;6500 ;423  ;FontSize=9;
                                                             SourceExpr=ContAddr[2][5] }
                { 12  ;TextBox      ;7000 ;2115 ;6500 ;423  ;FontSize=9;
                                                             SourceExpr=ContAddr[2][6] }
                { 13  ;TextBox      ;14000;0    ;6500 ;423  ;FontSize=9;
                                                             SourceExpr=ContAddr[3][1] }
                { 14  ;TextBox      ;14000;423  ;6500 ;423  ;FontSize=9;
                                                             SourceExpr=ContAddr[3][2] }
                { 15  ;TextBox      ;14000;846  ;6500 ;423  ;FontSize=9;
                                                             SourceExpr=ContAddr[3][3] }
                { 16  ;TextBox      ;14000;1269 ;6500 ;423  ;FontSize=9;
                                                             SourceExpr=ContAddr[3][4] }
                { 17  ;TextBox      ;14000;1692 ;6500 ;423  ;FontSize=9;
                                                             SourceExpr=ContAddr[3][5] }
                { 18  ;TextBox      ;14000;2115 ;6500 ;423  ;FontSize=9;
                                                             SourceExpr=ContAddr[3][6] }
                { 61  ;TextBox      ;0    ;2538 ;6500 ;423  ;FontSize=9;
                                                             SourceExpr=ContAddr[1][7] }
                { 62  ;TextBox      ;0    ;2961 ;6500 ;423  ;FontSize=9;
                                                             SourceExpr=ContAddr[1][8] }
                { 63  ;TextBox      ;7000 ;2538 ;6500 ;423  ;FontSize=9;
                                                             SourceExpr=ContAddr[2][7] }
                { 64  ;TextBox      ;7000 ;2961 ;6500 ;423  ;FontSize=9;
                                                             SourceExpr=ContAddr[2][8] }
                { 65  ;TextBox      ;14000;2538 ;6500 ;423  ;FontSize=9;
                                                             SourceExpr=ContAddr[3][7] }
                { 66  ;TextBox      ;14000;2961 ;6500 ;423  ;FontSize=9;
                                                             SourceExpr=ContAddr[3][8] }
              }
               }
            { PROPERTIES
              {
                SectionType=Body;
                SectionWidth=20500;
                SectionHeight=3700;
                KeepWithNext=No;
                OnPreSection=BEGIN
                               CurrReport.SHOWOUTPUT((ColumnNo = 0) AND (LabelFormat = LabelFormat::"37 x 70 mm (3 columns)"));
                             END;
    
              }
              CONTROLS
              {
                { 19  ;TextBox      ;14000;2961 ;6500 ;423  ;FontSize=9;
                                                             SourceExpr=ContAddr[3][8] }
                { 20  ;TextBox      ;0    ;2961 ;6500 ;423  ;FontSize=9;
                                                             SourceExpr=ContAddr[1][8] }
                { 21  ;TextBox      ;0    ;2538 ;6500 ;423  ;FontSize=9;
                                                             SourceExpr=ContAddr[1][7] }
                { 22  ;TextBox      ;0    ;2115 ;6500 ;423  ;FontSize=9;
                                                             SourceExpr=ContAddr[1][6] }
                { 23  ;TextBox      ;0    ;1692 ;6500 ;423  ;FontSize=9;
                                                             SourceExpr=ContAddr[1][5] }
                { 24  ;TextBox      ;0    ;1269 ;6500 ;423  ;FontSize=9;
                                                             SourceExpr=ContAddr[1][4] }
                { 25  ;TextBox      ;0    ;846  ;6500 ;423  ;FontSize=9;
                                                             SourceExpr=ContAddr[1][3] }
                { 26  ;TextBox      ;7000 ;846  ;6500 ;423  ;FontSize=9;
                                                             SourceExpr=ContAddr[2][3] }
                { 27  ;TextBox      ;7000 ;1269 ;6500 ;423  ;FontSize=9;
                                                             SourceExpr=ContAddr[2][4] }
                { 28  ;TextBox      ;7000 ;1692 ;6500 ;423  ;FontSize=9;
                                                             SourceExpr=ContAddr[2][5] }
                { 29  ;TextBox      ;7000 ;2115 ;6500 ;423  ;FontSize=9;
                                                             SourceExpr=ContAddr[2][6] }
                { 30  ;TextBox      ;7000 ;2538 ;6500 ;423  ;FontSize=9;
                                                             SourceExpr=ContAddr[2][7] }
                { 31  ;TextBox      ;7000 ;2961 ;6500 ;423  ;FontSize=9;
                                                             SourceExpr=ContAddr[2][8] }
                { 32  ;TextBox      ;0    ;423  ;6500 ;423  ;FontSize=9;
                                                             SourceExpr=ContAddr[1][2] }
                { 33  ;TextBox      ;7000 ;423  ;6500 ;423  ;FontSize=9;
                                                             SourceExpr=ContAddr[2][2] }
                { 34  ;TextBox      ;14000;423  ;6500 ;423  ;FontSize=9;
                                                             SourceExpr=ContAddr[3][2] }
                { 35  ;TextBox      ;14000;846  ;6500 ;423  ;FontSize=9;
                                                             SourceExpr=ContAddr[3][3] }
                { 36  ;TextBox      ;14000;1269 ;6500 ;423  ;FontSize=9;
                                                             SourceExpr=ContAddr[3][4] }
                { 67  ;TextBox      ;14000;1692 ;6500 ;423  ;FontSize=9;
                                                             SourceExpr=ContAddr[3][5] }
                { 68  ;TextBox      ;14000;2115 ;6500 ;423  ;FontSize=9;
                                                             SourceExpr=ContAddr[3][6] }
                { 69  ;TextBox      ;14000;2538 ;6500 ;423  ;FontSize=9;
                                                             SourceExpr=ContAddr[3][7] }
                { 70  ;TextBox      ;0    ;0    ;6500 ;423  ;FontSize=9;
                                                             SourceExpr=ContAddr[1][1] }
                { 71  ;TextBox      ;7000 ;0    ;6500 ;423  ;FontSize=9;
                                                             SourceExpr=ContAddr[2][1] }
                { 72  ;TextBox      ;14000;0    ;6500 ;423  ;FontSize=9;
                                                             SourceExpr=ContAddr[3][1] }
              }
               }
            { PROPERTIES
              {
                SectionType=Body;
                SectionWidth=20500;
                SectionHeight=3600;
                KeepWithNext=No;
                OnPreSection=BEGIN
                               CurrReport.SHOWOUTPUT((ColumnNo = 0) AND (LabelFormat = LabelFormat::"36 x 105 mm (2 columns)"));
                             END;
    
              }
              CONTROLS
              {
                { 37  ;TextBox      ;0    ;0    ;10000;423  ;FontSize=9;
                                                             SourceExpr=ContAddr[1][1] }
                { 38  ;TextBox      ;0    ;423  ;10000;423  ;FontSize=9;
                                                             SourceExpr=ContAddr[1][2] }
                { 39  ;TextBox      ;0    ;846  ;10000;423  ;FontSize=9;
                                                             SourceExpr=ContAddr[1][3] }
                { 40  ;TextBox      ;0    ;1269 ;10000;423  ;FontSize=9;
                                                             SourceExpr=ContAddr[1][4] }
                { 41  ;TextBox      ;0    ;1692 ;10000;423  ;FontSize=9;
                                                             SourceExpr=ContAddr[1][5] }
                { 42  ;TextBox      ;0    ;2115 ;10000;423  ;FontSize=9;
                                                             SourceExpr=ContAddr[1][6] }
                { 43  ;TextBox      ;10500;0    ;10000;423  ;FontSize=9;
                                                             SourceExpr=ContAddr[2][1] }
                { 44  ;TextBox      ;10500;423  ;10000;423  ;FontSize=9;
                                                             SourceExpr=ContAddr[2][2] }
                { 45  ;TextBox      ;10500;846  ;10000;423  ;FontSize=9;
                                                             SourceExpr=ContAddr[2][3] }
                { 46  ;TextBox      ;10500;1269 ;10000;423  ;FontSize=9;
                                                             SourceExpr=ContAddr[2][4] }
                { 47  ;TextBox      ;10500;1692 ;10000;423  ;FontSize=9;
                                                             SourceExpr=ContAddr[2][5] }
                { 48  ;TextBox      ;10500;2115 ;10000;423  ;FontSize=9;
                                                             SourceExpr=ContAddr[2][6] }
                { 73  ;TextBox      ;0    ;2538 ;10000;423  ;FontSize=9;
                                                             SourceExpr=ContAddr[1][7] }
                { 74  ;TextBox      ;0    ;2961 ;10000;423  ;FontSize=9;
                                                             SourceExpr=ContAddr[1][8] }
                { 75  ;TextBox      ;10500;2538 ;10000;423  ;FontSize=9;
                                                             SourceExpr=ContAddr[2][7] }
                { 76  ;TextBox      ;10500;2961 ;10000;423  ;FontSize=9;
                                                             SourceExpr=ContAddr[2][8] }
              }
               }
            { PROPERTIES
              {
                SectionType=Body;
                SectionWidth=20500;
                SectionHeight=3700;
                KeepWithNext=No;
                OnPreSection=BEGIN
                               CurrReport.SHOWOUTPUT((ColumnNo = 0) AND (LabelFormat = LabelFormat::"37 x 105 mm (2 columns)"));
                             END;
    
              }
              CONTROLS
              {
                { 77  ;TextBox      ;10500;2961 ;10000;423  ;FontSize=9;
                                                             SourceExpr=ContAddr[2][8] }
                { 78  ;TextBox      ;0    ;2961 ;10000;423  ;FontSize=9;
                                                             SourceExpr=ContAddr[1][8] }
                { 79  ;TextBox      ;0    ;2538 ;10000;423  ;FontSize=9;
                                                             SourceExpr=ContAddr[1][7] }
                { 80  ;TextBox      ;0    ;2115 ;10000;423  ;FontSize=9;
                                                             SourceExpr=ContAddr[1][6] }
                { 81  ;TextBox      ;0    ;1692 ;10000;423  ;FontSize=9;
                                                             SourceExpr=ContAddr[1][5] }
                { 82  ;TextBox      ;0    ;1269 ;10000;423  ;FontSize=9;
                                                             SourceExpr=ContAddr[1][4] }
                { 83  ;TextBox      ;10500;1269 ;10000;423  ;FontSize=9;
                                                             SourceExpr=ContAddr[2][4] }
                { 84  ;TextBox      ;10500;1692 ;10000;423  ;FontSize=9;
                                                             SourceExpr=ContAddr[2][5] }
                { 85  ;TextBox      ;10500;2115 ;10000;423  ;FontSize=9;
                                                             SourceExpr=ContAddr[2][6] }
                { 86  ;TextBox      ;10500;2538 ;10000;423  ;FontSize=9;
                                                             SourceExpr=ContAddr[2][7] }
                { 87  ;TextBox      ;0    ;846  ;10000;423  ;FontSize=9;
                                                             SourceExpr=ContAddr[1][3] }
                { 88  ;TextBox      ;10500;846  ;10000;423  ;FontSize=9;
                                                             SourceExpr=ContAddr[2][3] }
                { 89  ;TextBox      ;0    ;423  ;10000;423  ;FontSize=9;
                                                             SourceExpr=ContAddr[1][2] }
                { 90  ;TextBox      ;10500;423  ;10000;423  ;FontSize=9;
                                                             SourceExpr=ContAddr[2][2] }
                { 91  ;TextBox      ;0    ;0    ;10000;423  ;FontSize=9;
                                                             SourceExpr=ContAddr[1][1] }
                { 92  ;TextBox      ;10500;0    ;10000;423  ;FontSize=9;
                                                             SourceExpr=ContAddr[2][1] }
              }
               }
          }
           }
        { PROPERTIES
          {
            DataItemIndent=1;
            DataItemTable=Table5056;
            ReqFilterFields=Mailing Group Code;
            DataItemLink=Contact No.=FIELD(No.);
          }
          SECTIONS
          {
          }
           }
      }
      REQUESTFORM
      {
        PROPERTIES
        {
          Width=7260;
          Height=2090;
          SaveValues=Yes;
        }
        CONTROLS
        {
          { 1   ;OptionButton ;3410 ;0    ;3850 ;440  ;CaptionML=[ENU=36 x 70 mm (3 columns);
                                                                  ESM=36 x 70 mm (3 columns);
                                                                  FRC=36 x 70 mm (3 colonnes);
                                                                  ENC=36 x 70 mm (3 columns)];
                                                       SourceExpr=LabelFormat;
                                                       OptionValue=36 x 70 mm (3 columns) }
          { 21  ;Label        ;0    ;0    ;3300 ;440  ;ParentControl=1;
                                                       CaptionML=[ENU=Format;
                                                                  ESM=Formato;
                                                                  FRC=Format;
                                                                  ENC=Format] }
          { 2   ;OptionButton ;3410 ;550  ;3850 ;440  ;CaptionML=[ENU=37 x 70 mm (3 columns);
                                                                  ESM=37 x 70 mm (3 columns);
                                                                  FRC=37 x 70 mm (3 colonnes);
                                                                  ENC=37 x 70 mm (3 columns)];
                                                       SourceExpr=LabelFormat;
                                                       OptionValue=37 x 70 mm (3 columns) }
          { 3   ;OptionButton ;3410 ;1100 ;3850 ;440  ;CaptionML=[ENU=36 x 105 mm (2 columns);
                                                                  ESM=36 x 105 mm (2 columns);
                                                                  FRC=36 x 105 mm (2 colonnes);
                                                                  ENC=36 x 105 mm (2 columns)];
                                                       SourceExpr=LabelFormat;
                                                       OptionValue=36 x 105 mm (2 columns) }
          { 4   ;OptionButton ;3410 ;1650 ;3850 ;440  ;CaptionML=[ENU=37 x 105 mm (2 columns);
                                                                  ESM=37 x 105 mm (2 columns);
                                                                  FRC=37 x 105 mm (2 colonnes);
                                                                  ENC=37 x 105 mm (2 columns)];
                                                       SourceExpr=LabelFormat;
                                                       OptionValue=37 x 105 mm (2 columns) }
        }
      }
      CODE
      {
        VAR
          LabelFormat@1000 : '36 x 70 mm (3 columns),37 x 70 mm (3 columns),36 x 105 mm (2 columns),37 x 105 mm (2 columns)';
          ContAddr@1001 : ARRAY [3,8] OF Text[50];
          NoOfRecords@1002 : Integer;
          RecordNo@1003 : Integer;
          NoOfColumns@1004 : Integer;
          ColumnNo@1005 : Integer;
          i@1006 : Integer;
          FormatAddr@1007 : Codeunit 365;
    
        BEGIN
        END.
      }
    }
    
    
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
  • neckitneckit Member Posts: 24
    Thank you "ara3n" for yor quick replie!

    First i have test the report, it seems to be fine.
    But when I see at the printed lables, there are some failures and problems

    1. All labes belongs to the selected "Mailing Group", but not the first label. It has no Mailing Group.

    2. When I have 5 contacts with the selected Mailing Group, it prints 6 contacts (5 + the first contact - which not belongs to the Mailing Group).
    When i have 6 or 7 contacts with the selected Mailing Group, it also prints only 6 labels. By 8 contacts, he prints 9 labels.
    I Think this is, because there are 3 labels in a row and we have set the setting "PrintOnlyIfDetail = YES".

    3. The selected filter is saved. Now when the user wants to print other labes (not filtered bei Mailing Group) he forgot to delete the filter.
    Can I delete the choosen filters by code?

    4. If I also want to use for example "Business Relation" and "Industry Group", I must set the Filter to a non existing value, when i only want to print the contacts of a specific "Mailing Group".
    Do you have any solution for this?

    Thanks very much for your help.
  • ara3nara3n Member Posts: 9,258
    Contact your Solution Center to give you a quote? :wink:
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
Sign In or Register to comment.