Refreshing Calculation in a grid with parameters help in a different business object

If you have questions or if you want to share your opinion about Aware IM post your message on this forum
Post Reply
ColinP
Posts: 30
Joined: Thu Jul 09, 2020 7:57 am
Location: London UK

Refreshing Calculation in a grid with parameters help in a different business object

Post by ColinP »

Forgive me - I am a newbie, still trying to get to grips with AwareIMt.

I have a number of calculated fields on a grid. Some of the factors in the calculations are attributes of the same business object as the calculated attributes and the user wants to edit these values and immediately see the result. This I can do and it's fine.

However there are a number of additional factors which affect the calculation which are attributes of the parent business object. Idealy these would be shown in the same form and when a value was changed it would recalculate all the instances in the grid.

I have tried a number of techniques to get AwareIM to do this without success.

An acceptable compromise would be for there to be a 'Refresh' button on the form, so that the user could refresh the calculated attributes if they made changes to the parameters held in the parent business object. Whereas I could easily get all the instances into the Context, any calculation process uodated every instance with the same figures. In retrospect, hardly surprising, but worth a try when desperate.

Can anyone help me please by either telling me that what I am tryig to do just can't be done or suggesting a mechanism which would achieve the desired result. I would be most grateful.

Colin Parker
Colin
------------------------------------------------------------------------------------------------------------------------
AwareIM 8.7 (Build3012) Windows Virtual Server Derby
customaware
Posts: 2401
Joined: Mon Jul 02, 2012 12:24 am
Location: Ulaanbaatar, Mongolia

Re: Refreshing Calculation in a grid with parameters help in a different business object

Post by customaware »

Have you set the Autorefresh on the grid that include the Parent BO and the Child BO and any Process you are using?
Cheers,
Mark
_________________
AwareIM 6.0, 8.7, 8.8, 9.0 , MariaDB, Windows 10, Ubuntu Linux. Theme: Default, Browser: Arc
Upcloud, Obsidian....
Image
ColinP
Posts: 30
Joined: Thu Jul 09, 2020 7:57 am
Location: London UK

Re: Refreshing Calculation in a grid with parameters help in a different business object

Post by ColinP »

Thank you for your response.

As I understand it Auto-Refresh will refresh the results of the query to select the instances shown in the grid. There seems to be four methods to trigger a refresh and I was already using the second to refresh the query if a new instance of the business object shown in the grid was created. On your suggestion I tried the third, to refresh if a process was run, I created an empty process to test this. It refreshed the results of the query to populate the grid, but it did not force a recalculation of the calculated attributes.

Perhaps there is some Rule I could place in the process which would do this?
Colin
------------------------------------------------------------------------------------------------------------------------
AwareIM 8.7 (Build3012) Windows Virtual Server Derby
ColinP
Posts: 30
Joined: Thu Jul 09, 2020 7:57 am
Location: London UK

Re: Refreshing Calculation in a grid with parameters help in a different business object

Post by ColinP »

I have made some progress with this.

I found an ACTION called UPDATE which will invoke evaluation of rules attached to the specified Business Object. So now I have a (HTML) button on my form called 'Refresh' which calls a process called test_refresh and passes the instance of the BO. This process first gets the mulitple instances of the Business Object I want to update and calls for the UPDATE first of the instance of the BO passed to the process and then of the instances queried. I have added this process to the Auto-Refresh triggers in the grid properties.

We are almost there. When I run the form I can alter the Selling Price of the Product, click on my Refresh Button, AwareIM will ask me if I want to keep the changes. I click on Yes and the revised Gross Profit is displayed against each instance in the grid.

I can see from the testing log that it does seem to be working fine.

My problem now is what happens when I change the Selling Price for a second time and click on my Refresh button. This time I am not asked to save any changes and the Selling Price on the form merely reverts to the value before the change. The testing log indictaes that all the rules have been invoked, but all using (I assume) the previous value, so the resulting value is not changed.

Perhaps I should start a new log as this has changed so much

kind regards
Colin
------------------------------------------------------------------------------------------------------------------------
AwareIM 8.7 (Build3012) Windows Virtual Server Derby
tford
Posts: 4238
Joined: Sat Mar 10, 2007 6:44 pm

Re: Refreshing Calculation in a grid with parameters help in a different business object

Post by tford »

Colin .. the User Guide should have some info on different button figurations if my memory serves me right. Seems like you need a button with a SAVE function.
Tom - V8.8 build 3137 - MySql / PostGres
BLOMASKY
Posts: 1471
Joined: Wed Sep 30, 2015 10:08 pm
Location: Ocala FL

Re: Refreshing Calculation in a grid with parameters help in a different business object

Post by BLOMASKY »

I might not understand your issue, but it seems like you have some editable fields in a BO that are used to compute a calculated field with the calculation also using some attributes from a parent BO.

If so, you can create a rule in the child BO where you check off DYNAMIC and the rule would look like:

IF Child.attr1 WAS CHANGED THEN
Child.calcField = Child.attr + Child.linkToParent.parentAttribute (or Child.shortcutToParentAttribute)

Bruce
ColinP
Posts: 30
Joined: Thu Jul 09, 2020 7:57 am
Location: London UK

Re: Refreshing Calculation in a grid with parameters help in a different business object

Post by ColinP »

Many thanks to all those who responded to this cry for help.

With your imput I am half way to solving the problem. I stated a new BSV to test what I wanted to do and it works perfectly. There must be a something, somwhere which is not set correctly. It is just a question of finding it.

My very grateful thanks again
Colin
------------------------------------------------------------------------------------------------------------------------
AwareIM 8.7 (Build3012) Windows Virtual Server Derby
Post Reply