Can I have a RULE save a form?

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

Can I have a RULE save a form?

Post by BLOMASKY »

Can I do something like IF BO.ATTR WAS CHANGED THEN SaveForm


Thanks
Bruce
PointsWell
Posts: 1460
Joined: Tue Jan 24, 2017 5:51 am
Location: 'Stralya

Re: Can I have a RULE save a form?

Post by PointsWell »

I think this is covered by the 8.1 COMMIT transaction functionality.

I have not found a way to do it quietly (using check boxes and save when changed produces a prompt to the user)
rbross
Posts: 441
Joined: Wed Nov 19, 2014 4:13 am
Location: Coventry, Connecticut USA

Re: Can I have a RULE save a form?

Post by rbross »

What about the setting, "If value was changed then save form" This will save the form immediately if the value was changed.
Roger Ross
AwareIM 8.7 (build 3025) ~ MS-SQL ~ Windows 10 ~
AwareIM 8.5 (build 2828) ~ MS-SQL ~ Windows 10 ~
BLOMASKY
Posts: 1473
Joined: Wed Sep 30, 2015 10:08 pm
Location: Ocala FL

Re: Can I have a RULE save a form?

Post by BLOMASKY »

Really Roger? I didn't know there is a SAVE FORM command.

Bruce
PointsWell
Posts: 1460
Joined: Tue Jan 24, 2017 5:51 am
Location: 'Stralya

Re: Can I have a RULE save a form?

Post by PointsWell »

BLOMASKY wrote:Really Roger? I didn't know there is a SAVE FORM command.

Bruce
It’s not a function Bruce, it’s a flag on Yes/No attributes (and drop downs I think). My experience with it though is that it produces a prompt to the user “Do you want to save Yes/No/Cancel”

Which is what I was trying to say in my original response - if you want the form to quietly save this won’t do it. Unless I have managed to use it incorrectly (always possible).
BLOMASKY
Posts: 1473
Joined: Wed Sep 30, 2015 10:08 pm
Location: Ocala FL

Re: Can I have a RULE save a form?

Post by BLOMASKY »

The problem is, I need it to save when I edit a text field. hummm, back to the drawing board
johntalbott
Posts: 619
Joined: Wed Jun 17, 2015 11:16 pm
Location: Omaha, Nebraska
Contact:

Re: Can I have a RULE save a form?

Post by johntalbott »

Rule no, script yes. :D
VocalDay Solutions - Agility - Predictability - Quality

We specialize in enabling business through the innovative use of technology.

AwareIM app with beautiful UI/UX - https://screencast-o-matic.com/watch/crfUrrVeB3t
BLOMASKY
Posts: 1473
Joined: Wed Sep 30, 2015 10:08 pm
Location: Ocala FL

Re: Can I have a RULE save a form?

Post by BLOMASKY »

John, when you say script can save, are you suggesting I add some Javascript to the Render script of the form, to trap when a field loses focus and then do a parser.save_form()?

Bruce
johntalbott
Posts: 619
Joined: Wed Jun 17, 2015 11:16 pm
Location: Omaha, Nebraska
Contact:

Re: Can I have a RULE save a form?

Post by johntalbott »

Exactamundo!
VocalDay Solutions - Agility - Predictability - Quality

We specialize in enabling business through the innovative use of technology.

AwareIM app with beautiful UI/UX - https://screencast-o-matic.com/watch/crfUrrVeB3t
ACDC
Posts: 1143
Joined: Sat Jun 30, 2007 5:03 pm
Location: California, USA

Re: Can I have a RULE save a form?

Post by ACDC »

Can I do something like IF BO.ATTR WAS CHANGED THEN SaveForm
IF BO.ATTR WAS CHANGED Then UPDATE BO
BenHayat
Posts: 2749
Joined: Thu Dec 23, 2010 5:48 am
Location: Fla, USA
Contact:

Re: Can I have a RULE save a form?

Post by BenHayat »

ACDC wrote:
Can I do something like IF BO.ATTR WAS CHANGED THEN SaveForm
IF BO.ATTR WAS CHANGED Then UPDATE BO
I've used this and works!
BLOMASKY
Posts: 1473
Joined: Wed Sep 30, 2015 10:08 pm
Location: Ocala FL

Re: Can I have a RULE save a form?

Post by BLOMASKY »

Humm, I will have to test that. Reading the docs tells me that:

The UPDATE action invokes evaluation of rules attached to the specified business object (provided that there are any)

Doesn't say anything about updating the database, but I should know the answer to that soonish.

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

Re: Can I have a RULE save a form?

Post by BenHayat »

BLOMASKY wrote:Humm, I will have to test that. Reading the docs tells me that:

The UPDATE action invokes evaluation of rules attached to the specified business object (provided that there are any)

Doesn't say anything about updating the database, but I should know the answer to that soonish.

Bruce
Bruce, I use it for both scenarios. Sometime I want to force the rule evaluation to take place, so I use update, and also for for cases when I change some attribute in a process, I follow it up with update.
tford
Posts: 4238
Joined: Sat Mar 10, 2007 6:44 pm

Re: Can I have a RULE save a form?

Post by tford »

Ben -- I don't get how you were able to use UPDATED for Bruce's user case.

If I understand it right, when a user if on a Form, Bruce wants to save the form if a certain text field value WAS CHANGED. I'm assuming Bruce wants to save it dynamically while the user is still on the Form and has not clicked any buttons to save the Form.

To test UPDATE theory, I added two attributes to RegularUser, Test1 and Test2.

Then I added a dynamic rule:
If RegularUser.Test1 WAS CHANGED Then
RegularUser.Test2=RegularUser.Test1
UPDATE RegularUser

When testing, I tried to update RegularUser.Test1 and tab through it hoping it would update the Test2 value and commit the values to the database.

I got an internal error.
Tom - V8.8 build 3137 - MySql / PostGres
BenHayat
Posts: 2749
Joined: Thu Dec 23, 2010 5:48 am
Location: Fla, USA
Contact:

Re: Can I have a RULE save a form?

Post by BenHayat »

tford wrote:Ben -- I don't get how you were able to use UPDATED for Bruce's user case.

If I understand it right, when a user if on a Form, Bruce wants to save the form if a certain text field value WAS CHANGED. I'm assuming Bruce wants to save it dynamically while the user is still on the Form and has not clicked any buttons to save the Form.
If this is the case, you're right, my way doesn't work. It requires a client JS to make an AJAX call to the server for update, which the SAVE button is the best way to go about it.
Post Reply