Anveo Mobile App / Best Practices / How to Deal with FlowFields

How to Deal with FlowFields

The calculation of FlowFields takes a lot of time in Dynamics, so you cannot update all FlowFields every time you synchronize. It is also not recommended to run RECALCFIELDS after each posting routine. This would result in a long synchronization process which is not good for the user experience. There are other options available for FlowFields.

Nightly Recalculation of FlowFields

We recommend to create a new, normal field in your Dynamics table that stores the value you want to send to the user. In a nightly task you recalculate the FlowField. If the value has changed, update your new field and do a ”MODIFY”. This sigificantly reduces data traffic.

Use of an Online Fields

You may also use online fields Online Fields to display the value of FlowField. The field value will be automatically updated in the app independent of synchronization. Read more about Online Fields and how to set them up here.

Request a Recalculation

Sometimes it is required to have live data available. In this case, you can request a resend of FlowField data. Of course, an online connection is required to do so. First step is to provide a button in your user interface with an Action Code that marks your FlowField. A synchronization will be started immediately.

Rec:SETVALUE('Inventory', Rec:GETVALUE('Inventory'));
Rec:MODFIY(TRUE);
SYNC_DB();
Anveo Script Code example to mark FlowField Inventory of table Item.

Next time you synchronize, you can do the recalulation in codeunit ACF App Events.

CASE RecRef.NUMBER OF
// Other code here ...
DATABASE::Item: BEGIN
DeviceRecRef.SETTABLE(DeviceItem);
IF (DeviceFldRef.NUMBER = DeviceItem.FIELDNO(Inventory)) THEN BEGIN
//Recalculate FlowFields for this item
Item.SETRANGE("No.", DeviceItem."No.");
ItemRecRef.GETTABLE(Item);
Mgt.RECALCFIELDS(ItemRecRef);
// Do not change the current value "Inventory"
NAVAction := NAVAction::Ignore;
END;
END;
END;
C/AL Code example to recalculate FlowField Inventory of table item.