Page 1 of 1

Mapping Tables while Querying using RESTful Service

Posted: Tue Feb 11, 2014 6:05 pm
by Anandraj

I have three tables in the Database in Appery and I want to create a Service which should get data from all three tables in a single service.
Is it possible to create a Database View? Any other options.


Mapping Tables while Querying using RESTful Service

Posted: Tue Feb 11, 2014 6:21 pm
by Kateryna Grynko

Hi Anandraj,

You can do this if only these collections are connected by a pointer field, otherwise you would need to create 3 different services.


Mapping Tables while Querying using RESTful Service

Posted: Tue Feb 11, 2014 6:45 pm
by Anandraj

How to create a Pointer feilds. I have created a feilds in each tables and added a column and value which is same as from other table which needs to be mapped. If I can write a SQL with where clause then I can map these feilds and get the values.


Mapping Tables while Querying using RESTful Service

Posted: Tue Feb 11, 2014 10:07 pm
by Kateryna Grynko

Anandraj,

Here it the pointer: http://docs.appery.io/documentation/b...
Appery.io uses mongoDB that is not a noSQL Database.


Mapping Tables while Querying using RESTful Service

Posted: Wed Feb 12, 2014 4:13 pm
by Anandraj

Thank you. Here is my scenario.

Table1

_id Name ExpDate
1 AA 2014-02-10
2 BB 2014-03-12

Table2

_id FName Offer
10 CC 2
11 DD 3
12 EE 4

Table3

_id Table1Map Table2Map
100 1 10
101 1 11
102 2 10
103 2 12

I need to get values from all three table as shown below.

{ "Table1.Name": AA
{"Table2.FNAme" : CC,"Table2.Offer":2}
{"Table2.FName":DD,"Table2.Offer":3},
"Table1.NAme":BB
{"Table2.FNAme" : CC,"Table2.Offer":2}
{"Table2.FName":EE,"Table2.Offer":4}
}

Please help.


Mapping Tables while Querying using RESTful Service

Posted: Wed Feb 12, 2014 5:55 pm
by Kateryna Grynko

Hi Anandraj,

You should add a request parameter 'include' for Table3, and there specify names of Table1 and Table2. Please take a look at here: http://docs.appery.io/documentation/b...