Validate multiple fields on Save


How to validate two date fields in Oracle Apex.

Into the wonderful world of Oracle Apex development, I must admit, if you know Oracle SQL and PL/SQL then this is a great application development tool.

Any way I wanted to ensure that the a date entered was greater than another date column, pretty simple 🙂

The application field names are called

PERIOD_START_DATE

PERIOD_END_DATE

To create validation on the PERIOD_END_DATE field. Navigate to the field in the report columns section of the application.

Right click on the field name and choose Create Validation

Oracle Apex Create Validation

Create validation option

Once the validation screen is open there are numerous types, we are going to use the  “Function Returning Boolean” for more options and examples read up on the subject matter Understanding Validations

The documentation is OK but they do leave some bits out, go figure :).

Now we have chosen the correct type, we need to enter a Validation Expression

BEGIN
IF : PERIOD_END_DATE <= : PERIOD_START_DATE THEN
RETURN FALSE;
ELSE
RETURN TRUE;
END IF;
END;

Set always execute to Yes

Enter and appropriate error message.

The final area is the conditions.

This is when the validation will take place and on what data.

You pick the button and execution scope.

The button is self explanatory, I would set the scope to created and modified rows.

Advertisements


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s