Solved

display of a external content type using SPServices

Posted on 2013-01-15
2
960 Views
Last Modified: 2013-01-15
Hello, i have got the following list which has been created already and it is called NotHereToday this list will be in charge of displaying the name and surname of the people not working Today in the office.  I also have the following code which sumarizes what I want to do but with a different list.. How can I make the following sample display the information I want. Two fields will be displayed preferred_name and surname

/* BIRTHDAYS AND LEAVE */

$().SPServices({
    operation: "GetListItems",
    async: false,
    listName: "TodaysLeaves",
    CAMLViewFields: "<ViewFields><FieldRef Name='full_name' /><FieldRef Name='leave_type' /></ViewFields>",
    completefunc: function (xData, Status) {
    

    
	  $(xData.responseXML).SPFilterNode("z:row").each(function() {

		if ($(this).attr("ows_leave_type") == "A") {
			leaveterm = "Annual Leave";
		} else if ($(this).attr("ows_leave_type") == "O") {
			leaveterm = "Other";
		}
		 else {
		    leaveterm = "Long Service";
		}

		 
var Listofonleave = "<span class='recordofperson'> "+ $(this).attr("ows_full_name") + "<span class='leavetype'>"+leaveterm +"</span></span>";
 
   	    $("#PeopleOnLeave").append(Listofonleave);
	 
      });

	  
    }
  });

Open in new window

0
Comment
Question by:jhonc66
  • 2
2 Comments
 

Accepted Solution

by:
jhonc66 earned 0 total points
ID: 38781358
I just finished editing it myself , and this is the answer

$().SPServices({
    operation: "GetListItems",
    async: false,
    listName: "NotHereToday",
    CAMLViewFields: "<ViewFields><FieldRef Name='preferred_name' /><FieldRef Name='surname' /></ViewFields>",
    completefunc: function (xData, Status) {
    

    
	  $(xData.responseXML).SPFilterNode("z:row").each(function() {

		var NotHereToday = "<span class='recordofperson'> "+ $(this).attr("ows_preferred_name")+" "+ $(this).attr("ows_surname");
 
   	    $("#NotHereToday").append(NotHereToday);
	 
      });
    }
  });

Open in new window

0
 

Author Closing Comment

by:jhonc66
ID: 38781361
I was able to come up with an answer
0

Featured Post

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Join & Write a Comment

We had a requirement to extract data from a SharePoint 2010 Customer List into a CSV file and then place the CSV file into a directory on the network so that the file could be consumed by an AS400 system. I will share in Part 1 how to Extract the Da…
JSON is being used more and more, besides XML, and you surely wanted to parse the data out into SQL instead of doing it in some Javascript. The below function in SQL Server can do the job for you, returning a quick table with the parsed data.
This video shows, step by step, how to configure Oracle Heterogeneous Services via the Generic Gateway Agent in order to make a connection from an Oracle session and access a remote SQL Server database table.
Viewers will learn how to use the SELECT statement in SQL to return specific rows and columns, with various degrees of sorting and limits in place.

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now