cancel
Showing results for 
Search instead for 
Did you mean: 

need help in java script receiving a small error ; is missing

devaprakash_b
Active Contributor
0 Kudos

Hi Experts,

please find my code in the below attached file. I am receiving the error that at line 15 ; is expected. I have even placed the ; at the end of the line but still it is not working. can you kindly help me in this regards.

Regards,

DP

Accepted Solutions (1)

Accepted Solutions (1)

former_member2987
Active Contributor
0 Kudos

Please paste in as code.

devaprakash_b
Active Contributor
0 Kudos

// Main function: hei_getIdentityDateEmailReady

function hei_getIdentityDateEmailReady(Par){

//mskey of the mx_person entry type would be passed as the parameter

    var script            = "hei_getIdentityDateEmailReady::";

    logLevel            = uGetConstant("glb.HEI_LOG_LEVEL");

    selectDelimiter        = "!!"; // used for delimiting the two column values returned by query

    queryDelimeter        = "|"; // user for delimiting the bulk records;

    // the below query returns the results in the format Attribute and mcValue, for attributes which are empty it returns Null values

    Var query =  "with CTe as (" +

        "select 'MX_FS_SALUTATION_ID' as Attribute,1 as SNO union " +

        "select 'MX_LASTNAME' as Attribute,2 as SNO union " +

        "select 'MX_FIRSTNAME' as Attribute,3 as SNO union " +

        "select 'MX_NICKNAME' as Attribute,4 as SNO union " +

        "select 'MX_INITIALS' as Attribute,5 as SNO union " +

        "select 'DISPLAYNAME' as Attribute,6 as SNO union " +

        "select 'HEI_IDEN_USER_ACCOUNT_ID' as Attribute,7 as SNO union " +

        "select 'MSKEYVALUE' as Attribute,8 as SNO union " +

        "select 'MX_FS_EMPLOYEE_GROUP_ID' as Attribute,9 as SNO union " +

        "select 'HEI_IDEN_INITIAL_HIRING_DATE' as Attribute,10 as SNO union " +

        "select 'HEI_IDEN_LEAVING_DATE' as Attribute,11 as SNO union " +

        "select 'MX_FS_EMPLOYMENT_STATUS_ID' as Attribute,12 as SNO union " +

        "select 'HEI_IDEN_ADDRESS_REGION_CODE' as Attribute,13 as SNO union " +

        "select 'MX_FS_PERSONNEL_AREA_ID' as Attribute,14 as SNO union " +

        "select 'HEI_IDEN_OPERATING_COMPANY_ID' as Attribute,15 as SNO union " +

        "select 'MX_FS_COMPANY_CODE_ID' as Attribute,16 as SNO union " +

        "select 'HEI_IDEN_JOB_FUNCTION_ID' as Attribute,17 as SNO union " +

        "select 'MX_FS_PERSONNEL_SUBAREA_ID' as Attribute,18 as SNO union " +

        "select 'MX_FS_ORGANIZATIONAL_UNIT' as Attribute,19 as SNO union " +

        "select 'MX_FS_POSITION' as Attribute,20 as SNO union " +

        "select 'MX_MANAGER' as Attribute,21 as SNO union " +

        "select 'MX_COSTCENTER' as Attribute,22 as SNO union " +

        "select 'MX_FS_PERSONNEL_NUMBER' as Attribute,23 as SNO union " +

        "select 'HEI_IDEN_LOCAL_EMPLOYEE_CODE' as Attribute,24 as SNO union " +

        "select 'MX_MAIL_PRIMARY' as Attribute,25 as SNO union " +

        "select 'HEI_IDEN_LYNC_ADDRESS' as Attribute,26 as SNO union " +

        "select 'MX_PHONE_PRIMARY' as Attribute,27 as SNO union " +

        "select 'MX_MOBILE_PRIMARY' as Attribute,28 as SNO union " +

        "select 'MX_WORKPLACE_BUILDING' as Attribute,29 as SNO union " +

        "select 'MX_WORKPLACE_ROOM' as Attribute,30 as SNO union " +

        "select 'HEI_IDEN_STATUS_VALUE' as Attribute,31 as SNO union " +

        "select 'MX_LANGUAGE' as Attribute,32 as SNO union " +

        "select 'MX_USERTYPE' as Attribute,33 as SNO union " +

        "select 'MX_ADMIN_UNIT' as Attribute,34 as SNO union " +

        "select 'MX_TIMEZONE' as Attribute,35 as SNO  " +

        ")select SNO,Attribute,mcSearchValue from CTe " +

        "left outer join (select * from idmv_vallink_basic with (nolock) where MSKEY = " +Par+ " ) A on Attribute = mcAttrName  " +

        "order by SNO";

    if(logLevel >= 2) {

        uErrMsg(1, script + "Par: [" + Par + "]; query: [" + query + "]");

    }

    var retVal            = uSelect(query);

    var tempArr            = retVal.split(queryDelimeter); // To separate each row and save it in the array list

    retValue = "";

    for (i=0;i<tempArr.length;i++) // this is used for iterating the array

    {

        tempArr1 = tempArr[i].split(selectDelimiter); // here the columns returned by the above query are delimited using !!

    

        switch (tempArr1[0])

        {

            CASE :  "MX_FS_SALUTATION_ID"

            retValue  =  retValue  +  "Form-of-Address: "  +  tempArr1 [i] +  "\n";

            break;

            CASE :  "MX_LASTNAME"

            retValue  =  retValue  +  ""Last name: ""  +  tempArr1 [i] +  "\n";

            break;

            CASE :  "MX_FIRSTNAME"

            retValue  =  retValue  +  "First name: "  +  tempArr1 [i] +  "\n";

            break;

            CASE :  "MX_NICKNAME"

            retValue  =  retValue  +  "Known as: "  +  tempArr1 [i] +  "\n";

            break;

            CASE :  "MX_INITIALS"

            retValue  =  retValue  +  "Initials: "  +  tempArr1 [i] +  "\n";

            break;

            CASE :  "DISPLAYNAME"

            retValue  =  retValue  +  "Displayname: "  +  tempArr1 [i] +  "\n";

            break;

            CASE :  "HEI_IDEN_USER_ACCOUNT_ID"

            retValue  =  retValue  +  "Useraccount ID: "  +  tempArr1 [i] +  "\n";

            break;

            CASE :  "MSKEYVALUE"

            retValue  =  retValue  +  "Unique ID: "  +  tempArr1 [i] +  "\n";

            break;

            CASE :  "MX_FS_EMPLOYEE_GROUP_ID"

            retValue  =  retValue  +  "Employee Group: "  +  tempArr1 [i] +  "\n";

            break;

            CASE :  "HEI_IDEN_INITIAL_HIRING_DATE"

            retValue  =  retValue  +  "Initial Hiring Date: "  +  tempArr1 [i] +  "\n";

            break;

            CASE :  "HEI_IDEN_LEAVING_DATE"

            retValue  =  retValue  +  "Leaving Date: "  +  tempArr1 [i] +  "\n";

            break;

            CASE :  "MX_FS_EMPLOYMENT_STATUS_ID"

            retValue  =  retValue  +  "Employment Status: "  +  tempArr1 [i] +  "\n";

            break;

            CASE :  "HEI_IDEN_ADDRESS_REGION_CODE"

            retValue  =  retValue  +  "Region Code: " +  tempArr1 [i] +  "\n";

            break;

            CASE :  "MX_FS_PERSONNEL_AREA_ID"

            retValue  =  retValue  +  "Personnel Area: "  +  tempArr1 [i] +  "\n";

            break;

            CASE :  "HEI_IDEN_OPERATING_COMPANY_ID"

            retValue  =  retValue  +  "Business Unit/Operating Company: "  +  tempArr1 [i] +  "\n";

            break;

            CASE :  "MX_FS_COMPANY_CODE_ID"

            retValue  =  retValue  +  "Financial Legal Entity: "  +  tempArr1 [i] +  "\n";

            break;

            CASE :  "HEI_IDEN_JOB_FUNCTION_ID"

            retValue  =  retValue  +  "Functional Area / Global Function: "  +  tempArr1 [i] +  "\n";

            break;

            CASE :  "MX_FS_PERSONNEL_SUBAREA_ID"

            retValue  =  retValue  +  "Personnel Subarea: "  +  tempArr1 [i] +  "\n";

            break;

            CASE :  "MX_FS_ORGANIZATIONAL_UNIT"

            retValue  =  retValue  +  "Organizational Unit Text: "  +  tempArr1 [i] +  "\n";

            break;

            CASE :  "MX_FS_POSITION"

            retValue  =  retValue  +  "Position Text: "  +  tempArr1 [i] +  "\n";

            break;

            CASE :  "MX_MANAGER"

            retValue  =  retValue  +  "Manager: "  +  tempArr1 [i] +  "\n";

            break;

            CASE :  "MX_COSTCENTER"

            retValue  =  retValue  +  "Cost Center: "  +  tempArr1 [i] +  "\n";

            break;

            CASE :  "MX_FS_PERSONNEL_NUMBER"

            retValue  =  retValue  +  "Personnel Number: "  +  tempArr1 [i] +  "\n";

            break;

            CASE :  "HEI_IDEN_LOCAL_EMPLOYEE_CODE"

            retValue  =  retValue  +  "Local Employee Code: "  +  tempArr1 [i] +  "\n";

            break;

            CASE :  "MX_MAIL_PRIMARY"

            retValue  =  retValue  +  "Primary E-Mail: "  +  tempArr1 [i] +  "\n";

            break;

            CASE :  "HEI_IDEN_LYNC_ADDRESS"

            retValue  =  retValue  +  "Lync Address: "  +  tempArr1 [i] +  "\n";

            break;

            CASE :  "MX_PHONE_PRIMARY"

            retValue  =  retValue  +  "Primary Telephone Number: "  +  tempArr1 [i] +  "\n";

            break;

            CASE :  "MX_MOBILE_PRIMARY"

            retValue  =  retValue  +  "Primary Mobile Number: "  +  tempArr1 [i] +  "\n";

            break;

            CASE :  "MX_WORKPLACE_BUILDING"

            retValue  =  retValue  +  "Building Code: "  +  tempArr1 [i] +  "\n";

            break;

            CASE :  "MX_WORKPLACE_ROOM"

            retValue  =  retValue  +  "Room Number: "  +  tempArr1 [i] +  "\n";

            break;

            CASE :  "HEI_IDEN_STATUS_VALUE"

            retValue  =  retValue  +  "Identity Status: "  +  tempArr1 [i] +  "\n";

            break;

            CASE :  "MX_LANGUAGE"

            retValue  =  retValue  +  "Language: "  +  tempArr1 [i] +  "\n";

            break;

            CASE :  "MX_USERTYPE"

            retValue  =  retValue  +  "User Type: "  +  tempArr1 [i] +  "\n";

            break;

            CASE :  "MX_ADMIN_UNIT"

            retValue  =  retValue  +  "User Group: "  +  tempArr1 [i] +  "\n";

            break;

            CASE :  "MX_TIMEZONE"

            retValue  =  retValue  +  "Time Zone: "  +  tempArr1 [i] +  "\n";

            break;        

        }

    }

    if(logLevel >= 2) {

        uErrMsg(1, script + "Par: [" + Par + "]; retvalue: [" + retValue + "]");

    }

    return retValue;

}

jaisuryan
Active Contributor
0 Kudos

Hi DP,

In line,

Var query =  "with CTe as (" +

the 'v' in Var should be small. So it should be

var query =  "with CTe as (" +



This should solve ";" missing error. Other than that I can see few scripting errors. Consider reviewing fully once. Thanks.


Kind regards,

Jai

Message was edited by: Jai Suryan

devaprakash_b
Active Contributor
0 Kudos

thanks jai,

Other error i found they are the case syntax errors

jaisuryan
Active Contributor
0 Kudos

Hi DP,


Glad its solved now. Please close the thread. Thanks.

Kind regards,

Jai

former_member2987
Active Contributor
0 Kudos

Please mark Jai's answer as correct.

Matt

Answers (1)

Answers (1)

devaprakash_b
Active Contributor
0 Kudos

Hello experts,

Received runtime exception while executing the below script. based on the hint when i have looked at the line 27 i couldn't find the '.' in the script. kindly please help me

RuntimeException - org.mozilla.javascript.EvaluatorException: uSelect(select [priv].SNO,[priv].ATTRIBUTE,A.searchvaluefrom dbo.priv_notification_attribute [priv]left join (select MSKEY,AttrName,SearchValue from idmv_value_basic with (nolock) where MSKEY =216) A on priv.ATTRIBUTE = A.attrname) got exception com.microsoft.sqlserver.jdbc.SQLServerException: Incorrect syntax near '.'. HINT: Check line 27 in the script hei_l_getIdentityDateEmailReady

// Main function: hei_l_getIdentityDateEmailReady

function hei_l_getIdentityDateEmailReady(Par){

//mskey of the mx_person entry type would be passed as the parameter

   

    var script            = "hei_getIdentityDateEmailReady::";

    logLevel            = uGetConstant("glb.HEI_LOG_LEVEL");

    selectDelimiter        = "!!"; // used for delimiting the two column values returned by query

    queryDelimeter        = "|"; // user for delimiting the bulk records;   

   

    if(logLevel >= 2) {

        uErrMsg(1, script + "Par: [" + Par + "]");

    }

    // the below query returns the results in the format Attribute and mcValue, for attributes which are empty it returns Null values

   

    var query =  "select [priv].SNO,[priv].ATTRIBUTE,A.searchvalue" +

                 "from dbo.priv_notification_attribute [priv]" +

                 "left join (select MSKEY,AttrName,SearchValue from idmv_value_basic  with (nolock)                    where MSKEY =" + Par + ") A " +

                 "on priv.ATTRIBUTE = A.attrname"

                 "Order by [priv].SNO;";

   

    var retVal            = uSelect(query);

    var tempArr            = retVal.split(queryDelimeter); // To separate each row and save it in the array list

   

    retValue = "";

   

   

    for (i=0;i<tempArr.length;i++) // this is used for iterating the array

    {

        tempArr1 = tempArr[i].split(selectDelimiter); // here the columns returned by the above query are delimited using !!

       

        switch (tempArr1[0])

        {

            case 'MX_FS_SALUTATION_ID' :

            retValue  =  retValue  +  "Form-of-Address: "  +  tempArr1 [i] +  "\n";

            break;

            case 'MX_LASTNAME' :

            retValue  =  retValue  +  "Last name: "  +  tempArr1 [i] +  "\n";

            break;

        }

    }

   

    if(logLevel >= 2) {

        uErrMsg(1, script + "Par: [" + Par + "]; retvalue: [" + retValue + "]");

    }   

   

    return retValue;

}

peterwass
Explorer
0 Kudos

You're missing a plus after priv.Attribute = A.attrname"  <-- here

Peter

devaprakash_b
Active Contributor
0 Kudos

Hi Peter,

Thanks for your reply. I have tried that too, but same error.

peterwass
Explorer
0 Kudos

Hi DP

I'm not sure what you're actually trying to achieve with this script (or the one above) but it looks like you're making life very hard for yourself.  What do you actually need to do?

It looks like you're getting attributes which are dynamic but then ignoring them if they aren't the two specified.  You'd find it much better and faster to just retrieve the two attributes directly from the object.

Anyway -

Your priv.ATTRIBUTE is not in [] but every other one is, including the name declaration.

You have spaces between tempAttr1 [i].

You don't need the semi-colon in the query string.

For consistency, you should probably put var in front of selectDelimiter and queryDelimiter although, given that they're only used once you could ditch them and just use literals.

Peter

former_member2987
Active Contributor
0 Kudos

D P,

This should be posted as a separate question.

Thanks,

Matt

IDM Space Moderator