I have a simple table in a draft form - just trying to get the fields to recalculate after removing an instance of a row.
Adding an instance and using the field(s) work just fine - but if I remove a row - the TOTAL OF COLUMN does not recalculate.
I would prefer NOT to use an extra click to solve. I am hoping I can recalculate upon 'removeInstance'.
How do I accomplish this?
Thanks
John
Solved! Go to Solution.
All,
After working the problem through a little more - I solved it. Here is how I did it.
DO NOT Click ‘Done’ !! If you do – you will need to rewrite half of what AEM deletes when you go back to edit.
This is how AEM wrote the code.
WHEN
Total of Sums is changed
AND
(Total of Sums is empty)
OR
(Total of Sums is not empty)
THEN
(Output of Function Sum)
As written by AEM, this code will never fire
because ‘total of sums’ is readOnly AND is waiting for its value to change.
2. So then, while we are still in the rule editor screen, we switch from ‘Visual Editor’, to ‘Code Editor’
(and)
change the Event from ‘Value Commit’ (or whatever it is) and select ‘Calculate’.
Further Development
If you work through this example – you’ll notice that the calculation field displays “$0.00” when empty or “0”. To fix that – I added this code the Rule
Editor – following much of the same steps above.
Instead of 'calculate' - I switched it to 'validate'.
if ( ( this.value == 0 || (this.value === null || this.value === "" ) ) )
{
this.value = null;
}
Views
Replies
Total Likes
I can only think of putting a refresh button on the form that would then calculate the new values and update them. If its event driven - i am not sure what would be a better event then a Refresh button.
Views
Replies
Total Likes
Can you share the form? Also what version of AEM are you using?
Views
Replies
Total Likes
You don't need to refresh
I am using 6.2. Team will be updating to 6.3 soon.
How do I share a form? The team has us on local hosts right now.
Thanks
Views
Replies
Total Likes
If you tried using a Refresh button on the form - does that work?
Views
Replies
Total Likes
I haven't tried for two reasons:
Views
Replies
Total Likes
Does the Object model offer an event that is fired when a row is removed. I have not trued that personally,
Views
Replies
Total Likes
Here is older docs that list events. I assume most of them are still applicable. Adobe LiveCycle ES3 * Events
Views
Replies
Total Likes
I don't believe so. Looked through that pretty extensively yesterday. Will be looking again today.
Views
Replies
Total Likes
Well... it seems to me that AEM Adaptive forms is regulating what you can and cannot do (versus LiveCycle). This would be easy in Livecycle.
Views
Replies
Total Likes
All,
After working the problem through a little more - I solved it. Here is how I did it.
DO NOT Click ‘Done’ !! If you do – you will need to rewrite half of what AEM deletes when you go back to edit.
This is how AEM wrote the code.
WHEN
Total of Sums is changed
AND
(Total of Sums is empty)
OR
(Total of Sums is not empty)
THEN
(Output of Function Sum)
As written by AEM, this code will never fire
because ‘total of sums’ is readOnly AND is waiting for its value to change.
2. So then, while we are still in the rule editor screen, we switch from ‘Visual Editor’, to ‘Code Editor’
(and)
change the Event from ‘Value Commit’ (or whatever it is) and select ‘Calculate’.
Further Development
If you work through this example – you’ll notice that the calculation field displays “$0.00” when empty or “0”. To fix that – I added this code the Rule
Editor – following much of the same steps above.
Instead of 'calculate' - I switched it to 'validate'.
if ( ( this.value == 0 || (this.value === null || this.value === "" ) ) )
{
this.value = null;
}
Views
Replies
Total Likes
thanks for the detailed post. I am sure this will help a lot of ppl in the future.
Views
Replies
Total Likes
Views
Likes
Replies