Property Validation by Dynamic Length

Hi All,

I need an edit to validate the rule with a dynamic length parameter.

Scenario: I have a list (the number is unknown) in this list keeping types of properties. If the property type is text, the maximum length is set for each text type. This data is kept in the clipboard and comes to the UI using the repeating dynamic layout (I’m using the same property for each text field). I need to verify different lengths for each text, how can I do this?

For Example;

Option(1); Name:Text1 / Type:Text / Length:5

Option(2); Name:Text2 / Type:Text / Length:10

Option(3); Name:Text3 / Type:Text / Length:15

Note: I can do this with activity but I want to use it on the Client-Side. I want to show an error message without any action if the text is shorter than the length.

I want to use dynamic parameters instead of “5” in java source code. Is it possible? Or is there any other way to do this?

if (theValue.length() > 5){
  theProperty.addMessage("Text should be equal or shorter than 5");
  return false;
}
return true;

Hi @BoraAvar,

You can write a validation rule by using the function (length of [a pagelist property] is [comparison operator] [value])

In “length of” you need to provide the property name and is comparision operator you need to choose greater than 5 characters.

I hope this will helps you

@KamineniSurya Hi Kamineni, I already made a change as similar you said, but forgot to write it here. I created the edit Validate rule as follows code and its works fine. Thank you for your answer.

boolean isValid = true;

ClipboardPage parentPage = theProperty.getParentPage();
int Length = Integer.parseInt(parentPage.getProperty("Length").getStringValue());

	if (theValue.length() > Length) {
		 theProperty.addMessage("Text should be equal or shorter than " + Length);
     isValid = false;
	}
return isValid;