laura6372139
Posts: 0
Joined: Wed Oct 30, 2013 11:54 am

xml

Thanks!

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

xml

Hi Laura,

Your referred to a good guide http://docs.appery.io/tutorials/build... If you follow steps in it you will create needed application.

Try to do the following.

  1. Create Rest service (master) which returns a list of objects ids. In your case it can be service to url 1.
  2. Create master page with List component. Map response parameter of master service to listItem.
    3.Create two events for listItems. First of them sets localValue "id". The second one navigates to Detailed page.
  3. Create another service (detailed) which returns detailed information by id. It can be service to url 2. Map request parameter "id" to local variable "id". Map response parameters to components of detailed page
  4. Create detailed page. On load event invoke detailed service.
Kateryna Grynko
Posts: 0
Joined: Thu Nov 15, 2012 9:13 am

xml

Laura,

You posted one more URL above. Probably you want to delete it.

laura6372139
Posts: 0
Joined: Wed Oct 30, 2013 11:54 am

xml

Hi Katya:

It is possible if I have this service, that appears in the list only once, valencia, ontinyent, madrid instead of repeated.

Image

This is my public link:

http://appery.io/app/mobile-frame?src...

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

xml

Hi Laura -

The best way to solve your problem is to return only unique values from the server. But if you can't change its behavior you can use our server code, in which you can return only unique values to your app from.
http://docs.appery.io/documentation/b...

laura6372139
Posts: 0
Joined: Wed Oct 30, 2013 11:54 am

xml

Hi Illya:

Ok I can use server code, but I'm a little lost, can you guide me a little more?

I have seen the manual, but what do I need one script library?

Or just following the manual, I get what I want?

thanks

laura

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

xml

Hi Laura,

If you read XML data and there is no possibility to filter the needed values, you can use custom server code implementation. You can also filter the data within Appery.io, right after you receive it.

laura6372139
Posts: 0
Joined: Wed Oct 30, 2013 11:54 am

xml

Hi Katya:

Thanks for the information but you could detail how to do it.

I'm lost.

How to filter data

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

xml

Hi Laura,

For example,you get all the data from server. Save it in localStorage: on service Success event save full server response in a variable 'data'. You can filter the elements using codejQuery.unique()/code:
https://api.jquery.com/jQuery.unique/

Then invoke Generic service that returns a needed result:
http://docs.appery.io/documentation/u...
And finally add mapping for this Generic service.

laura6372139
Posts: 0
Joined: Wed Oct 30, 2013 11:54 am

xml

Sorry Katya but I do not, we can go step by step?

First, I called the service and have kept populations in localStorage. Image

Now, in succes event:

But don't working:
var arr = localStorage.getItem('poblacion');

$.each(unique(arr), function(i, value){
$('list').eq(1).append(value + ' ');
});

function unique(array){
return array.filter(function(el,index,arr){
return index == arr.indexOf(el);
});
}

And this function but if I didn't connect with list and label:

Code: Select all

   $('.list').each( function(){ 
    var myArr = [localStorage.getItem('poblacion')]; 
     myArr = $.unique(myArr); 
     var val = ""; 
     for (var i = 0; i < myArr.length; i++) { 
       val += myArr[i] + ","; 
     } 
     val = val.slice(0, -1); 
     alert(val); 
   }); 

Image

Thanks for your help.

This is very difficult for me.

Return to “Issues”