Oracle-APEX Validation Rules for Empty, half empty & full data fields - oracle

So I'm writing up 3 validation rules for CV_DATE_SUBMITTED & CV_DATE_APPROVED
The 1st Validation rule I want to do is set it so that when both fields are empty and the user presses create, it will ignore the validation because both fields are empty.
The 2nd validation rule will be set up so if the user has entered data into the CV_DATE_SUBMITTED field but not for the CV_DATE_APPROVED field because they don't have data for that as yet. When the user presses the create button, it will validate that the CV_DATE_SUBMITTED should be on a date before the present day.
Finally, the 3rd validation rule is set up so if the user has data for both the CV_DATE_SUBMITTED & CV_DATE_APPROVED fields, then it will check that the CV_DATE_APPROVED field cannot be a date after & including the current date, whilst also checking that the CV_DATE_SUBMITTED is not a date after the CV_DATE_APPROVED.
I've managed to complete the 3rd validation rule in the form of CV_DATE_SUBMITTED field having the SQL Expression of TO_DATE(:P19_CV_DATE_SUBMITTED) <= TRUNC(SYSDATE)
And CV_DATE_APPROVED field having the SQL Expression of
TO_DATE(:P19_CV_DATE_APPROVED)>= TO_DATE(:P19_CV_DATE_SUBMITTED)
But I have no idea as to how I can implement the 1st & 2nd validation rules & to get them to work with each other.

You either need to have separate validations that are conditional - only executing when the relevant field is empty/or filled in.
Or have few boolean operations
TO_DATE(:P19_CV_DATE_SUBMITTED) <= TRUNC(SYSDATE) or :P19_CV_DATE_SUBMITTED is null
And/or you need to learn about null related functions.

Related

Conditional field rendering in oracle apex forms

I have a table 'arrear students'. And i want to create a form on it but the input fields must only appear on the form upon certain conditions like if the previosuly stored value in the field was null it must appear or else it shouldn't.
Create a form on your table
Each column will be a page item
To set a display condition for a page item, go to "Server Side Condition" and pick the appropriate condition for your requirement (eg if value NULL - pick "Item = NULL")

Epicor, sending an email when price is changed, but not the initial entry

I am trying to create a BPM that sends an email when a field is updated.
I have a condition checking if - The Field had been changed from 'any' to 'another'.
This works to fire off the email, but it also goes when the price in the sales order is initially created. How would I make it so that it only goes when the price is updated, but not originally set?
bpm image
By definition, a new record does not change from any to anything else. It's just a new record. So it's satisfying your condition block for false. If you had the logic reversed, you'd only get the email when the field were changed from something to something else... but never when a new record is created.
To handle this, you should add another condition block that checks for added rows. If that's false, point that to the existing condition block you have there for the field changing from any to another.
Add another condition as field RowMod = "U" for updated rows
Add a condition block after start that contains the following:
The Field had been changed from 0 to 'another'.
OR There is at least one added row in the OrderDtl table
Connect the false condition to your existing condition block. Remove your false condition connection and connect your true condition to the email. After that, the email will only be executed when the field is changed after being populated for the first time.
Resetting the price to zero will trigger an email, but the subsequent setting will not. If this is undesirablle, you can mitigate this by adding a UD field to track "first time populated", or enabling ChangeLog tracking and retraining to any undersirable behaviors.

Can i make a field editable for a specefic role "System Administrator" if the field type is calculated in the form

I am using a calculated field in a form (Data Type = Single Line of Text), however I would like to make this field editable for a specific users having "System Administrator" roles.
I tried using the field security profile to make this field editable (so that System Admin can update or create records here) however update/create options are disabled here in security profile and cannot be altered.
Is there an appropriate way to achieve this? Can we make a calculated field editable for specific set of roles?
No, you cannot directly edit the value of a calculated field.
A work-around would be to create a separate field, where only specific users can enter data. In your calculated field you could then add a condition to take either the manually entered value from the other field (if it exists) and otherwise use the original action for the calculated field.
The calculated field is calculated in SQL when you retrieve it, but is not stored in field.
So, for a calculated field there IS NOT a place to store a value. This makes it impossible to have the same field be calculated in some cases and manual in other cases.
You would need to have two fields the calculated fields and an override field. In the calculated field you set a condition that if the override field contains data the action is to set the calculated field equal to the override field. The else has an action to calculate the field as your normally.
Here is an example where I created a field testca(`new_testca') that will if the Account Number is populated use that value and if not its value will be some text I entered, "NEED ACCOUNT NUMBER".

Form validation rule MS-Access 2007

I have a simple form that gets used to enter information into a table. I want to use a validation rule on the form so that information gets entered correctly. I have a datetime object that must be filled out in a non-traditional form so I just want to check the length and make sure it is equal to 16. I have the following in the form which does not work
=Len([DISCHARGE DATETIME])=16
But when I put the same rule in the table and not in the form it works just fine, any ideas?
Dates should be stored in date data types. In a lot of DBs the date data type is numeric. In MS Access it is a decimal, the integer portion is a date and the decimal a time. It is not difficult to create a query that uses the Format function to modify output to suit an application.
SELECT Format(ThisDate,"yyyy-mm-dd hh:nn:ss") FROM ThisTable

Table Validation for my DateFrom and DateTo in MS Access

What can I put in my table to validate so my 'DateFrom' is always before my 'DateTo' so that I can get a popup box stating date from cannot be after date to?
I am currently playing with the Validation Rules and Validation text in the Table by using
<="DateTo"
But it is not validating!
Access won't let you reference another field in the Validation Rule for a field. Use the Validation Rule from the table's property sheet instead.
Make sure to enclose the field names in square brackets as illustrated. Otherwise, Access may enclose them with quotes. And that won't work because the rule would then be based on a comparison of two strings.
Also supply your own Validation Text message if you want something other than the error text Access displays when the rule is violated.

Resources