Hitachi Vantara Pentaho Community Forums
Results 1 to 2 of 2

Thread: fireToDB inconsitent results

  1. #1
    Join Date
    Aug 2008
    Posts
    27

    Default fireToDB inconsitent results

    I am attempting to retrieve values from a database use fireToDB from within a Javascript. When the query returns data, everything is fine. However, when the query returns nothing, I receive the error:

    Java class "java.lang.Object" has no public instance field or method named "0". (script#40)

    After reading previous posts, I am testing for null, however the test for null is the line generating the error. Any help would be greatly appreciated. Here is the code:

    sql =
    "select NewKey from xlate where TableName = \"SOMETABLE\" and FieldName = \"SOMECOLUMN\" ";

    rslt =
    fireToDB("sqllite",sql);

    if ( rslt != null )
    if ( rslt[0] == null ) <-------------The error occurs here
    Alert("not found");
    else

    Alert("found");

    else

    Alert("not found");

    Changing the test from rslt[0] to rslt[0][0] yields identical results

    TIA,
    Gene

  2. #2
    Join Date
    Aug 2008
    Posts
    27

    Default

    As usual, this error is a result of my carelessness, and not that of the product. As it turns out, the error was in my SQL.

    For the benefit of others who may run into this problem, be sure that the SQL is valid. References to columns which do not exist, or syntactically incorrect sql will generate this error. For example:

    xArr = fireToDB( "connection", "Bad sql");

    While the return value xArr is not null, and will not cause an error, any reference to xArr[0] or xArr[0][0] will give the result:

    Java class "java.lang.Object" has no public instance field or method named "0"

    I hope this helps any others who have had this problem.

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.