Terry Gilliver
Posts: 0
Joined: Fri Apr 18, 2014 8:45 pm

loading records from a collection into an array

I have a collection containing a string field of postcodes.

Before adding a postcode to the collection I need to know if it already exists, if so I do not add the postcode.

I was thinking that I could use the list service and map the postcodes to an array model of some kind and then check the new postcode against the contents of the postcode string array. Does this make sense, if so How do I configure the model and storage, and how do I map the postcodes from the service to the array model.

If this is not feasible, can you suggest and alternative?

Terry Gilliver
Posts: 0
Joined: Fri Apr 18, 2014 8:45 pm

loading records from a collection into an array

This is what I have got so far:

model:
Image

storage:
;Image

input mapping:
Image

output mapping:
Image

This service is called on the load event of the page. After logging in and navigating to that page, I checked the session storage in the console, but my postcode data was not there.

Serhii Kulibaba
Posts: 150
Joined: Tue Aug 27, 2013 1:47 pm

loading records from a collection into an array

Hello Terry,

The best way is the usege of JS for this:

1) remove mapping from the service
2) on the success event write service response into storage variable:

preApperyio.storage.postcodes.set(data);/pre

Return to “Issues”