Jump to content
Sign in to follow this  
grumbachr

Must be Unique Except in one case.

Recommended Posts

Setting up a field to store IP address. I want the field to require a unique value except when its set to the value DHCP.

I'm never really dabbled with Validation other than default options when defining a field. I'd appreciate any help in getting me started in the right direction on this one.

TIA.

Share this post


Link to post
Share on other sites

That is exactly what I need and it works beautifully but could I ask you to help me understand it a little more? The logic is escaping me.

If I get it the first part, IPaddress = "DHCP", FM saying if the field is DHCP it okay and it passes validation.

but the , or IsEmpty (selfjoin::IPaddress), Is where i'm getting lost. The "IsEmty" FM is saying if the field (related field) is emtpy it passes validation.

But I don't see how it fails when they are the same.

Thank you so much for the example.

Share this post


Link to post
Share on other sites

The "IsEmty" FM is saying if the field (related field) is emtpy it passes validation. But I don't see how it fails when they are the same.

Since validation happens before record commit, it will not accept ANY IP except the first time it is created (because it expects NO related records). If there is ANY matching related record, it means that there is another identical IP already existing. And since we are validation ALWAYS and not only when the record is modified, the validation fires first and refuses to accept the duplicate IP.

But I hope you are seriously checking Comment's suggestion because another field holding the DHCP saves creating a selfjoin relationship at all.

Share this post


Link to post
Share on other sites

Yeah I'm looking at both. But really want to understand yours as validation by calculation is still foreign to me.

Although I wouldn't have thought of comments example on my own it was straight forward and easy to understand. Which for me might be the right choice in the end.

Thank you both for taking the time to post examples.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.