Does anyone know of a valid reason why I seem to be unable to use a Function as a Visible/Editable/Enabled Property Value ?
The value is a "TRUE/FALSE" string, expects a Boolean.. An [InDataSet] global Boolean isn't a problem, but a function isn't allowed ?
While the CaptionClass property has no issue with using a Function as Property Value.
group(StandardBanner)
{
Visible = (GetControlProperty(Properties::Visible, Identifiers::Step, Step::Two));
// Some Fields Here ....
}local procedure GetControlProperty(Property: Integer; Identifier: Integer; Context: Integer): Boolean
begin
case (Property) of
Properties::Visible: begin
exit(Step = Context);
end;
Properties::Editable: begin
exit(Step = Context);
end;
Properties::Enabled: begin
exit(Step = Context);
end;
end;
end;
AL is perfectly Valid, same for C/AL..
However, when running the Page it throws:
I would prefer not having to resort to creating a 1000 IncludeInDataset global Booleans for the Wizard Steps..
Using a function to control the Visible/Editable/Enabled property would be ideal.
Anyone have an idea whether I'm doing something wrong, or why this doesn't work ?
Answers
However, the CaptionClass property does not share this problem ?
That property can use a Function without any issue..
The code for this as-well is Server-Side while the Control is Rendered Client-Side.
Visible/Editable/Enables properties used at each redraw of the Page, so indeed are running Client-Side and there-for require a Client-Side Variable.
You are a 100% correct lubost. At render of a Control it cannot access the Function.
Perhaps Microsoft will fix this with Magic towards the future, or have the Compiler throw this setup as Invalid.
Case Closed, thanks for your feedback !