Skip to content

"Array access is not valid for client expressions", page fields #26260

@navdotnetreqs

Description

@navdotnetreqs

Describe the request

To be able to create at least somewhat generic lists without hundreds of copypasted lines and variables, we would need to be able to have array access in client expressions. Is there a specific reason this works:

field(Col1; Col[1])
  {
      CaptionClass = '3,' + GetColumnHeading(LeftMostColumn + 1);
      ToolTip = '-', Locked = true;
      Visible = MaxColumns >= 1;
  }

but this (array access) does not?

field(Col1; Col[1])
  {
      CaptionClass = '3,' + GetColumnHeading(LeftMostColumn + 1);
      ToolTip = '-', Locked = true;
      StyleExpression = FieldValidated[1];
  }

If the caption can be fetched from a function during runtime, and properties such as visibility, style, enabled, can be evaluated from a boolean OR expression, why could they not be taken from an array?

It would be great to have this for all the modifiable page field properties.

An array we can handle reasonably in a loop, even if we couldn't use a function directly

  trigger OnAfterGetRecord()
  var
      i: Integer;
  begin
      for i := 1 to PAGEMAXCOLUMNS - 1 do
          FieldValidated[1] := GetFieldValidated(i);
  end;

Additional context

Generic code with a loop instead of copypasting hundreds of lines and tens of variables improves quality, makes for better maintainability and readability etc. and this would also make BC a better platform for new solutions.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions