How does one calculate an object attribute based on other attributes. New to low-level coding.

0
Hey, I am used to high-level coding and find it very difficult to do very simple arithmetic with Mendix’s microflow. I want to simply calculate an object attribute by adding values from inputted object attributes. What would the flow look like? Should I create a children object in order for Mendix to make this happen? Would it be easier if I just use Java? Thank you.
asked
3 answers
0

You can calculate the value in your domain model or in your microflow depending on how you want to store your data (persistable or non-persistable).

  1. Persistable
    1. Have the two input fields be part of the entity where you want your final value to be
    2. For the final value field, select it as calculated and pass in the entity. You can then make a microflow to calculate what you want.
  2. Non-persistable
    1. Make a non-persistable entity that will be on the page where you input the data with only fields for your input data. Make sure you have it inside of a dataview with the entity that stores the calculated value.
    2. Put a save/calculate button inside the dataview with the non-persistable entity
    3. Have that button call a microflow that calculates what you want, and then store it inside of your final entity through a change action.

Hope that helps!

answered
0

I know that to the trained Mendix microflow eye, this probably looks terrible. But essentially, I am taking 4 different inputted values adding them together in a new variable, making another new variable and taking the difference of a date and the current date, and then adding those two newly created variables into another new variable, and calling the object attribute to make it equal to the final variable I added.    I know this is very clunky but I am having a hard time with the drag and drop.  The best thing would be to pull the attribute from the data base and change it based on the  new variable I created.

Does this make sense ? :D

 

answered
0

So this is what finally worked for my mendix microflow, however, it does not apply it to each individual object. How can I make sure that everytime an object is created it uses its own values to calculate said attribute. 

One step closer ! :D 

answered