Maryna Brodina
Posts: 0
Joined: Thu Apr 05, 2012 7:27 am

saving labels to array

Hi Michael! Sorry, not yet. Working on it.

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

saving labels to array

Hi Michael,

Here is the READFAVORITES service response generated automatically:
Image
After you map favorites where you need you can parse value of each favorites element. Then assign these values to the appropriate elements.

As I can see, in favorites you get the following values:
{taxicompanyname=A 2 B Private Hire, town=BEDLINGTON, taxiemail=a href="mailto:gata2btravel@yahoo.co.uk" rel="nofollow"gata2btravel@yahoo.co.uk/a, taxiphone=01670 822021, textback=Text Back}

You can run the following code in mapping to parse values:
codevar i, j, arr, tmpArr, obj;
value = value.slice(1,-1);
arr = value.split(", ");
obj = {};
for (i = 0, j = arr&#46;length; i < j; i++) {
tmpArr = arr&#46;split('=');
obj[tmpArr[0]&#46;trim()] = tmpArr[1]&#46;trim();
}/code
As a result, you'll have all the values from needed favorites row in obj.

Michael4771079
Posts: 0
Joined: Sat Jul 21, 2012 2:03 pm

saving labels to array

Hi Katya,
trying to understand this

do you mean

when I update "favorites" in database with service favoritesupdate
use the above code in mapping instead of

codereturn JSON&#46;parse(value);/code

;

Michael4771079
Posts: 0
Joined: Sat Jul 21, 2012 2:03 pm

saving labels to array

Hi Katya,
me again:)
I tried replacing code, it didn't work,
so I am not understanding

I need to know from the point of saving the labels to array in localstorage and map it to favorites in db,
is this where the code is used?

I cant create a col in db "favorites"

Michael4771079
Posts: 0
Joined: Sat Jul 21, 2012 2:03 pm

saving labels to array

5 hours, no response, very unhappy

Igor
Posts: 0
Joined: Tue Apr 02, 2013 12:05 pm

saving labels to array

Hello Michael,

Sorry for delay, we are still working on it.

Michael4771079
Posts: 0
Joined: Sat Jul 21, 2012 2:03 pm

saving labels to array

Thanks for the reply,

working on what?
the process is known, otherwise Katya would not have suggested, if you understand what Katya suggested can you please forward a simple guide

Igor
Posts: 0
Joined: Tue Apr 02, 2013 12:05 pm

saving labels to array

Did you try to use code which Katya suggested above?https://getsatisfaction.com/apperyio/...

Michael4771079
Posts: 0
Joined: Sat Jul 21, 2012 2:03 pm

saving labels to array

Cheers Igor,
the service to update "favorites" from localstorage array into the db is "favoritesupdate"
I used the code Katya provided in the mapping, it didn't work.

maxkatz
Posts: 0
Joined: Fri Aug 13, 2010 3:24 pm

saving labels to array

Please debug and see where exactly the code fails. We will gladly help you, but you need to help us. It's challenging for us to help further when a reply is simply the code is not working. In general, custom app code is outside the scope of our support but we are still trying to help here.

Return to “Issues”