Skip to main content
Question

API_DOQUERY Javascript add OR statement

  • June 7, 2019
  • 0 replies
  • 97 views

I have the following piece of code (this is the part I am having issues with):

 db.rnaRequests.doQuery({
      rid: {GTE:rid},
      analysisCopyRequired: "1",
      requestType: {CT: 'Research'}
    })

The JS is working properly. I just need to add an OR statement to the "requestType" query: I need to pick records containing either Research or Bookings.... any idea on how to add that into the current code? Thanks and sorry for the silly question. I just inherited this JS file. 
This topic has been closed for replies.

That syntax looks familiar - I would try the following: 

      rid: {GTE:rid},
      analysisCopyRequired: "1",
      or: [{requestType: 'Research'},{requestType: 'Bookings'}]


Chayce Duncan | Director of Strategic Solutions
(720) 739-1406 | chayceduncan@quandarycg.com
Quandary Knowledge Base

  • Author
  • Registered
  • June 7, 2019
Thanks a lot Chayce for such a prompt response. Almost there... but unfortunately it is only picking the 'Research' records and ignoring the 'Bookings'... Also, we would like to pick records under 'Research - Refresh' category as well, that's the reason of the usage of "CT" within the API call... any idea? 

Do you by chance have a link to the specific JS library you're using? Did you pull it from GitHub that you can provide here?

Regardless of the above - can you provide your updated query object? 

As far as the contains - you should be able to use the same format as you were for rid  - so 

      rid: {GTE:rid},
      analysisCopyRequired: "1",
      or: [{requestType: {'CT':'Research'}},{requestType: {'CT':'Bookings'}}]

Chayce Duncan | Director of Strategic Solutions
(720) 739-1406 | chayceduncan@quandarycg.com
Quandary Knowledge Base

  • Author
  • Registered
  • June 19, 2019
I would like to send you the js file we use. It is a local file, we don't pull from GitHub. Would you mind to let me know a way to share this privately? Thanks and regards. 


My email fine - its listed in my signature if you're fine sharing it that way and I can take a closer look. 

Chayce Duncan | Director of Strategic Solutions
(720) 739-1406 | chayceduncan@quandarycg.com
Quandary Knowledge Base

  • Author
  • Registered
  • June 28, 2019
Hey Chayce. I just want to inform that your previous suggestion totally worked! :) I was having issues but it was because of some misspellings there... but again, overall your solution is working perfectly. Thanks a lot for your support. 

Excellent! Thanks for the update!

Chayce Duncan | Director of Strategic Solutions
(720) 739-1406 | chayceduncan@quandarycg.com
Quandary Knowledge Base