Tuesday, 10 November 2015

Show Hide Fields based on condition

the visibility property will work on Groups.

As per your requirement, set 1-8 fields in Group1 and 9-15 in Group2.

Create a Boolean(IsgrpVisible) variable and set IncludeInDataset to Yes

Write IsgrpVisible = (your condition) in OnOpenPage() and OnAfterGetRecord()

Set Group Visible = IsgrpVisible

It will work while moving through the records by clicking the "next record" action from the action menu.

If you want it in field wise in same group, you can assign boolean variable to visible property of field but
 it will work only you open the Record not while moving through the records by clicking the "next record" action
 from the action menu

OBJECT Page 50000 Resource Card 2
{
  OBJECT-PROPERTIES
  {
    Date=04/28/10;
    Time=10:01:15 AM;
    Modified=Yes;
    Version List=CUS01;
  }
  PROPERTIES
  {
    SourceTable=Table156;
    PageType=Card;
    OnAfterGetRecord=BEGIN
                       IsCityVisible := (Type = Type::Person);
                     END;

  }
  CONTROLS
  {
    { 1100495000;0;Container;
                ContainerType=ContentArea }

    { 1100495001;1;Group  ;
                Name=General;
                GroupType=Group }

    { 1100495002;2;Field  ;
                SourceExpr="No." }

    { 1100495003;2;Field  ;
                SourceExpr=Type;
                OnValidate=BEGIN
                             IsCityVisible := (Type = Type::Person);
                           END;
                            }

    { 1100495004;2;Field  ;
                SourceExpr=Name }

    { 1100495005;2;Field  ;
                SourceExpr="Search Name" }

    { 1100495008;2;Field  ;
                SourceExpr=City;
                Visible=IsCityVisible }

    { 1100495007;1;Group  ;
                CaptionML=ENU=City;
                Visible=IsCityVisible;
                GroupType=Group }

    { 1100495006;2;Field  ;
                SourceExpr=City }

  }
  CODE
  {
    VAR
      IsCityVisible@1100495000 : Boolean INDATASET;

    BEGIN
    END.
  }
}

No comments:

Post a Comment