SummaryItem from function

I have a DataView value that i want to see in a SummaryItem.
It’s is still a dummy function, but i should calculate how many errors occurred and show it to the user in the Summary on the Entity viewer:

Now the goal is for the user to open the items with errors and resolve the errors, but when i change the function to set the amount of errors to 3, the dataview in the entity does change, but on the Entity Manager does not:

So how can I fix this, so the EntityManager will fetch the current situation upon loading?

    @DataView("Error count", duration_guess=1)
    def get_warning_count(self, params, **kwargs) -> DataResult:
        # Calculate amount of warnings:
        #warning_count = randrange(0, 10)
        warning_count = 3
        group = DataGroup(warning_count=DataItem('Warning count', warning_count, suffix='x'))
        result = DataResult(group)
        # print(result.__dict__)
        return result

and the SummaryItem:

    summary = Summary(
        km=SummaryItem('Km', float, 'parametrization', 'structure.general.hidden_km'),
        bbk=SummaryItem('BBK', float, 'parametrization', 'structure.general.hidden_bbk'),
        errors=SummaryItem('Fouten', float, 'get_warning_count', 'warning_count', suffix="x")
    )

Is there anyone that could look into this?

Hi Johan,

The summary items are calculated when creating a revision. In the gif I recorded below you see that the value gets updated after creating a new revision on the child entity.

summary_item_in_manager

Did you create a revision after changing the amount of errors to 3?

1 Like

Hi,

Thanks for pointing this out. No i did not make a revision, in my development area i changed what the function returned, to see if it would work.
But that isn’t a parameter change, and thus not a revision.
The mechanics of how this is done is good, my test wasn’t a good representation of the users behaviour.
Thanks, ill use it this way!

1 Like