Hitachi Vantara Pentaho Community Forums
Results 1 to 3 of 3

Thread: Javascript compare

  1. #1

    Default Javascript compare

    This is some pretty basic Javascript stuff, but driving me a little crazy:

    I have this simple code:
    var pass_fail = "";
    if (SRC_COUNT == DM_COUNT)
    pass_fail = "PASS";
    pass_fail = "FAIL";
    When SRC_COUNT is equal to DM_COUNT, it ends up setting "FAIL" to the variable "pass_fail" If I use "=" instead of "==" it correctly writes "PASS" to the stream.

    Shouldn't "==" be correct to use to compare two values? SRC_COUNT and DM_COUNT are two values passed from the stream and not variables in the javascript itself--does that make a difference?

  2. #2
    Join Date
    Jun 2012


    So long, and thanks for all the fish.

  3. #3


    Thanks. I tried:

    if (parseInt(SRC_COUNT) == parseInt(DM_COUNT))
    And that worked.

    I noticed before with this code that just using "==" by itself wasn't working regardless of whether compatibility mode was on or off. Is the above method using parseInt the recommended way to compare two numbers always? We've just used "==" before, and it had seemed to work fine. Only thing that might be different here is the two numbers being compared come from two different data sources via a join step (as you might have guessed from the var names), but both are the result of a count and both data sources are Oracle....


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
Privacy Policy | Legal Notices | Safe Harbor Privacy Policy

Copyright © 2005 - 2019 Hitachi Vantara Corporation. All Rights Reserved.