31

There are no function on RecordRef that corresponds to Record.SetAutoCalcFields()


If we want to loop a RecordRef with a FlowField or Blob field that we need the value for each record, we have to call FieldRef.CalcField() for each record, which is very bad for performance.


Current way:

        FldRef := RecRef.Field(MyFieldNo);
        FldRef2 := RecRef.Field(MyFieldNo2);
        if RecRef.FindSet() then
            repeat
                FldRef.CalcField();
                FldRef2.CalcField();
                // Do something with FldRef.Value() and FldRef2.Value()
            until RecRef.Next() = 0;


I would like a SetAutoCalcField() function that could be used like this:

        FldRef := RecRef.Field(MyFieldNo);
        FldRef2 := RecRef.Field(MyFieldNo2);
        RecRef.SetAutoCalcField(MyFieldNo);
        RecRef.SetAutoCalcField(MyFieldNo2);
        if RecRef.FindSet() then
            repeat
                // Do something with FldRef.Value() and FldRef2.Value()
            until RecRef.Next() = 0;


The syntax could be like this:

[Ok := ] RecordRef.SetAutoCalcField(FieldNo: Integer)

And the function needs to be called once for each field to auto calculate.

Category: Development
STATUS DETAILS
Needs Votes
Ideas Administrator

Thank you for this suggestion! Currently this is not on our roadmap. We are tracking this idea and if it gathers more votes and comments we will consider it in the future. Best regards, Business Central Team