Want to get rid of Google Ads, click here.
+ Reply to Thread
Results 1 to 9 of 9

Thread: How to query a null value in javascript

  1. #1
    Junior Member
    Join Date
    Jul 2008
    Posts
    18

    Unhappy How to query a null value in javascript

    Is there any one know how to query a null value field in the javascript?

    e.g.

    I want search ticket with resolution is Null. I used code below. But it doesn't work.

    var incidentFile =newSCFile("probsummary");

    var rc =incidentFile.doSelect("resolution=NULL");




    Thanks.
    Last edited by fiona; 2008-08-01 at 15:29.

  2. #2

    Default

    Hace you tried "" insted of null?

  3. #3
    Junior Member
    Join Date
    Jul 2008
    Posts
    18

    Default

    Thanks chenrich. I tried. It doesn't work too.

  4. #4

    Default

    Are you sure? Have you tested it like this?

    Code:
    
    var rc =incidentFile.doSelect("resolution=\"\"");
    

  5. #5
    Senior Member glg's Avatar
    Join Date
    Aug 2004
    Location
    Chicago, IL, USA
    Posts
    715

    Default

    when using doSelect, you want the query to be in SC format, not anything JS. So, "resolution=NULL" should work, as should "null(resolution)".

  6. #6

    Default

    The Null descriptor is not alwas set. If you want to search a filed in which nothing is inserted then you have to check for an empty string (""). because the field isor was instancieated!

  7. #7
    Junior Member
    Join Date
    Jul 2008
    Posts
    18

    Default

    I did debug.

    1. print(incidentFile.resolution);

    It is print out

    [C++ object Datum] @0x01a2b8d8 - {}

    for resolution when there is nothing there.

    2. print(incidentFile.resolution[0]);

    It is print out

    null

    for resolution when there is nothing there.

    3. print(incidentFile.resolution.length());

    It is print out

    0

    for resolution when there is nothing there.

    I think I can only use the length. How to use the length in the query?

  8. #8
    Senior Member mateuszk's Avatar
    Join Date
    Nov 2006
    Posts
    302

    Default

    Quote Originally Posted by fiona View Post
    var incidentFile =newSCFile("probsummary");
    var rc =incidentFile.doSelect("resolution=NULL");
    queries in JS doSelect follow the same rules as all queries in SC.

    var rc = incidentFile.doSelect("null(resolution)");

    it's the all same with operators like "isin" or functions i.e. "index".

  9. #9
    Junior Member
    Join Date
    Jul 2008
    Posts
    18

    Default

    Thanks, mateuszk. It works.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

     

Bookmarks

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts