Maximo Open Forum

 View Only

 Counting number for child table by Formulas

Jump to  Best Answer
  • Everything Maximo
kenta nakao's profile image
kenta nakao posted 07-20-2022 03:32
Hi all.

I would like to count the number of tasks in the WORKORDER by Formulas for attributes.
When I add or delete a child task and save it in the same transaction, the number of tasks before the addition or deletion is counted.

Formulas setting : count$childtask

Operation:
  -Create workorder
  -Add 2 tasks
  -Save
  -The total number of tasks 0.should be 2.

It may be possible to do this with an automation script, but I am trying to verify if there is a way to do it with Formulas for attributes.

Thanks
Phil Naylor's profile image
Phil Naylor  Best Answer
Hi Kenta

I don't think changes in count of records found by a relationship will trigger an attribute formula to recalculate as it does for other database attributes, there needs to be a trigger to retrieve those records via the relationship. Going out of the record and back in should trigger the formula to recalculate. 

I have used counts via relationships in formulas but tie them to non-persistent attributes so they are calculated when a user refreshes the list or opens a tab where the formula is held. If you don't want to have to refresh the record to see the result then yes an automation script on the save may be the answer.

Hope this helps

Phil
kenta nakao's profile image
kenta nakao
Hi Phil

Thank you for your response.

Using the non-persistent attribute worked.
I was also able to confirm that it works correctly by using the same relationship as the table for the persistent attribute.

It seems that the task table in the wotrack application I chose for the sample did not work correctly because it was displayed via a data source.

regard