D2 Properties page validation with attribute substring value

Hello!

I'm trying to validate an attribute "Reference Number" with another attribute/ field "Sub Area" with substring of sub-area in D2's properties page while importing a document.

For example: if the sub-area is "5-Internal" then the Reference number should start with "5". If there's any other number, then it should be validated and given a error flag.

I tried applying uniqueness check but it doesn't work on the same object so I was wondering if there's any other way to validate one attribute based on the value of another in the same properties page ?

Let me know if there are any ideas.

Comments

  • I believe you can apply Regex function to validate the value.

  • Hi Johnny

    I applied regex which applies only numerical values with periods but I'm not sure how I can include the value of another attribute's substring to influence the regex.

    For example: I've applied this Regex ^\d+(.\d+)*$ which will limit it to numbers with periods.

  • Are you using the Advanced View editor for the property condition? You can use getValue(attribute) to evaluate other attribute values.

  • Advanced view editor is available for visibility, required condition but not for validation.
  • What version of D2 are you using?

  • its 16.4

    Here's what I see for validation:

  • Do these tabs exist at the object type level (not at attribute level)? I thought you could define constraints at the page level, such that you can reference different attribute values in your validation expression.

  • imranganath
    edited December 13, 2019 #9

    I'm sorry, I didn't quite get it. What do you mean object type level, does it have anything to do with the D2-Config ? Is it the Composer constraints that you're talking about ?

  • Sorry, I don't have access to D2 to verify. The constraint page you are showing is for specific attribute. Is there a config page for object type? See if there is validation constraint for object type.