I'm using Sharepoint 2013 in office 365. As using lookup will impact the current structure i have. In SPD 2013, is there any way to do data source merging, i can't find it anywhere.
I managed to use camlquery
and spservices
(GetListItem) in between to get the information from SharePoint list 2
Try this:
Function GetSharePointList1() {
context = SP.ClientContext.get_current();
oList = context.get_web().get_lists().getByTitle('SharePoint List 2');
var camlQuery = new SP.CamlQuery();
camlQuery.set_viewXml(query);
items = oList.getItems(camlQuery);
context.load(items);
context.executeQueryAsync(
Function.createDelegate(this, onSuccessSharePointList1),
Function.createDelegate(this, onFail)
);
}
function onSuccessSharePointList1() {
recNum = items.get_count();
if(recNum != 0){
var listItemEnumerator = items.getEnumerator();
while(listItemEnumerator.moveNext()) {
var oListItem = listItemEnumerator.get_current();
$().SPServices({
operation: "GetListItems",
async: false,
listName: "SharePoint List 2",
CAMLViewFields: "<ViewFields><FieldRef Name='Worklocation'/></ViewFields>",
CAMLQuery: "<Query><Where><Eq><FieldRef Name='Title'/><Value Type='Text'>" + ReferenceID +
"</Value></Eq></Where></Query>",
completefunc: function (xData, Status) {
$(xData.responseXML).SPFilterNode("z:row").each(function() {
Worklocation = ($(this).attr("ows_Worklocation"));
});
}
});
s = ..... (display all in table format)
$("#resultTable").append(s);
i++;
}
}