Change behaviour of Validate of Sum-FlowField

einsTeIn.NETeinsTeIn.NET Member Posts: 1,050
Hi guys,

we all know about this little feature when you create a FlowField of Type Sum. It creates a new line in the "source table". The difference between the new value and the old value is entered in your "source field". All other fields are filled like defined in your Flow Field or by the default value of the field. But what to do when I want some fields to be filled by another value? Is it possible in any way to turn off the default behaviour of the Flow Field and let it still be editable?
"Money is likewise the greatest chance and the greatest scourge of mankind."

Comments

  • kinekine Member Posts: 12,562
    I am afraid that it is "out of control" and there will be not easy way to do that (if some at all). True is, that I never used this feature in my modifications.
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • DenSterDenSter Member Posts: 8,305
    The common way to turn it off is to make the flowfield not editable.
  • kinekine Member Posts: 12,562
    Yes, that's is what I do each time. But the question is how to "modify" the process, not how to disable it... 8)
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • DenSterDenSter Member Posts: 8,305
    Yeah I know.... my point is don't do it, leave it alone, it works the way it works. All you can do is set InitValues, which sets values automatically, but then the next step is that they'd want conditional values. The other thing could be to program the textbox to enter the new record...

    I would personally not even go there.
  • einsTeIn.NETeinsTeIn.NET Member Posts: 1,050
    Sorry for belated answer, I was one week off.

    Yeah, I see what you mean. Kamil catched exactly my point and I also thought like you, Daniel, it is possibly better to do not change the default behaviour. I agree, one workaround is to disable the field and use a TextBox Control on every form where you want to use it. But I don't like this way for several reasons, but mainly because it is attached to a form.

    InitValue isn't a solution in my opinion. It could be one in special situations when it's possible to use those init values any time. But maybe when you enter a new record by another way you don't want to use those init values.

    There is another solution, very similar to the InitValue solution. Validating the FlowField will validate all the fields that are given by the filter in CalcFormula. Thus it's possible to implement some logic in the OnValidate-Trigger of those fields. Take a look at Table Resource Field Capacity. When you enter a value into Capacity the Resource Group of the Resource is filled automatically. But here you have the same problem, what if you don't want the fields to be filled like this every time? And in some cases in OnValidates of the "Source Table" it isn't possible to calculate/find the right value for each field.

    So, which way would you go? Or is there even another possible way?
    "Money is likewise the greatest chance and the greatest scourge of mankind."
  • kinekine Member Posts: 12,562
    It is better to have the functionality fully under control, I will not alter the onvalidate just to cover this (you cannot know if it is "this" situation or another standard one, when someone entered the value into the fields). Creating own textbox and process the data there is much better.
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
Sign In or Register to comment.