Noob: Rules vs. Process

If you have questions or if you want to share your opinion about Aware IM post your message on this forum
Post Reply
Jaymer
Posts: 2475
Joined: Tue Jan 13, 2015 10:58 am
Location: Tampa, FL
Contact:

Noob: Rules vs. Process

Post by Jaymer »

Lets say that after I enter a LINE ITEM, I want to load a bunch of vars (visible/invisible on the form) behind the scenes.
I don't know if I'll need to use this "stub" in the future, so in Magic I'd make it a standalone pgm (instead of a subtask) with 20 arguments.

Is that "stub" a Process in AIM?
How do I pass all those parms?
Something makes me think there's a copy in memory of the current Line Item record and I can "just set" their values?
If I use a rule (or bunch of rules), then I have to recode all that somewhere else down the road to re-use?

thx
jaymer...
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
customaware
Posts: 2414
Joined: Mon Jul 02, 2012 12:24 am
Location: Ulaanbaatar, Mongolia

Re: Noob: Rules vs. Process

Post by customaware »

BO = MyBO

Attrs Attr1,Attr2,Attr3.

User Adds a new Item by entering a value for Att1

But you need Attr2 = 'VALID' if Attr1 is greater than or equal to 100 or 'INVALID' if Attr less than 100 (whenever Attr1 is entered or Modified)
and you want Attr3 = to todays date (only when record created


Rule1:
Condition: MyBO IS NEW
Action: MyBO.Attr2=CURRENT_DATE


Rule2:
Condition1: MyBO.Attr>=100
Action: MyBO.Attr3='VALID'

Rule3:
Condition1: MyBO.Attr<100
Action: MyBO.Attr3='INVALID'


You can combine Rule 2 and 3 using the Textual Form Tab

If MyBO.Attr>=100 Then
MyBO.Attr3='VALID'

Else
MyBO.Attr3='INVALID'

If you want to go and change a pile of attributes in different BO and/or a pile of other stuff..... call a process which can take this instance of MyBO
as a Parameter
Cheers,
Mark
_________________
AwareIM 6.0, 8.7, 8.8, 9.0 , MariaDB, Windows 10, Ubuntu Linux. Theme: Default, Browser: Arc
Upcloud, Obsidian....
Image
BLOMASKY
Posts: 1478
Joined: Wed Sep 30, 2015 10:08 pm
Location: Ocala FL

Re: Noob: Rules vs. Process

Post by BLOMASKY »

Jaymer, in Magic, all of your logic is in a PROGRAM, so it makes sense to make a stub program that you can call from lots of places, cause you might have more than one entry form for the data, a line mode, a screen mode, etc.

with Aware the mindset is diff. the BO has the LOGIC. so you have no need to have a program that is called in multiple places. Instead the BO has the rules (that Mark wrote so very well). Now, it does not matter if you have an entry form, a query with inline editing or EVEN if you have a process that looks like:

FIND BO where .....
BO.attr1 = 123


The rule will be triggered

Like MAGIC... errrr. not really
Bruce
customaware
Posts: 2414
Joined: Mon Jul 02, 2012 12:24 am
Location: Ulaanbaatar, Mongolia

Re: Noob: Rules vs. Process

Post by customaware »

There is an exception Bruce.

There are times when you want to CREATE an instance of the BO in a Process but you do not want the BO Rules executed.
Hence you can add the NO RULES switch at the end...

So, in the Process...

CREATE MyBO WITH MyBO.Attr1=whatever, blah, blah NO RULES
Cheers,
Mark
_________________
AwareIM 6.0, 8.7, 8.8, 9.0 , MariaDB, Windows 10, Ubuntu Linux. Theme: Default, Browser: Arc
Upcloud, Obsidian....
Image
Post Reply