How can I DISPLAY MESSAGE in Rule

If you have questions or if you want to share your opinion about Aware IM post your message on this forum
BLOMASKY
Posts: 1473
Joined: Wed Sep 30, 2015 10:08 pm
Location: Ocala FL

How can I DISPLAY MESSAGE in Rule

Post by BLOMASKY »

I dont want to report error, but when certain rules are true, I want to perform special calculations and DISPLAY MESSAGE telling the user what I did.

I can't put a DISPLAY MESSAGE in the rule
If I call a process that has a DISPLAY MESSAGE it never gets called (or at least, the msg is not displayed)

Any suggestions?

Thanks
Bruce
BenHayat
Posts: 2749
Joined: Thu Dec 23, 2010 5:48 am
Location: Fla, USA
Contact:

Re: How can I DISPLAY MESSAGE in Rule

Post by BenHayat »

Early on, I had run into this, but I had to change my approach and use process to start a task and as part of the task, I had put messages in the process to communicate with use.
Think of rules as silent events.
BLOMASKY
Posts: 1473
Joined: Wed Sep 30, 2015 10:08 pm
Location: Ocala FL

Re: How can I DISPLAY MESSAGE in Rule

Post by BLOMASKY »

but.. but.. but...

I want to trigger this when the user changes a field on a form. The only way to trap that is a rule, right???

Also, if I try to run something, I get an error message like this in the log:

Action PICK FROM ..... is not allowed during initialisation.

In the Rule / Advanced Tab, I checked "Do not use rule during initialisation" and it doesn't make any diff.

Bruce
BenHayat
Posts: 2749
Joined: Thu Dec 23, 2010 5:48 am
Location: Fla, USA
Contact:

Re: How can I DISPLAY MESSAGE in Rule

Post by BenHayat »

BLOMASKY wrote:but.. but.. but...

I want to trigger this when the user changes a field on a form. The only way to trap that is a rule, right???

Also, if I try to run something, I get an error message like this in the log:

Action PICK FROM ..... is not allowed during initialisation.

In the Rule / Advanced Tab, I checked "Do not use rule during initialisation" and it doesn't make any diff.

Bruce
I'm not saying your wish is unjustified. I com from years of working with C++, Pascal, C# and we always had all the the controls we wanted. So your request is very much inline with what a developer needs. But in Aware, I'm the one who has to bend backwards to get something done. This has been the hardest part of working with Aware, where you loose so much freedom and control, but you gain tons of time in return.

I have a case when a user changes data in some attributes, have some dummy attributes on the same form that shows results and message as part of the form. The rule basically update those dummy attributes to communicate with user.
tford
Posts: 4238
Joined: Sat Mar 10, 2007 6:44 pm

Re: How can I DISPLAY MESSAGE in Rule

Post by tford »

I want to trigger this when the user changes a field on a form. The only way to trap that is a rule, right???
I've accomplished something similar with a dynamic rule which sets a value in a particular attribute which is only displayed on certain conditions. Display of the conditional info can either be via READ PROTECT rule or in a form section that displays conditionally .. whatever fits best with your situation.
Tom - V8.8 build 3137 - MySql / PostGres
BenHayat
Posts: 2749
Joined: Thu Dec 23, 2010 5:48 am
Location: Fla, USA
Contact:

Re: How can I DISPLAY MESSAGE in Rule

Post by BenHayat »

tford wrote:
I want to trigger this when the user changes a field on a form. The only way to trap that is a rule, right???
I've accomplished something similar with a dynamic rule which sets a value in a particular attribute which is only displayed on certain conditions. Display of the conditional info can either be via READ PROTECT rule or in a form section that displays conditionally .. whatever fits best with your situation.
That's exactly how I've done it, with dynamic rule and conditions to show, on the form instead of a message dialog box.
BLOMASKY
Posts: 1473
Joined: Wed Sep 30, 2015 10:08 pm
Location: Ocala FL

Re: How can I DISPLAY MESSAGE in Rule

Post by BLOMASKY »

Thanks for the comments guy, I "Have" embraced the Aware mindset for displaying msgs, however, just to gripe a bit, In my case, if the qty field is > than stock, want to display a msg then update the qty = to the stock qty So I need to add 2 fields to the BO (msgField and flagField) and write logic like this

IF BO.qty > BO.stock THEN
BO.msg = 'You are quoting TOO much'
BO.qty = BO.stock // doing this, causes this rule to run again
BO.flag = 'Yes'
ELSE IF BO.flag = 'No'
BO.msg = ''
ELSE BO.flag = 'No'

I seem need the flag attribute since this rule will be called twice, once when the user enters the qty and then when it is corrected to the stock qty.

Not a problem, but if I could do a DISPLAY MESSAGE from a rule, would be a lot easier.

But still smiling

Bruce
aware_support
Posts: 7525
Joined: Sun Apr 24, 2005 12:36 am
Contact:

Re: How can I DISPLAY MESSAGE in Rule

Post by aware_support »

If you message is conceptually a warning/information to the user after he saves a form then you need to accomplish this via a special process that runs after the form is saved. There is a special setting for this in a form - this was precisely why this setting was introduced in the first place.
Aware IM Support Team
BLOMASKY
Posts: 1473
Joined: Wed Sep 30, 2015 10:08 pm
Location: Ocala FL

Re: How can I DISPLAY MESSAGE in Rule

Post by BLOMASKY »

Thanks for the answer, but this is NOT after they save. Its after they change a field. (I have a field called qty required and if its > stock then I want a msg displayed and the qty changed to the stock qty). I need to do this before they hit the Save button, since I also display the line total of qty * price.

Thanks

Bruce
hpl123
Posts: 2600
Joined: Fri Feb 01, 2013 1:13 pm
Location: Scandinavia

Re: How can I DISPLAY MESSAGE in Rule

Post by hpl123 »

The DISPLAY MESSAGE feature is a bit limited unfortunately and I would LOVE to have a way of running a script n the frontend of the app via a function (from rules or processes and something like AwareApp.LoadDynamicFile but again having this as a function excecuted via rules. If we have that functionality we could create our own notifications + other stuff when needed. I understand the logic of the isolated object/context of the business rules but this could maybe be worked around in some way in a function?

Bruce, not fully up to date on your scenario but you can configure "Save when attribute changed" (or something like that) and that would save the form and you could have your process linked to the form which the DISPLAY MESSAGE. You can also do something like this (take a look at the solution in the last posts of the thread):
http://www.awareim.com/forum/viewtopic.php?f=1&t=7896
Henrik (V8 Developer Ed. - Windows)
aware_support
Posts: 7525
Joined: Sun Apr 24, 2005 12:36 am
Contact:

Re: How can I DISPLAY MESSAGE in Rule

Post by aware_support »

A message is also displayed when your rule uses REPORT ERROR rather than DISPLAY MESSAGE.
And when you make this rule dynamic it will be executed as soon as the field loses focus.

I don't see any limitations or weaknesses in Aware IM in this area.
Aware IM Support Team
BLOMASKY
Posts: 1473
Joined: Wed Sep 30, 2015 10:08 pm
Location: Ocala FL

Re: How can I DISPLAY MESSAGE in Rule

Post by BLOMASKY »

Here is the problem
REPORT ERROR will cancel any changes
so if I want something like

IF BO.qtyEntered > Inventory.stock THEN
BO.qtyEntered = Inventory.stock
REPORT ERROR....

The report error will cancel my Bo.qtyEntered = Inventory.stock command


Bruce
BLOMASKY
Posts: 1473
Joined: Wed Sep 30, 2015 10:08 pm
Location: Ocala FL

Re: How can I DISPLAY MESSAGE in Rule

Post by BLOMASKY »

is there an option to "save when changed" for all fields? I only saw that for checkboxes. If I can have it save when a text field is updated, then I can find a workaround

Bruce
customaware
Posts: 2405
Joined: Mon Jul 02, 2012 12:24 am
Location: Ulaanbaatar, Mongolia

Re: How can I DISPLAY MESSAGE in Rule

Post by customaware »

Bruce,

Is there any reason why you can't just populate a cell with some text ( styled with css) that is conditionally displayed?
Cheers,
Mark
_________________
AwareIM 6.0, 8.7, 8.8, 9.0 , MariaDB, Windows 10, Ubuntu Linux. Theme: Default, Browser: Arc
Upcloud, Obsidian....
Image
aware_support
Posts: 7525
Joined: Sun Apr 24, 2005 12:36 am
Contact:

Re: How can I DISPLAY MESSAGE in Rule

Post by aware_support »

REPORT ERROR does not abort anything while it is executed on the client - it just acts as a display message.

If you are concerned that this rule will fire when the form is saved and abort everything, then there is a checkbox to ONLY execute the rule on the client. The checkbox is in the Advanced properties of the rule next to the checkbox that makes the rule dynamic.

Saving the form when the value of the attribute changes is available for checkboxes and combo-boxes only.

However, you can add an Advanced script that will do it for any attribute. If none of the suggested solutions work for you, let me know and I'll attach the script.
Aware IM Support Team
Post Reply