Link to home
Start Free TrialLog in
Avatar of msalmeron
msalmeron

asked on

How can I consolidated the output from two queries into one object array

I have two sharepoint lists that are identical structurally (only difference is data) now I want to be able to query both list and consolidated the returned values.
Very new at javascrit and Angular but I've attempted to just duplicate my first query and I seem to be getting output from both lists but cannot figure out how to consolidate into one.

see code below.

(function () {
  'use strict';

  angular
    .module('myApp.core')
    .controller('DefaultController', DefaultController);

  DefaultController.$inject = ["SharePointService"];

  function DefaultController(SharePointService) {

    var vm = this;






    vm.search = function () {


        SharePointService.getWithFilter('ExpectationsList1', "?$select=Id,DocTitle,ParaNum,SentText&$filter=substringof('" + vm.query + "', SentText) eq true").then(function (response1) {
 
                //vm.expectations = response1

                console.log(response1);

        });
        SharePointService.getWithFilter('ExpectationsList2', "?$select=Id,DocTitle,ParaNum,SentText&$filter=substringof('" + vm.query + "', SentText) eq true").then(function (response2) {

            //vm.expectations = response2


			console.log(response2)			

        });


        

    }


  }

})();

Open in new window

Avatar of zephyr_hex (Megan)
zephyr_hex (Megan)
Flag of United States of America image

What does getWithFilter return?
If you don't know, posting the results of your console.log would be helpful.
Avatar of msalmeron
msalmeron

ASKER

Hope this helps is from the console.log in the browser... there are more elements there but I copied and pasted what I think u want.

[Object, Object, Object, Object, Object, Object]
0
:
Object
DocTitle
:
"Document Title 1"
Id
:
1438
ParaNum
:
"8.2.2.1.2"
SentText
:
"text searched text from within document Title 1 bla bla bla<br>"
__metadata
:
Object
__proto__
:
Object
1
:
Object
2
:
Object
3
:
Object
4
:
Object
5
:
Object
length
:
6
ASKER CERTIFIED SOLUTION
Avatar of zephyr_hex (Megan)
zephyr_hex (Megan)
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Were you able to resolve this?