Kartik A
Posts: 0
Joined: Wed Nov 06, 2013 4:16 pm

Adding multiple pointer value to single row for one pointer column.

I have two tables UserProfile and UserTransaction. In UserProfile table I have a column of type pointer to UserTransaction table. I could add a single value i.e UserTransaction _id to the UserProfile pointer column. How to add multiple UserTransation _id value to the pointer column of same UserProfile row.

Kartik A
Posts: 0
Joined: Wed Nov 06, 2013 4:16 pm

Adding multiple pointer value to single row for one pointer column.

Additional info - Is it possible to add array of pointers. How could I get for 1 UserProfile row related multiple objects from another table UserTransaction?

Thanks & Regards,
Kartik

Illya Stepanov
Posts: 0
Joined: Mon Mar 18, 2013 8:48 am

Adding multiple pointer value to single row for one pointer column.

Hello Kartik,

Sorry for delay. Can you clarify - is your tables are on a different pages? And you want to transfer 'id' between this two pages?

Kartik A
Posts: 0
Joined: Wed Nov 06, 2013 4:16 pm

Adding multiple pointer value to single row for one pointer column.

Hi IIIya,

Its not on different pages. Nope I do not want to transfer id between two pages. What I am trying to do is - use pointer - As I mention previously I have two tables, UserProfile and UserTransaction. Each user could have multiple transactions. What I want to do is display UserProfile and all the transaction by that user on a single page. I can link 1 UserProfile with 1 UserTransaction row by adding pointer table to UserProfile table but that would retrieve only 1 UserTransaction row. If I want to retrieve multiple rows from UserTransaction table that belong to the 1 UserProfile row then how could I achieve it. Can I add multiple id's into a pointer column?

Below is the uploaded image that display what I am trying to achieve. if that cannot be done then what are the other options to achieve my requirement.

Image

Kateryna Grynko
Posts: 0
Joined: Thu Nov 15, 2012 9:13 am

Adding multiple pointer value to single row for one pointer column.

Hi,

Sorry, still working on it. This will take some time. We'll update.

Oleg Danchenkov
Posts: 0
Joined: Tue Apr 30, 2013 5:51 pm

Adding multiple pointer value to single row for one pointer column.

No. You can't add multiple id's into a pointer column.
But you can save multiple id's into an Array column and retrieve data from UserTransaction collection with another REST service.

Kartik A
Posts: 0
Joined: Wed Nov 06, 2013 4:16 pm

Adding multiple pointer value to single row for one pointer column.

Thanks Oleg for your response. I have two followup question to your reply.

1) Do you mean pointer should be only used when we want to have 1 to 1 relationship. It cannot be used when I want to have 1 to many relationship. Like retrieving in single REST call master - detail rows.

2) What is the ideal/efficient way to implement one to many relationship so that it could be retrieved in single REST Call. Could you please explain briefly taking into consideration my above example of UserProfile and UserTransaction.

I went through documentation and couldn't find answers. Documentation has a brief explanation without example that make it difficult to get the clear understanding.

Please correct my limited understanding if I am wrong.

Thanks & Regards,
Kartik

Kateryna Grynko
Posts: 0
Joined: Thu Nov 15, 2012 9:13 am

Adding multiple pointer value to single row for one pointer column.

Hi,

1) Yes.
2) In collection 'UserProfile' create a column 'UserTransactions' with data type = array. Save there all the values of UserTransaction id.

Ted6306214
Posts: 0
Joined: Wed Nov 06, 2013 3:47 pm

Adding multiple pointer value to single row for one pointer column.

So you can't have an object type with an array of pointers(w/includes)? You need to do another query to the detail table?

Return to “Issues”