web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Small and medium business | Business Central, N...
Answered

Flowfield and CalcFormula

(0) ShareShare
ReportReport
Posted on by 116

Hi,

I want to add a new flow field to my item table that shows the available quantity on each item based on the Inventory and the allocated quantity.

The formula cannot be any simpler available = inventory - allocated.

Is it possible to do this?

Thanks

Yann

I have the same question (0)
  • Verified answer
    yannstlo Profile Picture
    116 on at
    RE: Flowfield and CalcFormula

    This looks like it might be the only option. Not the most elegant as the user has to press an update button but would certainly work...

  • yannstlo Profile Picture
    116 on at
    RE: Flowfield and CalcFormula

    This is the way I had it setup originally but the web interface will not let you filter or order on the field if it is not from the table.

  • Suggested answer
    ArturV Profile Picture
    225 on at
    RE: Flowfield and CalcFormula

    I think you can do it in this way (a bit awkward way but it should work)

    1. Add a new field in the table.

    2. Write the same function GetAvailableQty that returns the value you need.

    3. Write an additional function in the separate codeunit and call it something like UpdateAvailableQtyAllItems.

    In this function you can iterate through all the items, call the GetAvailableQty function and assign the result to the new field:

    If Item.FINDSET then

     REPEAT

       Item."New Field" := Item.GetAvailableQty;

       Item.Modify;

     UNTIL Item.Next = 0;

    4. Add an action to the Item List so every user can press and update the value in this field. When user press it, the function UpdateAvailableQtyAllItems will be called.

    In this case you have a field, it is shown on the page and you can make filters. I'd not recommend to call this function to OnOpenPage trigger of ItemList page due to performance reason.

  • Suggested answer
    Binesh Profile Picture
    7,885 on at
    RE: Flowfield and CalcFormula

    Hello,

    As other members said, there is no direct way and FlowField for this requirement.

    you have to write the function and call it in your page, for example see the below code

    Change the function as per your requirement.

    pastedimage1592421263219v1.png

    pastedimage1592421306309v2.png

  • yannstlo Profile Picture
    116 on at
    RE: Flowfield and CalcFormula

    Nice solution but I don't believe the SourceExpr is available on a field added to a Table Extension.

    Also, On my page extension, I had a Global field called Available that I added which would calculate onaftergetrecord but because it is not a table field, I cannot sort or filter on that field in the page.

    This is why I'm trying to add the field to the table.

    Thanks

  • Suggested answer
    ArturV Profile Picture
    225 on at
    RE: Flowfield and CalcFormula

    No, you cannot do any kind of math operations in the FlowFormula, only take the value from the specific table by filters.

    However, you can add a function in the Item table:

    function GetAvailableQty : Decimal

    ..

    Write your code here and return the decimal value

    ...

    Then you can add a field on the page and use GetAvailableQty function as SourceExpr.

    Let me know if it does or does not work for you.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Andrés Arias – Community Spotlight

We are honored to recognize Andrés Arias as our Community Spotlight honoree for…

Leaderboard > Small and medium business | Business Central, NAV, RMS

#1
Sumit Singh Profile Picture

Sumit Singh 2,708

#2
Sohail Ahmed Profile Picture

Sohail Ahmed 2,675 Super User 2025 Season 2

#3
Jeffrey Bulanadi Profile Picture

Jeffrey Bulanadi 2,203

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans