Need Help to create a calculation field in the Item Table

xina_manxina_man Member Posts: 116
Hi there!

I need to create e new field in the Item table that calaculates (Inventory * Standard Cost).
Is there a simple way to do it? I tried to create a flowfied, but it doesn't have a funtion to multiply fields.

I would be grateful if someone could help me.

Comments

  • bbrownbbrown Member Posts: 3,268
    Create it as a function.
    There are no bugs - only undocumented features.
  • DenSterDenSter Member Posts: 8,304
    You can't have calculated fields like that. What babrown means is that you can create a function in the table with the calculated value as the return value, and then you can use that as the SourceExpr in a form. Mind you that the more complex this function gets, the more performance problems you will have.
  • xina_manxina_man Member Posts: 116
    DenSter wrote:
    You can't have calculated fields like that. What babrown means is that you can create a function in the table with the calculated value as the return value, and then you can use that as the SourceExpr in a form. Mind you that the more complex this function gets, the more performance problems you will have.

    OK!

    I will create that function, and put it in the SourceExpr. The calculations are really simple so I think it wont afect the performance.
    Must I create only the function and then navision will call it in every record, or must I call the function in a specific trigger???

    By the way, the value will be able to be filtered in the form?

    Thank You!
  • DenSterDenSter Member Posts: 8,304
    It doesn't matter if the calculation is simple or not. If it's a calculation on a record that is already in memory it will likely not have a big effect, but it can go down real fast when you have to read something from the database, or when you have a whole bunch of these 'simple calculations', especially in list forms. Just be mindful of the performance, and be aware that these calculations can have an effect.

    Say the function is called 'CalculatedValue', just enter that in the SourceExpr of the textbox and it should display. The form triggers will take care of everyting :mrgreen: . Make sure it is not editable, because it won't write to any field anyway. You will not be able to filter on the value.
  • themavethemave Member Posts: 1,058
    I had a similar need, but since I am not a programmer and can't access cal code in forms, I had to work around it, my simple solution is not real time, but it eliminates the performance problems, I have my inventory value show in list.

    I created a new field, but instead of calculating it on the fly, I created a processing only report that populated it, crude but it works for us. and no performance hits, which you will get if you have your calculation in a list, think about your simple formula. the qty on hand is a flow field itself. and you are using that in a calculation with the standard cost. so if you have it in a list there will be a lot going on with that simple calculation.
  • xina_manxina_man Member Posts: 116
    Hi there everyone!!!

    Thank you for your replys! Now that I'm aware of all the possible issues I'm going to create the necessary methods to do it.

    Thank you very much!
Sign In or Register to comment.