How to compare database input with another input using case sensitivity?
- January 19, 2021
- 2 replies
- 1813 views
hiii,
i have one javascript where i have one database service called to getWorkoutName.
Now i want to compare that workout names with the input by using case sensitive. here is a javascript code which is giving me database workoutnames. when i am giving input "pushup" then result is showing already exist which is correct output but when i am giving an input "Pushup" then it's showing result as "Error executing service caseSensitive. Message :: TypeError: Cannot call method "toLowerCase" of null" instead of "already exist" so help me with this peoblem.
javascript:-
// result: INFOTABLE dataShape: ""
var result1 = Things["Database"].getWorkoutName({
workout_name: workout_name /* STRING */
});
var name1 = result1.workout_name;
var a = name1.toLowerCase();
var name2 = workout_name.toLowerCase();
if(name2.toLowerCase() === name1.toLowerCase())
{
result = ' Already exists';
}
else
{
result = ' Not Exists';
}
below are some snapshots of output please refer for better understanding;

