a very simple question

Can i do calculations in flow field? For example i have a sum of values and i want to add a constant to them? Or is there any other easy way to, for example, have a field that is a duplicate of one of the fields, but there are some calculations in there. I.e. to show the approximate profit of sales in the inventory list?

I would use a function, rather than a flowfield. Add a global function to the table. In the Local Variables of the function set the Return Variable to, in this case, Decimal. You can now use the function like a field, except you don’t have drag-and-drop capabilities for adding it to forms. (Drag-and-drop another field, then change the Source Expression) I find these better than flow fields in some cases because controls based on flow fields don’t always update until you leave and re-enter the record. Controls based on functions update immeadiately. Also, in code, you don’t have to worry about doing a calcfields.

can i set a filter to such a ‘pseudo’-field ?

If it just just for display purposes, you can probably create a new control on a form, associated with a variable. This variable could be initialized with the value of an existing FlowField and you can do any kind of calculation with it. Ex: Form - OnAfterGetRecord() CALCFIELDS(Rec.MyFlowField); MyNewVar := (Rec.MyFlowField + MyConstant) * Risk Factor; You can even define a customized Drill-Down for this control.

Wow, that was easy, thnx Tom! Annar


Originally posted by h-d.neuenfeldt
can i set a filter to such a ‘pseudo’-field ?


I’ve never done it, but I don’t see any reason that you couldn’t reference any “Date Filter”, etc. fields and use the filters in your calculations/lookups within the code of the function. You could also combine David’s idea and mine: Add the flowfield, then add a function that uses the flowfield but adds additional logic. The filters will affect the flowfield which will affect the function return value. I prefer this to adding code to the form itself. Encapsulation, effectively.