cancel
Showing results for 
Search instead for 
Did you mean: 

Validation for multiple occurrences of values..

Former Member
0 Kudos

I have a requirement to have a field that flags items as promotional items in the main catalog. This field can only have values "P1" through "P5" or <blank>.

I have made it a lookup field, so we can populate only the above listed values.

However, the dicey part is to have a validation to check for multiple occurrences of the flags i.e.

P1 or P2 ... (etc) can be assigned to only one item at a time. Of course <blank> can be assigned to as many items as we wish. In short, only 5 items can be on promotion at any given time.

The challenge is to write a validation that would check for multiple occurrences of P1-P5 values and throw an error if need be.

Anyone can think of a validation that would help me do it?

Thanks

Anshuman

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Anshuman,

Can you just set that field to Unique=Yes in the Console? This should stop any duplicate instances from being entered without needing to write a validation.

Thanks,

Tim

Former Member
0 Kudos

hey .. Thanks for your response.

However, in my case, the <null> value would repeat. So, can't mark the field it as "unique".

As I did mention already, except for just 5 specific items, rest of them would be have flag set to <blank> (null).

I hope i am making sense there!!

Thanks

Anshuman

Former Member
0 Kudos

The blank (null) values will still be allowed by setting it to unique. It just won't allow the values from the lookup table to be added more than once.

Former Member
0 Kudos

Will try that.

Thanks again Tim for your time and support.

Cheers!!

Anshuman

Former Member
0 Kudos

And it works Tim.

Thanks.

Anshuman.