Page 1 of 3

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

Posted: Mon May 26, 2014 7:35 pm
by Sander Kristel

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?


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

Posted: Mon May 26, 2014 8:15 pm
by Evgene Karachevtsev

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...


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

Posted: Mon May 26, 2014 8:48 pm
by Sander Kristel

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.


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

Posted: Tue May 27, 2014 12:55 pm
by Kateryna Grynko

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.


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

Posted: Fri May 30, 2014 7:58 pm
by Sander Kristel

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?


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

Posted: Fri May 30, 2014 9:58 pm
by Alena Prykhodko

This example will help you:

  1. Street collection
    http://prntscr.com/3o5ak7
  2. Address collection
    http://prntscr.com/3o5aod
  3. "Create" Service:
    http://prntscr.com/3o5avo
    http://prntscr.com/3o5b03
    http://prntscr.com/3o5baq

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

Posted: Sat May 31, 2014 2:52 pm
by Sander Kristel

Great stuff, thanks!


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

Posted: Sat May 31, 2014 4:09 pm
by Sander Kristel

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


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

Posted: Sat May 31, 2014 6:02 pm
by Alena Prykhodko

Did you invoke Service?
How exactly?


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

Posted: Sat May 31, 2014 6:09 pm
by Sander Kristel

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"