Quick question, why this doesn't work?? No matter how many times I change MyOption field's value, FieldH,V and F are never visible. BC 21.1 environment.
pageextension 50004 "Custom Item card" extends "Item Card"
{
layout
{
addafter(VariantMandatoryDefaultNo)
{
field(MyOption; Rec.MyOption) //This is an Option type field in my Item table
{
ApplicationArea = Basic, Suite;
}
field("FieldH"; Rec."FieldH")
{
ApplicationArea = Basic, Suite;
Visible = Rec.MyOption= Rec.MyOption::"1 Eje"; //Tried with a specific Option value, but still not working
}
field("FieldV"; Rec."FieldV")
{
ApplicationArea = Basic, Suite;
Visible = Rec.MyOption> 1; //This is what I actually need to achieve
}
field("FieldF"; Rec."FieldF")
{
ApplicationArea = Basic, Suite;
Visible = Rec.MyOption> 2;
}
}
}
}
Hi
you must value your control variables in the OnAfterGetRecord() trigger of the page
DAniele
ZHU, this post has helped me numerous times, so thanks very much!
Hi, hope the following helps.
Dynamic Visibility of Controls (Hide and show fields dynamically)
Thanks.
ZHU
Hi,
You can try as per below
pageextension 50004 "Custom Item card" extends "Item Card"
{
layout
{
addafter(VariantMandatoryDefaultNo)
{
field(MyOption; Rec.MyOption) //This is an Option type field in my Item table
{
ApplicationArea = Basic, Suite;
}
field("FieldH"; Rec."FieldH")
{
ApplicationArea = Basic, Suite;
Visible = VisibleControl; //Tried with a specific Option value, but still not working
}
field("FieldV"; Rec."FieldV")
{
ApplicationArea = Basic, Suite;
Visible = VisibleControl2; //This is what I actually need to achieve
}
field("FieldF"; Rec."FieldF")
{
ApplicationArea = Basic, Suite;
Visible = VisibleControl3;
}
}
}
trigger OnAfterGetRecord()
begin
VisibleControl2 := Rec.MyOption > 1;
VisibleControl := Rec.MyOption = Rec.MyOption::"1 Eje";
VisibleControl3 := Rec.MyOption > 2;
end;
var
VisibleControl: Boolean;
VisibleControl2: Boolean;
VisibleControl3: Boolean;
}
|
Yes, you have to put each and every field in a separate group. Because this is the only way to Dynamically Hide and Unhide the field.
Actually visibility conditions are different for each field. If this is the case, I will need to create one group per field. Was wondering if there was any way to avoid that.
Hello Ghetz,
You need to put all the fields inside the group to which you want to hide or unhide and give visibility property to the group.
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 291,253 Super User 2024 Season 2
Martin Dráb 230,188 Most Valuable Professional
nmaenpaa 101,156