Kinson Sa
Posts: 0
Joined: Sun Mar 22, 2015 9:40 pm

Query in an XML file restAPI?

Here you are, take note that in the user I have Numero_repre, it is where I have the vendor number. Then I just want to pas to the model the customers filtered by VENDEDOR Image
Image
Image

Yurii Orishchuk
Posts: 0
Joined: Fri Feb 14, 2014 8:20 am

Query in an XML file restAPI?

Hi Kinson,

Here is a solution to filter items on client part(no matter is it JSON response service or XML response service, it's universal solution):

  1. Open goal datasource.

  2. Add "success" event handler with "Run javascript" action.

  3. Populate this action with following JS code:

    pre

    //Here you should specify path to your response array.
    var array = data.response.data.record;

    for(var i = array.length - 1; i = 0; i--){
    //Here should be your condition to delete item from collection.
    //Current condition just removes every odd item.
    if(i % 2 == 0)
    array.splice(i, 1);
    };

    /pre

  4. Order this event handler to be first in "success" section.
    Details: http://prntscr.com/6tvfy9/direct

    Note: you should change:

  5. path to array - depends only on your service response.

  6. condition to remove item - should be specified by your app logic.

    Regards.

Kinson Sa
Posts: 0
Joined: Sun Mar 22, 2015 9:40 pm

Query in an XML file restAPI?

Dear Yuri,

With API EXPRESS, I make DB connection and I have everything.

Thanks

Return to “Issues”