Dynamically change fields properties in report

SYLV1GSYLV1G Member Posts: 93
Hello

Can anybody tell me if it is possible to change dynamically the FontBold (for exemple) property of a control in a report ?
I would like to print several lines in a section and each ligne may be printed with bold, italic... or not

Thanks in advance

Comments

  • zimiwingszimiwings Member Posts: 20
    No, not possible.

    You can find some suggestions here: http://www.mbsonline.org/forum/topic.asp?TOPIC_ID=15399
    Daniel Zimmermann
  • vmouwenvmouwen Member Posts: 1
    Hello,

    I have the same question now 3.5 years later. Is it still not posseble?

    One of my sources is a boolean. If the boolean is true the data in the textbox must be bold. Unfortunatly the suggestion link is not working any more :(
    Vincent Mouwen
    Apps manager of Pondres Direct mail B.V.
  • MBergerMBerger Member Posts: 413
    vmouwen wrote:
    Hello,

    I have the same question now 3.5 years later. Is it still not posseble?

    One of my sources is a boolean. If the boolean is true the data in the textbox must be bold. Unfortunatly the suggestion link is not working any more :(
    No, it's still not possible. You'll have to make 2 sections, one normal one bold, and hide/show them according to your boolean value.
  • David_SingletonDavid_Singleton Member Posts: 5,479
    In RTC you can do this on SQL reporting.
    David Singleton
  • garakgarak Member Posts: 3,263
    only possible wit "Reporting Service" (SQL report) or with separate Sections.
    Do you make it right, it works too!
  • David_SingletonDavid_Singleton Member Posts: 5,479
    garak wrote:
    only possible wit "Reporting Service" (SQL report) or with separate Sections.

    That's not true [-X , and in fact creating new sections is a lot of work especially to maintain.

    For sure there are other option, for example you can have Bold and non bold controls in the same section and just print the one you want. This is especially important if say you have three different fields that might be bold or normal depending on conditions. In your scenario with sections, you would need to maintain EIGHT sections just to handle three fields.
    David Singleton
  • garakgarak Member Posts: 3,263
    Whats the problem, for his case with one Bool Field, to create two section?


    XYZ, Body (1) - OnPreSection()
    CurrReport.showoutput(BoolField)

    XYZ, Body (2) - OnPreSection()
    CurrReport.showoutput(not BoolField)

    ?

    I agree, if you have a lot of bool fields that's looks like a "De Morgan" table, it's a hard work to do.
    Do you make it right, it works too!
  • David_SingletonDavid_Singleton Member Posts: 5,479
    You said that those are the ONLY options, I am jsut saying that there are more.
    David Singleton
  • garakgarak Member Posts: 3,263
    You said that those are the ONLY options, I am jsut saying that there are more.

    ok, then you're right
    Do you make it right, it works too!
  • darrinkatzdarrinkatz Member Posts: 24
    For sure there are other option, for example you can have Bold and non bold controls in the same section and just print the one you want.

    Hi David,

    Would you willing to explain how to do this in Dynamics NAV 5.0, please? I would like to avoid separate sections if at all possible.

    I sincerely appreciate your time.

    Regards,
    Darrin
  • David_SingletonDavid_Singleton Member Posts: 5,479
    darrinkatz wrote:
    For sure there are other option, for example you can have Bold and non bold controls in the same section and just print the one you want.

    Hi David,

    Would you willing to explain how to do this in Dynamics NAV 5.0, please? I would like to avoid separate sections if at all possible.

    I sincerely appreciate your time.

    Regards,
    Darrin

    I uploaded a sample report in the Download section, but I guess it takes a while to be visible.
    For now here is the code.... The FOB is probably easier though.
    OBJECT Report 50099 Bold Fields on report
    {
      OBJECT-PROPERTIES
      {
        Date=08/17/09;
        Time=[ 7:49:02 PM];
        Modified=Yes;
        Version List=;
      }
      PROPERTIES
      {
      }
      DATAITEMS
      {
        { PROPERTIES
          {
            DataItemTable=Table27;
            OnAfterGetRecord=BEGIN
                               CALCFIELDS(Inventory,"Qty. on Purch. Order");
    
                               IF Inventory < 100 THEN BEGIN
                                 QtyOnHand := '';
                                 QtyOnHandBold := FORMAT(Inventory);
                               END ELSE BEGIN
                                 QtyOnHand := FORMAT(Inventory);
                                 QtyOnHandBold := '';
                               END;
                               IF "Qty. on Purch. Order" < 100 THEN BEGIN
                                 QtyOnPO := '';
                                 QtyOnPOBold := FORMAT("Qty. on Purch. Order");
                               END ELSE BEGIN
                                 QtyOnPO := FORMAT("Qty. on Purch. Order");
                                 QtyOnPOBold := '';
                               END;
                               IF  "Costing Method" = "Costing Method"::FIFO THEN BEGIN
                                 Costing := '';
                                 CostingBold := FORMAT("Costing Method");
                               END ELSE BEGIN
                                 Costing := FORMAT("Costing Method");
                                 CostingBold := '';
                               END;
                             END;
    
            ReqFilterFields=No.;
            GroupTotalFields=No.;
          }
          SECTIONS
          {
            { PROPERTIES
              {
                SectionType=Header;
                PrintOnEveryPage=Yes;
                SectionWidth=18150;
                SectionHeight=1692;
              }
              CONTROLS
              {
                { 1000000001;Label  ;0    ;0    ;7500 ;423  ;FontSize=8;
                                                             FontBold=Yes;
                                                             CaptionML=ENU=Item }
                { 1000000002;TextBox;15000;0    ;3150 ;423  ;HorzAlign=Right;
                                                             SourceExpr=FORMAT(TODAY,0,4) }
                { 1000000003;TextBox;0    ;423  ;7500 ;423  ;SourceExpr=COMPANYNAME }
                { 1000000004;TextBox;17700;423  ;450  ;423  ;CaptionML=ENU=Page;
                                                             SourceExpr=CurrReport.PAGENO }
                { 1000000005;Label  ;16950;423  ;750  ;423  ;ParentControl=1000000004 }
                { 1000000006;TextBox;15900;846  ;2250 ;423  ;HorzAlign=Right;
                                                             SourceExpr=USERID }
              }
               }
            { PROPERTIES
              {
                SectionType=Header;
                PrintOnEveryPage=Yes;
                SectionWidth=18150;
                SectionHeight=1269;
              }
              CONTROLS
              {
                { 1000000009;Label  ;0    ;0    ;1500 ;846  ;ParentControl=1000000008;
                                                             VertAlign=Bottom;
                                                             FontBold=Yes;
                                                             MultiLine=Yes }
                { 1000000012;Label  ;1650 ;0    ;4500 ;846  ;ParentControl=1000000011;
                                                             VertAlign=Bottom;
                                                             FontBold=Yes;
                                                             MultiLine=Yes }
                { 1000000015;Label  ;6300 ;0    ;2250 ;846  ;ParentControl=1000000014;
                                                             VertAlign=Bottom;
                                                             FontBold=Yes;
                                                             MultiLine=Yes }
                { 1000000018;Label  ;8700 ;0    ;1800 ;846  ;ParentControl=1000000017;
                                                             VertAlign=Bottom;
                                                             FontBold=Yes;
                                                             MultiLine=Yes }
                { 1000000021;Label  ;10650;0    ;1800 ;846  ;ParentControl=1000000020;
                                                             VertAlign=Bottom;
                                                             FontBold=Yes;
                                                             MultiLine=Yes }
              }
               }
            { PROPERTIES
              {
                SectionType=Body;
                SectionWidth=18150;
                SectionHeight=423;
              }
              CONTROLS
              {
                { 1000000008;TextBox;0    ;0    ;1500 ;423  ;HorzAlign=Left;
                                                             SourceExpr="No." }
                { 1000000011;TextBox;1650 ;0    ;4500 ;423  ;HorzAlign=Left;
                                                             SourceExpr=Description }
                { 1000000014;TextBox;6300 ;0    ;2250 ;423  ;HorzAlign=Left;
                                                             FontSize=8;
                                                             SourceExpr=Costing }
                { 1000000017;TextBox;8700 ;0    ;1800 ;423  ;HorzAlign=Right;
                                                             FontSize=8;
                                                             SourceExpr=QtyOnHand }
                { 1000000020;TextBox;10650;0    ;1800 ;423  ;HorzAlign=Right;
                                                             FontSize=8;
                                                             SourceExpr=QtyOnPO }
                { 1000000000;TextBox;10650;0    ;1800 ;423  ;HorzAlign=Right;
                                                             FontSize=9;
                                                             FontBold=Yes;
                                                             FontUnderline=Yes;
                                                             SourceExpr=QtyOnPOBold }
                { 1000000007;TextBox;8700 ;0    ;1800 ;423  ;HorzAlign=Right;
                                                             FontSize=8;
                                                             FontBold=Yes;
                                                             FontUnderline=Yes;
                                                             SourceExpr=QtyOnHandBold }
                { 1000000010;TextBox;6300 ;0    ;2250 ;423  ;HorzAlign=Left;
                                                             FontSize=8;
                                                             FontBold=Yes;
                                                             FontUnderline=Yes;
                                                             SourceExpr=CostingBold }
              }
               }
          }
           }
      }
      REQUESTFORM
      {
        PROPERTIES
        {
          Width=9020;
          Height=3410;
        }
        CONTROLS
        {
        }
      }
      CODE
      {
        VAR
          QtyOnHand@1000000000 : Text[30];
          QtyOnHandBold@1000000003 : Text[30];
          QtyOnPO@1000000001 : Text[30];
          QtyOnPOBold@1000000002 : Text[30];
          Costing@1000000004 : Text[30];
          CostingBold@1000000005 : Text[30];
    
        BEGIN
        END.
      }
    }
    
    
    David Singleton
  • darrinkatzdarrinkatz Member Posts: 24
    darrinkatz wrote:
    For sure there are other option, for example you can have Bold and non bold controls in the same section and just print the one you want.

    Hi David,

    Would you willing to explain how to do this in Dynamics NAV 5.0, please? I would like to avoid separate sections if at all possible.

    I sincerely appreciate your time.

    Regards,
    Darrin

    I uploaded a sample report in the Download section, but I guess it takes a while to be visible.
    For now here is the code.... The FOB is probably easier though.
    OBJECT Report 50099 Bold Fields on report
    {
      OBJECT-PROPERTIES
      {
        Date=08/17/09;
        Time=[ 7:49:02 PM];
        Modified=Yes;
        Version List=;
      }
      PROPERTIES
      {
      }
      DATAITEMS
      {
        { PROPERTIES
          {
            DataItemTable=Table27;
            OnAfterGetRecord=BEGIN
                               CALCFIELDS(Inventory,"Qty. on Purch. Order");
    
                               IF Inventory < 100 THEN BEGIN
                                 QtyOnHand := '';
                                 QtyOnHandBold := FORMAT(Inventory);
                               END ELSE BEGIN
                                 QtyOnHand := FORMAT(Inventory);
                                 QtyOnHandBold := '';
                               END;
                               IF "Qty. on Purch. Order" < 100 THEN BEGIN
                                 QtyOnPO := '';
                                 QtyOnPOBold := FORMAT("Qty. on Purch. Order");
                               END ELSE BEGIN
                                 QtyOnPO := FORMAT("Qty. on Purch. Order");
                                 QtyOnPOBold := '';
                               END;
                               IF  "Costing Method" = "Costing Method"::FIFO THEN BEGIN
                                 Costing := '';
                                 CostingBold := FORMAT("Costing Method");
                               END ELSE BEGIN
                                 Costing := FORMAT("Costing Method");
                                 CostingBold := '';
                               END;
                             END;
    
            ReqFilterFields=No.;
            GroupTotalFields=No.;
          }
          SECTIONS
          {
            { PROPERTIES
              {
                SectionType=Header;
                PrintOnEveryPage=Yes;
                SectionWidth=18150;
                SectionHeight=1692;
              }
              CONTROLS
              {
                { 1000000001;Label  ;0    ;0    ;7500 ;423  ;FontSize=8;
                                                             FontBold=Yes;
                                                             CaptionML=ENU=Item }
                { 1000000002;TextBox;15000;0    ;3150 ;423  ;HorzAlign=Right;
                                                             SourceExpr=FORMAT(TODAY,0,4) }
                { 1000000003;TextBox;0    ;423  ;7500 ;423  ;SourceExpr=COMPANYNAME }
                { 1000000004;TextBox;17700;423  ;450  ;423  ;CaptionML=ENU=Page;
                                                             SourceExpr=CurrReport.PAGENO }
                { 1000000005;Label  ;16950;423  ;750  ;423  ;ParentControl=1000000004 }
                { 1000000006;TextBox;15900;846  ;2250 ;423  ;HorzAlign=Right;
                                                             SourceExpr=USERID }
              }
               }
            { PROPERTIES
              {
                SectionType=Header;
                PrintOnEveryPage=Yes;
                SectionWidth=18150;
                SectionHeight=1269;
              }
              CONTROLS
              {
                { 1000000009;Label  ;0    ;0    ;1500 ;846  ;ParentControl=1000000008;
                                                             VertAlign=Bottom;
                                                             FontBold=Yes;
                                                             MultiLine=Yes }
                { 1000000012;Label  ;1650 ;0    ;4500 ;846  ;ParentControl=1000000011;
                                                             VertAlign=Bottom;
                                                             FontBold=Yes;
                                                             MultiLine=Yes }
                { 1000000015;Label  ;6300 ;0    ;2250 ;846  ;ParentControl=1000000014;
                                                             VertAlign=Bottom;
                                                             FontBold=Yes;
                                                             MultiLine=Yes }
                { 1000000018;Label  ;8700 ;0    ;1800 ;846  ;ParentControl=1000000017;
                                                             VertAlign=Bottom;
                                                             FontBold=Yes;
                                                             MultiLine=Yes }
                { 1000000021;Label  ;10650;0    ;1800 ;846  ;ParentControl=1000000020;
                                                             VertAlign=Bottom;
                                                             FontBold=Yes;
                                                             MultiLine=Yes }
              }
               }
            { PROPERTIES
              {
                SectionType=Body;
                SectionWidth=18150;
                SectionHeight=423;
              }
              CONTROLS
              {
                { 1000000008;TextBox;0    ;0    ;1500 ;423  ;HorzAlign=Left;
                                                             SourceExpr="No." }
                { 1000000011;TextBox;1650 ;0    ;4500 ;423  ;HorzAlign=Left;
                                                             SourceExpr=Description }
                { 1000000014;TextBox;6300 ;0    ;2250 ;423  ;HorzAlign=Left;
                                                             FontSize=8;
                                                             SourceExpr=Costing }
                { 1000000017;TextBox;8700 ;0    ;1800 ;423  ;HorzAlign=Right;
                                                             FontSize=8;
                                                             SourceExpr=QtyOnHand }
                { 1000000020;TextBox;10650;0    ;1800 ;423  ;HorzAlign=Right;
                                                             FontSize=8;
                                                             SourceExpr=QtyOnPO }
                { 1000000000;TextBox;10650;0    ;1800 ;423  ;HorzAlign=Right;
                                                             FontSize=9;
                                                             FontBold=Yes;
                                                             FontUnderline=Yes;
                                                             SourceExpr=QtyOnPOBold }
                { 1000000007;TextBox;8700 ;0    ;1800 ;423  ;HorzAlign=Right;
                                                             FontSize=8;
                                                             FontBold=Yes;
                                                             FontUnderline=Yes;
                                                             SourceExpr=QtyOnHandBold }
                { 1000000010;TextBox;6300 ;0    ;2250 ;423  ;HorzAlign=Left;
                                                             FontSize=8;
                                                             FontBold=Yes;
                                                             FontUnderline=Yes;
                                                             SourceExpr=CostingBold }
              }
               }
          }
           }
      }
      REQUESTFORM
      {
        PROPERTIES
        {
          Width=9020;
          Height=3410;
        }
        CONTROLS
        {
        }
      }
      CODE
      {
        VAR
          QtyOnHand@1000000000 : Text[30];
          QtyOnHandBold@1000000003 : Text[30];
          QtyOnPO@1000000001 : Text[30];
          QtyOnPOBold@1000000002 : Text[30];
          Costing@1000000004 : Text[30];
          CostingBold@1000000005 : Text[30];
    
        BEGIN
        END.
      }
    }
    
    

    Hi David,

    Thanks for this. I see what you mean now.

    Regards,
    Darrin
  • David_SingletonDavid_Singleton Member Posts: 5,479
    I see its in the download section now.

    Print dynamically selected columns in bold on report
    David Singleton
Sign In or Register to comment.