1. How to put validation in spreadsheet when i'm getting data dynamically their are data coming key value pair.So how to validate every column based on requirement.Please help me to solve this problem. Thanks
Martin
Telerik team
commented on 02 Jun 2022, 09:05 AM
You can use the Range validation method to dynamically set validation for a range. Let me know if that would be helpful.
Yes Thank you range validation working good but i have another issue related to that for numerical type data it's not validating max length
I have apply like this
sheet.range("AM2:AM30").validation({ dataType: "custom", from: "AND(ISNUMBER(AM2),LEN(AM2)<20)", allowNulls: true, type: "reject", titleTemplate: "2022 validation error", messageTemplate: "Please enter numeric value with less than 20 digits." });
do i need to change the code ?
Martin
Telerik team
commented on 07 Jun 2022, 09:26 AM
The LEN formula only applies for text, I am afraid it will not apply for digits. A possible approach would be to check if the value is greater than a specific number:
sheet.range("A2:A30").validation({
dataType: "custom",
from: "AND(ISNUMBER(A2),A2<=2000000)",
to:999,
allowNulls: true,
type: "reject",
titleTemplate: "2022 validation error",
messageTemplate: "Please enter numeric value with less than 20 digits."
});
Yes Thank you range validation working good but i have another issue related to that for numerical type data it's not validating max length
I have apply like this
sheet.range("AM2:AM30").validation({
dataType: "custom",
from: "AND(ISNUMBER(AM2),LEN(AM2)<20)",
allowNulls: true,
type: "reject",
titleTemplate: "2022 validation error",
messageTemplate: "Please enter numeric value with less than 20 digits."
});
do i need to change the code ?
The LEN formula only applies for text, I am afraid it will not apply for digits. A possible approach would be to check if the value is greater than a specific number:
sheet.range("A2:A30").validation({ dataType: "custom", from: "AND(ISNUMBER(A2),A2<=2000000)", to:999, allowNulls: true, type: "reject", titleTemplate: "2022 validation error", messageTemplate: "Please enter numeric value with less than 20 digits." });