Changed Values revert to Original after First Time Use

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

Changed Values revert to Original after First Time Use

Post by ColinP »

I am a newbie so forgive my ignorance.

I have a form based on a Business Object (BO1) with a grid for a related Business Object (BO2). BO2 contains a number of fields which are calculated with factors contained in BO2 as well as some contained in BO1. If the user changes on of the values of BO1 on the form I want to refresh the calculated fields in BO2. I have a number of Dynamic Rules set up to do these recalculations.

I had no success in making this process automatic, so I created a button on the BO1 form called 'Refresh' . When the user changed a value they had to hit 'Refresh' to recalculate all the values in the grid. (ultimately it would be my ambition to manage without the 'refresh' button, but it helped with design and testing)

This button calls a process and passes to it the instance of BO1. The process finds all the instances of BO2 and runs the actions UPDATE B01 and UPDATE BO2. The grid is set to auto-refresh when this process is run.

Under test the first time a factor is changed in BO1 the user is asked to confirm that they want to save the change and the new values are displayed in the grid. Perfect!

But if the parameter is changed again and Refresh is hit, this does not happen. Instead the changed value in BO1 merely returns to its previous value. The Test Log reveals that the Refresh process is running correctly, so the assumption is that it is using the old values in BO1.

Ovviously AwareIM will react the same way to the same situation, so something about the situation has changed. But what is it and how can I fix it?
Colin
------------------------------------------------------------------------------------------------------------------------
AwareIM 8.7 (Build3012) Windows Virtual Server Derby
BLOMASKY
Posts: 1471
Joined: Wed Sep 30, 2015 10:08 pm
Location: Ocala FL

Re: Changed Values revert to Original after First Time Use

Post by BLOMASKY »

Instead of a button, how about you create a rule with:

IF BO1.attr WAS CHANGED THEN
........



Then, whenever you click the save button on the form it will run this process. Having a refresh button on your form will take the data that has already been saved to the DB and not necessarily what you enter into the field.

Bruce
Jaymer
Posts: 2450
Joined: Tue Jan 13, 2015 10:58 am
Location: Tampa, FL
Contact:

Re: Changed Values revert to Original after First Time Use

Post by Jaymer »

The refresh button needs to save form before starting the process

Bruce’s rule should be dynamic?
Click Here to see a collection of my tips & hacks on this forum. Or search for "JaymerTip" in the search bar at the top.

Jaymer
Aware Programming & Consulting - Tampa FL
rbross
Posts: 441
Joined: Wed Nov 19, 2014 4:13 am
Location: Coventry, Connecticut USA

Re: Changed Values revert to Original after First Time Use

Post by rbross »

Your changes have not been committed yet. You could try to make Bruce’s rule dynamic or call the process after the form has been saved. You can see this property on the save button.
“Call process after save”
Roger Ross
AwareIM 8.7 (build 3025) ~ MS-SQL ~ Windows 10 ~
AwareIM 8.5 (build 2828) ~ MS-SQL ~ Windows 10 ~
ColinP
Posts: 30
Joined: Thu Jul 09, 2020 7:57 am
Location: London UK

Re: Changed Values revert to Original after First Time Use

Post by ColinP »

Thank you for your most helpful advice.
I cannot find an ACTION to SAVE the form. But then I have trouble finding the Bovril in the Supermarket. Can you tell me how I can do this without actually using the 'SAVE' bottom button and closing the form.
I think I tried COMMIT TRANSACTION in my refresh PROCESS without success.
The point is that the user wants to try different selling prices and see the effect on Gross Profit without having to exit the form and reload it. At the moment they can only do it once.
Colin
------------------------------------------------------------------------------------------------------------------------
AwareIM 8.7 (Build3012) Windows Virtual Server Derby
rbross
Posts: 441
Joined: Wed Nov 19, 2014 4:13 am
Location: Coventry, Connecticut USA

Re: Changed Values revert to Original after First Time Use

Post by rbross »

ColinP wrote: Fri Nov 06, 2020 11:39 am The point is that the user wants to try different selling prices and see the effect on Gross Profit without having to exit the form and reload it. At the moment they can only do it once.
OK, I thought you wanted to save it then call a process.
In this case you need to try what Bruce suggested.
Create a rule that will call a process based on your condition
IF bo.field1 WAS CHANGED THEN Call process
tick the property to make this rule Dynamic and set Initialization =No if it is Automatic
under advanced tick the box not to check for referred attributes.
In the auto refresh property for the form add the process to the refresh list under processes and add the BO under refresh when a BO changes.

I will try to create a sample bsv for you that demonstrates this action for you.
Roger Ross
AwareIM 8.7 (build 3025) ~ MS-SQL ~ Windows 10 ~
AwareIM 8.5 (build 2828) ~ MS-SQL ~ Windows 10 ~
rbross
Posts: 441
Joined: Wed Nov 19, 2014 4:13 am
Location: Coventry, Connecticut USA

Re: Changed Values revert to Original after First Time Use

Post by rbross »

Colin,
Attached is a sample bsv for you to look at that duplicates what you are looking for I think.
It will create sample data for Order Header and Order Lines at at startup.
Click on the Orders Button on the top left. The query will open to show the order.
Click on the order and the edit form will open.
If you change the customer discount and click save it will refresh and update all order lines with the new discount
If you change any of the values on the order line and tab or move off the row it will update the row, refresh and update the Order Header.
Order Header shows the Margin/Profit and Margin% and Markup%
Column totals were added so you can see the total for order lines and see that it matches the Order Header.

Hope this helps.
Let me know if you have any questions.
colin.zip
(42.16 KiB) Downloaded 433 times
Roger Ross
AwareIM 8.7 (build 3025) ~ MS-SQL ~ Windows 10 ~
AwareIM 8.5 (build 2828) ~ MS-SQL ~ Windows 10 ~
ColinP
Posts: 30
Joined: Thu Jul 09, 2020 7:57 am
Location: London UK

Re: Changed Values revert to Original after First Time Use

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
rbross
Posts: 441
Joined: Wed Nov 19, 2014 4:13 am
Location: Coventry, Connecticut USA

Re: Changed Values revert to Original after First Time Use

Post by rbross »

Glad to hear you got it working Colin,

What is the rest of your problem? Were are here to help.
Roger Ross
AwareIM 8.7 (build 3025) ~ MS-SQL ~ Windows 10 ~
AwareIM 8.5 (build 2828) ~ MS-SQL ~ Windows 10 ~
ColinP
Posts: 30
Joined: Thu Jul 09, 2020 7:57 am
Location: London UK

Re: Changed Values revert to Original after First Time Use

Post by ColinP »

The half I have solved is a separate bsv in which what I am trying to do actually works.

So now I am left with the task of comparing the two to find out why the 'real' one does not work.

To be honest I have not had much time on it of late, but what time I have had has not been fruitful.

Thanks for your concern. it is much appreciated
Colin
------------------------------------------------------------------------------------------------------------------------
AwareIM 8.7 (Build3012) Windows Virtual Server Derby
Post Reply