Form used for QUery - Rules

If you have questions or if you want to share your opinion about Aware IM post your message on this forum
Post Reply
KnightWare
Posts: 139
Joined: Sat Feb 10, 2018 12:56 am

Form used for QUery - Rules

Post by KnightWare »

When a form is used for a query, does it process the form rules prior to running the query? I have a BO with main form and Search form. I realize under the hood the "SAVE" button is changed to "SEARCH". I need to run rules on the data entered in fields prior to the query, but it doesn't seem to process the rules. Is this due to the "Used for Edit", "Used for Create" being off, so rules don't process? I've tried a simple "REPORT_ERROR" action as test, does not fire.

I need to change the data in the fields of a search form prior to the query running.
BLOMASKY
Posts: 1473
Joined: Wed Sep 30, 2015 10:08 pm
Location: Ocala FL

Re: Form used for QUery - Rules

Post by BLOMASKY »

If I understand correctly, you want to have a form to prompt for some data, run some validation then use those fields to filter the records in a query. Some answers then a suggestion:

1st, Rules can be dynamic or not. If not, then the rules are evaluated just prior to saving the data to the database. If dynamic and your rule looks like "IF BO.attr WAS CHANGED AND BO.attr > 10. THEN REPORT ERROR "....." then it will be triggered when you leave the field.

How I handle your requirement is to have a NON-persistent BO with the attributes I want to use for searching and have a process that looks like:
ENTER NEW NonPersistentBO USING "My Search Form"
IF NPBO.attr < 1 THEN REPORT ERROR 'invalid input'
......
DISPLAY QUERYNAME

where your QUERYNAME looks like FIND BO WHERE NPBO.attr IS UNDEFINED OR NPBO.attr = BO.attr....etc.

Bruce
KnightWare
Posts: 139
Joined: Sat Feb 10, 2018 12:56 am

Re: Form used for QUery - Rules

Post by KnightWare »

BLOMASKY

Waiting on response, I went ahead and built option #2. I

I did have dynamic turned on in the search form of the BO. I needed the fields to be changed to upper case prior to hitting the "Search" button. Does not work. Mind you I was testing with just one field on the form, so I basically typed in lower case and selected search. Could be I needed to TAB to the search button and hit enter?
KnightWare
Posts: 139
Joined: Sat Feb 10, 2018 12:56 am

Re: Form used for QUery - Rules

Post by KnightWare »

BLOMASKY

Tried again tabbing off fields in the search form. Rules are not being applied even though set to dynamic. The rule is to -

IF BO.Field was changed then BO.Field = TO_UPPER_CASE(BO.Field)

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

Re: Form used for QUery - Rules

Post by BLOMASKY »

KnightWare wrote:BLOMASKY

Tried again tabbing off fields in the search form. Rules are not being applied even though set to dynamic. The rule is to -

IF BO.Field was changed then BO.Field = TO_UPPER_CASE(BO.Field)

Not happening.
Ah ha. are you SURE it is not working? The screen is NOT refreshing, but I would bet you a nickel that it is working. See what happens when you click save then look at the data. If you are using this as a front end for another query, then no problem.

Bruce
KnightWare
Posts: 139
Joined: Sat Feb 10, 2018 12:56 am

Re: Form used for QUery - Rules

Post by KnightWare »

BLOMASKY -

I have BO that is external SQL Table. Main form and stripped down Search form. Used mainly for lookup/query. I have a query defined using the Search form. The Business rules all state any change to one of the form fields to change to Upper Case and set to dynamic. Example -

VendorMstr.VENDOR_VNAME WAS CHANGED VendorMstr.VENDOR_VNAME=TO_UPPER_CASE(VendorMstr.VENDOR_VNAME)


When I type lower case into the form field and tab away, it is not changed to upper case and therefore the search fails. The DB is case sensitive, hence addressing it here in case user slips up.
BobK
Posts: 545
Joined: Thu Jan 31, 2008 2:14 pm
Location: Cincinnati, Ohio, USA

Re: Form used for QUery - Rules

Post by BobK »

I do not use forms for queries and I do not have anything to back this up BUT I do not think the BO rules fire when using a form for a query.

Here is an example why I think that is so.

Suppose you have an Order BO and one of the attributes is OderDueDate. When entering an Order, you would not want the due date to be in the past, so you would have a rule to prevent that.

Now suppose you use an Order form for a query and you want to see the orders that were due yesterday. You would not want the rule preventing past due dates to execute and prevent you from search for orders due yesterday.
Bob
Post Reply