Question

not operator

Hello Community,

I want to compare values. != operator is not working so how do i write the code in correct format.please find the attachment below.

Hoping for positive reply.

Like 0

Like

3 comments

Dear Manikanta,

Hope you are doing fine

It seems like you left  spacing between signs ! and = . The correct way is !=  Try to remove spacing and run the code again. If you still have any difficulties - let us know.

Best regards,

Dean

Dean Parrett,

Hello Parrett,

its still not working plz check my code

   Code:



this.addColumnValidator("UsrDate1",this.ageCalculator);

                this.addColumnValidator("Usrage123",this.ageCalculator);



        ageCalculator: function(value) {

            var age = 0;

            var date = document.getElementById("UsrDate1").value;

            var dateArr = date.split("-");

            var year = dateArr[0];

            var month = dateArr[1];

            var day = dateArr[2];

            var todayDate = new Date();

            if (day > todayDate.getDate() && month >= todayDate.getMonth() + 1) {

                age = (todayDate.getFullYear() - year) - 1;

            } else {

                age = todayDate.getFullYear() - year;

            }

            if (year !== 0 && year < todayDate.getFullYear()) {

                document.getElementById("Usrage123").value = age;

            } else {

                document.getElementById("Usrage123").value = "NA";

            }

        },





Can u please tell me,where it went wrong?

Dear Manikanta,



Your code isn`t working correctly due to wrong data retrieval. 

Use attributes instead of parsing document. 

Here is an example: https://academy.bpmonline.com/documents/technic-sdk/7-13/entityschemaqu…



Also, your way to manipulate date is not correct. 

Check the link: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Numbers_a…



Regards,

Alex

Show all comments