Project and Portfolio Management Practitioners Forum
cancel

New Custom Validation

SOLVED
Go to solution
Highlighted
Raj Ghimire
Outstanding Contributor.

New Custom Validation

Hi Everyone,

 

Can anyone give me any suggestion on how I can create a  new custom validation which only allows combination of two custom validations below.

 

I my case:

  • I have one field with custom text validation (\A\BDDD) which only allows 'ABxxx' , where x = any no between 0-9
  • And a second field with another custom text validation (\E\FDDD) which allows 'EFxxx' , where x = any no between 0-9

But now, I am in need of a third field which can allow either 'ABxxx' OR 'EFxxx' and nothing else , kind of like combination of above two fields. 

 

Thanks in advance !

 

Thanks.

-Raj

6 REPLIES
d4y4n4
Honored Contributor.
Solution

Re: New Custom Validation

Hi Raj,

This is not possible using a field text custom valadation, I found simialar ER for this https://support.openview.hp.com/selfsolve/document/FID/DOCUMENTUM_QCCR1L35389.

The only workaround I can think is to use a custom auto complete list that contains all the possible combinations, but it will be a long list.

Hope this helps.
Regards,
Dayana
Raj Ghimire
Outstanding Contributor.

Re: New Custom Validation

Thank you Dayana.  In that case, I guess I don't waste too much time on that front and simply use LLDDD for now then :-( 

 

Thanks for the update !

 

Jim Esler
Acclaimed Contributor.

Re: New Custom Validation

The OOTB capability to describe the format of a text field is very limited and only handles very simple cases. Much more complex formats can be checked with sql queries. We use the following in a rule to validate a value and place an error message into a read-only text field. This particular rule is used in a table component so we do not have the option to clear the bad value. That is an option available on a request field. The field is defined as Text - 4. Regular expressions can define almost any rules you can imagine.

 

select 'x',
decode(regexp_instr('[TE.VP.TRANSACTION_ID]',chr(91)||'^A-Z0-9$@#./-_%&?!:|=,;<>'||chr(93)),0,'','<!--HTML--> <b><font color="#B22222">Transaction ID contains invalid characters')
from dual

Raj Ghimire
Outstanding Contributor.

Re: New Custom Validation

Thanks Jim .. smart solution !

Looks like your below query simply checks for unlimited A-Z characters in any number . This sure gets you what custom validation format LLDDD couldn't.  But would you have any suggestion on how I can actually validate for only 'ABxxx' and 'DExxx' ? The catch in my case is that I can only have the characters literally starting with either 'AB' or 'DE' and then followed by 3 single digit numbers.

In my case:

Valid: AB345, DE876

Invalid: ABD345, AB34

 

I actually tried last week to go sql valdiation this way.. just wasn't able to come up with correct query :-( ..

just don't want to go procedure route though..

 

Thanks.

-Raj

Erik Cole
Acclaimed Contributor.

Re: New Custom Validation

Maybe try something like

 

select case when REGEXP_LIKE ('DE999', '^(AB|DE)[0-9]{3}$') then 'YES' else 'NO' End from dual

 

and replace the 'DE999' with some test string values, but I think it meets your condition...

Raj Ghimire
Outstanding Contributor.

Re: New Custom Validation

Thanks Erik ! 

Looks interesting ...I will check this one out too .. it probably works as well . :-)

 

but I was working with one of our other Oracle Developer which seems to have passed a couple of testings I did a while ago.. :-)

 

SELECT case

when

REGEXP_SUBSTR('AB144','AB([[:digit:]]+){3,3}/?')isnotnullthen'Valid'

when

REGEXP_SUBSTR('AB144','DE([[:digit:]]+){3,3}/?')isnotnullthen'Valid'

else'Invalid '

end result

FROM dual;

 

Thanks again !!

 

-Raj