Sander Kristel
Posts: 0
Joined: Sun Dec 29, 2013 4:47 pm

How do I add a record with a pointer in it.

When add a record (create service) and I map a value to the pointer field it fails, when I don't the field remains empty?

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

How do I add a record with a pointer in it.

Hello Sander,

Could you please clarify what value do you map on pointer field? It should contain the id of record in related collection. Please look at this link: http://devcenter.appery.io/documentat...

Sander Kristel
Posts: 0
Joined: Sun Dec 29, 2013 4:47 pm

How do I add a record with a pointer in it.

I have got 2 collections 1 with a pointer to the other. I use create service to add a record to collection A and map the _id to a LocalVariable. I then use the create service to add a record to collection B using the LocalVariable to populate the pointer - this doesnt work.

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

How do I add a record with a pointer in it.

Hi Sander,

How do you add a record of pointer type?

Did you map a localStorage variable to a parameter of pointer type? If yes then note you would need to add both ID and column name.

For example, if you pass ID via mapping, add the following code to this parameter:
prereturn '{"collName":"myColumn", "_id":"' + value + '"}';/preWhere 'myColumn' is a name of the column where the pointer points.

Sander Kristel
Posts: 0
Joined: Sun Dec 29, 2013 4:47 pm

How do I add a record with a pointer in it.

Hi Katya not quite sure I get it tbh:

So if I have a collection called "A" and I add a record with an "_id" and then want to add a record to a collection called "B" with a pointerfield called "AID" what would the syntax be please?

Sander Kristel
Posts: 0
Joined: Sun Dec 29, 2013 4:47 pm

How do I add a record with a pointer in it.

Great stuff, thanks!

Sander Kristel
Posts: 0
Joined: Sun Dec 29, 2013 4:47 pm

How do I add a record with a pointer in it.

Hi thanks for that but it works in test but not in the app? I've added the "return '{"collName":"myColumn", "_id":"' + value + '"}';" statement to the EditJS mapping and use an alert to ensure it is using the right parameters. It doesn't add a record at all.

In test it works fine

Alena Prykhodko
Posts: 0
Joined: Tue Apr 09, 2013 7:36 am

How do I add a record with a pointer in it.

Did you invoke Service?
How exactly?

Sander Kristel
Posts: 0
Joined: Sun Dec 29, 2013 4:47 pm

How do I add a record with a pointer in it.

Yes, I invoke the create service to add the record to collection "A" and then on the success event of that service invoke the create service for collection "B"

Return to “Issues”