Implement regexp VFormat

Description

Coming from idea here:

… we could make an improvement to implement regular expression validation on AD_Column.VFormat - at this moment VFormat is very limited, but maybe we can add a new way to do regexp validation of values saved there, it can be for example if the VFormat starts with prefix ~ then it means is a regexp and we validate it on PO.save. That would make the VFormat really powerful.

Environment

None

Activity

Carlos Ruiz 
June 5, 2024 at 9:51 AM

Hi - I like the idea. If you can develop something like that please open a ticket and pull request.

Regards,

Carlos Ruiz

Martin Schönbeck 
June 5, 2024 at 9:14 AM

Hi ,

I just read about this feature in Diegos blog. I think it could things make easier if the format wasn’t entered in the column table directly but as a reference to a new table with validation formats. So you don’t have to enter a regex at several columns again, especially when changing something. It would also give the opportunity to implement new features e.g. for better error messages or check methods without affecting the columns.

Regards
Martin

Carlos Ruiz 
April 9, 2024 at 12:46 PM

Heng Sin Low 
April 9, 2024 at 11:48 AM

hi , yes, that looks fine to me.

Carlos Ruiz 
April 9, 2024 at 11:04 AM

that sounds possible - what if we look for a message with same code as the VFormat?

So, in my example below, if we find a message with Value = ~^[A-Za-záéíóúÁÉÍÓÚñÑüÜ][A-Za-záéíóúÁÉÍÓÚñÑüÜ\s-]*$

We use that message to replace in the InvalidFormatRegExp, in such case the message is more explanatory, like:

The entered value does not match the required regular expression: just alphabetic characters allowed separated by spaces

The italic part would be the message with the VFormat code.

Does that sound good?

Fixed

Details

Assignee

Reporter

Fix versions

Priority

Created April 8, 2024 at 1:22 PM
Updated June 5, 2024 at 9:51 AM
Resolved April 9, 2024 at 10:41 AM