if( ri!valueType_txt = "Ratio", if( and( like(ri!inputValue_txt, "*:*"), isnull( stripwith(ri!inputValue_txt, "1234567890:.") ), not( isnull(stripwith(ri!inputValue_txt, ":.")) ), left(ri!inputValue_txt) <> ":", right(ri!inputValue_txt) <> ":" ), "", cons!CR_APP_COV_THRESHOLD_VALIDATION_MSG[1] ), if( ri!valueType_txt = "Ratio:1", if( and( like(ri!inputValue_txt, "*:1"), isnull( stripwith(ri!inputValue_txt, "1234567890:.") ), not( isnull(stripwith(ri!inputValue_txt, ":.")) ), left(ri!inputValue_txt) <> ":", right(ri!inputValue_txt) <> ":" ), "", "Value is not in the format of m:1." ), if( ri!valueType_txt = cons!CR_APP_FIN_COV_VALUE_TYPES[3], if( and( len( stripwith(ri!inputValue_txt, "0123456789.") ) = 0, len(cleanwith(ri!inputValue_txt, ".")) < 2 ), if( and( len( cleanwith(ri!inputValue_txt, "0123456789") ) < 15 ), "", cons!CR_APP_COV_THRESHOLD_VALIDATION_MSG[3] ), cons!CR_APP_COV_THRESHOLD_VALIDATION_MSG[4] ), if( ri!valueType_txt = cons!CR_APP_FIN_COV_VALUE_TYPES[4], if( and( len( stripwith(ri!inputValue_txt, "0123456789.%") ) = 0, len(cleanwith(ri!inputValue_txt, ".")) < 2 ), "", cons!CR_APP_COV_THRESHOLD_VALIDATION_MSG[4] ), "" ) ) ) )
Hi Everyone, I am looking for a solution related to when valueType= "Ratio:1", then the upto 3 decimals on left side:1 ,need to restrict values which are entered more than 4 decimals in left only, How Can I do that,Can anyone help to do that?
Discussion posts and replies are publicly visible
Hello JS0001 I made changes to your provided code to meet your requirement. Validate once and let me know if that works for you.This ensures only values with a maximum of 3 decimals on the left side are allowed.
if( ri!valueType_txt = "Ratio", if( and( like(ri!inputValue_txt, "*:*"), isnull( stripwith(ri!inputValue_txt, "1234567890:.") ), not( isnull(stripwith(ri!inputValue_txt, ":.")) ), left(ri!inputValue_txt) <> ":", right(ri!inputValue_txt) <> ":" ), "", cons!CR_APP_COV_THRESHOLD_VALIDATION_MSG[1] ), if( ri!valueType_txt = "Ratio:1", if( and( like(ri!inputValue_txt, "*:1"), isnull( stripwith(ri!inputValue_txt, "1234567890:.") ), not( isnull(stripwith(ri!inputValue_txt, ":.")) ), left(ri!inputValue_txt) <> ":", right(ri!inputValue_txt) <> ":" ), "", "Value is not in the format of m:1." ), if( ri!valueType_txt = cons!CR_APP_FIN_COV_VALUE_TYPES[3], if( and( len( stripwith(ri!inputValue_txt, "0123456789.") ) = 0, len( index( split( left( ri!inputValue_txt, find(":", ri!inputValue_txt) - 1 ), "." ), 2, {} ) ) <= 3, ), if( and( len( cleanwith(ri!inputValue_txt, "0123456789") ) < 15 ), "", cons!CR_APP_COV_THRESHOLD_VALIDATION_MSG[3] ), cons!CR_APP_COV_THRESHOLD_VALIDATION_MSG[4] ), if( ri!valueType_txt = cons!CR_APP_FIN_COV_VALUE_TYPES[4], if( and( len( stripwith(ri!inputValue_txt, "0123456789.%") ) = 0, len(cleanwith(ri!inputValue_txt, ".")) < 2 ), "", cons!CR_APP_COV_THRESHOLD_VALIDATION_MSG[4] ), "" ) ) ) )
Hi ,I have tried with this code for the value Type=Ratio:1 type, Coz I needed validation for that value type(Ratio:1), I am getting this validation in ui
if( ri!valueType_txt ="Ratio", if( and( like(ri!inputValue_txt, "*:*"), isnull( stripwith(ri!inputValue_txt, "1234567890:.") ), not( isnull(stripwith(ri!inputValue_txt, ":.")) ), left(ri!inputValue_txt) <> ":", right(ri!inputValue_txt) <> ":" ), "", "Value is not in the format of m:n." ), if( ri!valueType_txt = "Ratio:1", if( and( like(ri!inputValue_txt, "*:1"), isnull( stripwith(ri!inputValue_txt, "1234567890:.") ), not( isnull(stripwith(ri!inputValue_txt, ":.")) ), left(ri!inputValue_txt) <> ":", right(ri!inputValue_txt) <> ":", len( stripwith(ri!inputValue_txt, "0123456789.") ) = 0, len( index( split( left( ri!inputValue_txt, find(":", ri!inputValue_txt) - 1 ), "." ), 2, {} ) ) <= 3, ), "", "Value is not in the format of m:1." ), if( ri!valueType_txt = "Amount", if( and( len( stripwith(ri!inputValue_txt, "0123456789.") ) = 0, len(cleanwith(ri!inputValue_txt, ".")) < 2 ), if( and( len( cleanwith(ri!inputValue_txt, "0123456789") ) < 15 ), "", "Value cannot be more than 14 digit numbers." ), "Invalid value entered." ), if( ri!valueType_txt = "Percentage", if( and( len( stripwith(ri!inputValue_txt, "0123456789.%") ) = 0, len(cleanwith(ri!inputValue_txt, ".")) < 2 ), "", "Invalid value entered." ), "" ) ) ) )
As you mentioned earlieruser can enter value as 5.6678435:1 format ,but instead of entering more that 3 decimals ,we need to restrict up to 3 decimals only.That what code is doing. It's restricting user using validation.JS0001 Am i missing something?
yes Now In the UI ,I have entered Upto 3 decimals but validation is throwing.
JS0001 Oh you mean you want validation for more than 3? 5.6678:1 :- Validation Should Show 5.667:1 :- Validation Shouldn't showIs that what you are expecting?
yeah exactly.
JS0001 Try this and let me know if that works for you
if( ri!valueType_txt = "Ratio", if( and( like(ri!inputValue_txt, "*:*"), isnull( stripwith(ri!inputValue_txt, "1234567890:.") ), not( isnull(stripwith(ri!inputValue_txt, ":.")) ), left(ri!inputValue_txt) <> ":", right(ri!inputValue_txt) <> ":" ), "", cons!CR_APP_COV_THRESHOLD_VALIDATION_MSG[1] ), if( ri!valueType_txt = "Ratio:1", if( and( like(ri!inputValue_txt, "*:1"), isnull( stripwith(ri!inputValue_txt, "1234567890:.") ), not( isnull(stripwith(ri!inputValue_txt, ":.")) ), left(ri!inputValue_txt) <> ":", right(ri!inputValue_txt) <> ":" ), "", "Value is not in the format of m:1." ), if( ri!valueType_txt = cons!CR_APP_FIN_COV_VALUE_TYPES[3], if( and( like(ri!inputValue_txt, "*:1"), len( index( split( left( ri!inputValue_txt, find(":", ri!inputValue_txt) - 1 ), "." ), 2, {} ) ) <= 3, ), if( and( len( cleanwith(ri!inputValue_txt, "0123456789") ) < 15 ), "", cons!CR_APP_COV_THRESHOLD_VALIDATION_MSG[3] ), cons!CR_APP_COV_THRESHOLD_VALIDATION_MSG[4] ), if( ri!valueType_txt = cons!CR_APP_FIN_COV_VALUE_TYPES[4], if( and( len( stripwith(ri!inputValue_txt, "0123456789.%") ) = 0, len(cleanwith(ri!inputValue_txt, ".")) < 2 ), "", cons!CR_APP_COV_THRESHOLD_VALIDATION_MSG[4] ), "" ) ) ) )
I am calculating for value type=Ratio:1 , Please provide calculation for ratio:1 type. I have sent code above.Valuetype is cons!CR_APP_FIN_COV_VALUE_TYPES[2] not cons!CR_APP_FIN_COV_VALUE_TYPES[3].
JS0001 You meancons!CR_APP_FIN_COV_VALUE_TYPES[2] holds "Ratio:1"cons!CR_APP_FIN_COV_VALUE_TYPES[1] holds "Ratio".
Check code as I changed based on above understanding.Let me know if that works for you.
if( ri!valueType_txt =cons!CR_APP_FIN_COV_VALUE_TYPES[1], if( and( like(ri!inputValue_txt, "*:*"), isnull( stripwith(ri!inputValue_txt, "1234567890:.") ), not( isnull(stripwith(ri!inputValue_txt, ":.")) ), left(ri!inputValue_txt) <> ":", right(ri!inputValue_txt) <> ":" ), "", cons!CR_APP_COV_THRESHOLD_VALIDATION_MSG[1] ), if( ri!valueType_txt = cons!CR_APP_FIN_COV_VALUE_TYPES[2], if( and( like(ri!inputValue_txt, "*:1"), isnull(stripwith(ri!inputValue_txt, "1234567890:.")), not(isnull(stripwith(ri!inputValue_txt, ":."))), left(ri!inputValue_txt) <> ":", right(ri!inputValue_txt) <> ":", len( index( split( left( ri!inputValue_txt, find(":", ri!inputValue_txt) - 1 ), "." ), 2, {} ) ) <= 3 ), "", "Value is not in the format of m:1." ), if( ri!valueType_txt = cons!CR_APP_FIN_COV_VALUE_TYPES[3], if( and( len( stripwith(ri!inputValue_txt, "0123456789.") ) = 0, len(cleanwith(ri!inputValue_txt, ".")) < 2 ), if( and( len( cleanwith(ri!inputValue_txt, "0123456789") ) < 15 ), "", cons!CR_APP_COV_THRESHOLD_VALIDATION_MSG[3] ), cons!CR_APP_COV_THRESHOLD_VALIDATION_MSG[4] ), if( ri!valueType_txt = cons!CR_APP_FIN_COV_VALUE_TYPES[4], if( and( len( stripwith(ri!inputValue_txt, "0123456789.%") ) = 0, len(cleanwith(ri!inputValue_txt, ".")) < 2 ), "", cons!CR_APP_COV_THRESHOLD_VALIDATION_MSG[4] ), "" ) ) ) )
Hi, Shubham, it worked,Thanks for that Can I get one more suggestion? For the value type= cons!CR_APP_FIN_COV_VALUE_TYPES[3] or Amount field in the above code, Type of that column has to take input has integer value, Now the field is accepting decimal values. How can we make changes to the existing code?