anshika
Posts: 0
Joined: Fri Feb 06, 2015 11:59 am

Inner join in appery.io

i need to fetch data from two tables on the basis :
i have two tables "questions" and "answers" and i need to show number of answers per question on the ui screen (one to many relation);

i had tried the following:
1) i had invoked this

// Get the user with a given username from the database
var XHRResponse = XHR.send("GET", "{database_url}/collections/AnswersComments", {

Code: Select all

 "parameters": { 
   "where": '{"pid._id": "54d49a56e4b0cc014944f74a"}' 
 } 

});

from the service("questions_list_service" success event) .

2) called this service ("answer_list_service" before send event )on "page show" and "page load " events

i also need to make a "ul", " li" view for questions and it answers on the same screen on page load

Evgene Karachevtsev
Posts: 12
Joined: Mon Apr 28, 2014 1:12 pm

Inner join in appery.io

Hello!

1) You should add a question pointer column to your answers collection
2) Each time you save a new answer please set it with id of question entity
then you will be able to make query calls to answers collection with id of question and get your number

anshika
Posts: 0
Joined: Fri Feb 06, 2015 11:59 am

Inner join in appery.io

Hi
Evgene Karachevtsev,

i had already done this to fetch the data from answer table in refence with question table id

but now i am looking forward for fetching questions and answer both simultaneously
for example if i call questions table list i should also get the counts (answers per question) displayed against each question

anshika
Posts: 0
Joined: Fri Feb 06, 2015 11:59 am

Inner join in appery.io

Hi can you please reply if you know the solution

Yurii Orishchuk
Posts: 0
Joined: Fri Feb 14, 2014 8:20 am

Inner join in appery.io

Hi Anshika,

Unfortunatly "join" is not supports currently.

If your base entity contains pointer to other table - you can include it to the base entity REST response with "include" parameter. See more about it here: http://devcenter.appery.io/documentat...

Also you can implement "join" logic you need with "server code".
More details about server code here: http://devcenter.appery.io/documentat...

Regards.

Return to “Issues”