Antonio Kibbutz
Posts: 0
Joined: Fri Feb 20, 2015 7:29 pm

Object of array

Hi! I've got an object and it is composed by two element a string and a boolean and the I define an array of thi object
Something like Object wiht name and value and Try is the array of Object.
I've used this Object as a local storage for my checkbox so if an item is checked I can save the name checked and if the item is checked in valure ( boolean) and it goes well!
Now I have to use this Object in local storage in the Before Send Mappig of My Servive. I have to call my service only with the Obj.name element

var a = Try.get("$['Try'][0]['name']");
var b = Try.get("$['Try'][1]['name']");

return '{"$or":[{ "Pointer_x": {"$inQuery" : { "Col_name": "'+a+'" } }},{ "Pointer_x": {"$inQuery" : { "Col_name": "'+b+'"} }}]}';

but...it doesn't work :((((

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

Object of array

Hello,

You incorrectly use storage API. Use as below:
pre
var a = Apperyio.storage.Try.get("$['Try']")[0].name;
var b = Apperyio.storage.Try.get("$['Try']")[1].name;/pre

Also check how you set the storage variable, we assume it has errors too.

Antonio Kibbutz
Posts: 0
Joined: Fri Feb 20, 2015 7:29 pm

Object of array

I popolate the Array Try with a Javascript in the Design, when you made your choice and clik button run this code

var name_arr = [];
checkboxgroup = $('[name="Scelta"]');
for (var i = 0; i < checkboxgroup.length-1; i++) { console.log(i);
var currentCheckBox = jQuery(checkboxgroup);
var currentInput = currentCheckBox.find("input");
name_arr = {
"name": currentInput.val(),
"value": currentInput.prop("checked")
};

}

Apperyio.storage.Try.set(name_arr);

but the service doesn't give me anything. I' ve tried to call the service setting a fake value and it runs :(

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

Object of array

Hi -

In this case then just:
precode
var a = Apperyio&#46;storage&#46;Try&#46;get()[0]&#46;name;
var b = Apperyio&#46;storage&#46;Try&#46;get()[1]&#46;name;/code/pre

Return to “Issues”