Page 2 of 2

Using dynamic request parameters for server code requests

Posted: Sun Jul 14, 2013 11:53 am
by samwiltshire

Thanks, it has been shared with the email above and the name is Ludus247.


Using dynamic request parameters for server code requests

Posted: Sun Jul 14, 2013 1:11 pm
by Igor

"filterService" doesn't return values because it requesting incorrect id.
Please try to add alert on service response and test once more.
pre
Image
/pre


Using dynamic request parameters for server code requests

Posted: Wed Jul 17, 2013 10:20 pm
by samwiltshire

Thanks for that - I have added the alerts, however, I am still at a loss on how I am supposed to use an ID that isn't the primary ID. For example, I am tying the users to the Teams collection by the 'user id' and 'username' columns in Teams however I can't seem to work out how I can then use the corresponding row in Teams without the unique _ID.

Hope this makes sense!


Using dynamic request parameters for server code requests

Posted: Thu Jul 18, 2013 9:56 am
by Maryna Brodina

Hello! Please clarify what data you store and where, what are you trying to get?


Using dynamic request parameters for server code requests

Posted: Thu Jul 18, 2013 4:17 pm
by samwiltshire

Ok, well I have a table called 'Teams' which has the columns:

  • teams

  • username

  • user id

  • _id etc

    I would like to query the database to get the data in 'teams' for the 'user id' or 'username' (I have both stored as a localStorage variable). Can you do this without the '_id'?


Using dynamic request parameters for server code requests

Posted: Thu Jul 18, 2013 5:12 pm
by Kateryna Grynko

Hi,

Create request service with "where" parameter, map "user_id" to it and add the following JavaScript code for "where" parameter:
codereturn '{"user id": "' + value + '" }'/code
Please check the spelling of the field name: "user_id" or "user id".


Using dynamic request parameters for server code requests

Posted: Sat Jul 20, 2013 2:17 pm
by samwiltshire

Sorry, do you mean create a brand new service? Or to add a request parameter, 'where' on my existing, 'filterServerCode' service?


Using dynamic request parameters for server code requests

Posted: Sun Jul 21, 2013 4:55 pm
by maxkatz

Add 'where' parameter to existing service.