Retrieve Title field values from multiple lists and add into another list

Hi , Iam trying to retrieve Title field value from multiple lists. and add them into another list. using Javascript. Can any one help me in doing this. Below is the code.. function save() { clientContext = new SP.ClientContext.get_current(); oWebsite = clientContext.get_web(); oList = clientContext.get_web().get_lists().getByTitle('MainList'); clientContext.load(oList); clientContext.executeQueryAsync(OnSucceeded, onQueryFailed); } function GetListItemValue(listName, fieldName) { var list = oWebsite.get_lists().getByTitle(listName); var eventValue = document.getElementById(fieldName).value; eventValue = eventValue.replace(",", ""); var camlQuery = new SP.CamlQuery(); var filterdata = '<view><query><where><eq><fieldref name="Title/"><value type="Text">' + myreqValue.trim() + '</value></fieldref></eq></where></query></view>'; camlQuery.set_viewXml(filterdata); listItems = list.getItems(camlQuery); clientContext.load(list); clientContext.load(listItems, 'Include(Id)'); clientContext.executeQueryAsync(Succeeded,Failed); } function OnSucceeded() { itemCreateInfo = new SP.ListItemCreationInformation(); oListItem = oList.addItem(itemCreateInfo); oListItem.set_item('Title', 'My New Title'); var deptItemLookupField = new SP.FieldLookupValue(); //Problem in below line...I was unable to get ID var getId = GetListItemValue("Listname1", "txtboxname1"); alert("ID" + getId); if (getId != undefined) { deptItemLookupField.set_lookupId(getId); } var getId12 = GetListItemValue("Listname12", "txtboxname12"); alert("ID" + getId12); if (getId12 != undefined) { deptItemLookupField.set_lookupId(getId12); } oListItem.update(); clientContext.executeQueryAsync(itemadded, itemFailed); } function itemadded() { alert('Item added successfully'); } function itemFailed(sender, args) { alert('Item added itemFailed' + args.get_message() + '\n' + args.get_stackTrace()); }
Raj

Hi,
For this requirement, you will need to retrieve all the lists objects you want firstly, then execute the requests one by one to get the value of the Title column using CAML or
LINQ.
How to: Retrieve Lists Using JavaScript
http://msdn.microsoft.com/en-us/library/office/hh185009(v=office.14).aspx
About
retrieve list items:
http://msdn.microsoft.com/en-us/library/office/hh185007(v=office.14).aspx
You can use
Promise in your script to make your requests sequentially:
http://www.shillier.com/archive/2013/03/04/using-promises-with-the-javascript-client-object-model-in-sharepoint-2013.aspx
http://www.learningsharepoint.com/2013/08/13/using-deferred-and-promise-to-handle-async-calls-in-sharepoint-client-object-model/
Best regards
Patrick Liang
TechNet Community Support

Similar Messages

  • Hi, extract data from xml file and insert into another exiting xml file

    i am searching code to extract data from xml file and insert into another exiting xml file by a java program. I understood it is easy to extract data from a xml file, and how ever without creating another xml file. We want to insert the extracted data into another exiting xml file. Suggestions?
    1st xml file which has two lines(text1.xml)
    <?xml version="1.0" encoding="iso-8859-1"?>
    <xs:PrintDataRequest xmlns:xs="http://com.unisys.com/Anid"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://com.unisys.com/Anid file:ANIDWS.xsd">
    <xs:Person>
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://com.unisys.com/Anid file:ANIDWS.xsd">
    These two lines has to be inserted in the existing another xml(text 2.xml) file(at line 3 and 4)
    Regards,
    bubbly

    Jadz_Core wrote:
    RandomAccessFile? If you know where you want to insert it.Are you sure about this? If using this, the receiving file would have to have bytes inserted that exactly match the number of bytes replaced. I'm thinking that you'll likely have to stream through the second XML with a SAX parser and copy information (or insert new information) as you stream with an XML writer of some sort.

  • Extract data from xml file and insert into another exiting xml fil

    hello,
    i am searching extract data from xml file and insert into another exiting xml file by a java program. I understood it is easy to extract data from a xml file, and how ever without creating another xml file. We want to insert the extracted data into another exiting xml file. Suggestions?
    Regards,
    Zhuozhi

    If the files are small, you can load the target file in a DOM document, insert the data from the source file and persist the DOM.
    If the files are large, you probably want to use a StAX or SAX.

  • How to read from one file and write into another file?

    Hi,
    I am trying to read a File and write into another file.This is the code that i am using.But what happens is last line is only getting written..How to resolve this.the code is as follows,
    public String get() {
         FileReader fr;
         try {
              fr = new FileReader(f);
              String str;
              BufferedReader br = new BufferedReader(fr);
              try {
                   while((str= br.readLine())!=null){
                   generate=str;     
              } catch (IOException e1) {
                   e1.printStackTrace();
              } }catch (FileNotFoundException e) {
                   e.printStackTrace();
         return generate;
    where generate is a string declared globally.
    how to go about it?
    Thanks for your reply in advance

    If you want to copy files as fast as possible, without processing them (as the DOS "copy" or the Unix "cp" command), you can try the java.nio.channels package.
    import java.nio.*;
    import java.nio.channels.*;
    import java.io.*;
    import java.util.*;
    import java.text.*;
    class Kopy {
         * @param args [0] = source filename
         *        args [1] = destination filename
        public static void main(String[] args) throws Exception {
            if (args.length != 2) {
                System.err.println ("Syntax: java -cp . Kopy source destination");
                System.exit(1);
            File in = new File(args[0]);
            long fileLength = in.length();
            long t = System.currentTimeMillis();
            FileInputStream fis = new FileInputStream (in);
            FileOutputStream fos = new FileOutputStream (args[1]);
            FileChannel fci = fis.getChannel();
            FileChannel fco = fos.getChannel();
            fco.transferFrom(fci, 0, fileLength);
            fis.close();
            fos.close();
            t = System.currentTimeMillis() - t;
            NumberFormat nf = new DecimalFormat("#,##0.00");
            System.out.print (nf.format(fileLength/1024.0) + "kB copied");
            if (t > 0) {
                System.out.println (" in " + t + "ms: " + nf.format(fileLength / 1.024 / t) + " kB/s");
    }

  • Retrieving lookup field values from a main table using MDM JAVA APIs

    Hi all,
    am trying to retrieve the main table data...., i could able to retrieve all the data except lookup field values..., iam facing some runtime exceptions and i dont know why exactly it is throwing this exception..., i pasted piece of code where exactly the error is and the exception also.
    in the below sode i set some result set definitions and passing them to retrieveLimitedRecordsCommand. it is showing some exception at retrieveLimitedRecordsCommand.execute(); command.
    //*** Code  ***//
      supportingMainResultDefinitions = new ResultDefinition[] { rdQual ,rdFlat, rdqFlat  };
                                            retrieveLimitedRecordsCommand.setResultDefinition(rd);
                                            retrieveLimitedRecordsCommand.setSearch(new Search(tableId));
                                            retrieveLimitedRecordsCommand.setSession(sessionId);
                                            retrieveLimitedRecordsCommand.setSupportingResultDefinitions(supportingMainResultDefinitions);
                                            try {
                                            retrieveLimitedRecordsCommand.execute();
                                                    PrintRecords.toConsole(retrieveLimitedRecordsCommand.getRecords());
                                                    } catch (CommandException e) {
                                                    e.printStackTrace();
    //***  Below is the Exception raised ***//
    java.lang.UnsupportedOperationException: Unexpected field type -1
            at com.sap.mdm.internal.schema.PropertiesHelper.createField(PropertiesHelper.java:274)
            at com.sap.mdm.internal.schema.PropertiesHelper.convertFrom(PropertiesHelper.java:281)
            at com.sap.mdm.internal.data.RecordMetadata.<init>(Unknown Source)
            at com.sap.mdm.internal.data.RecordsLoader.<init>(Unknown Source)
            at com.sap.mdm.internal.data.RecordsLoader.<init>(Unknown Source)
            at com.sap.mdm.internal.data.RecordResultSetHelper.convertFrom(Unknown Source)
            at com.sap.mdm.data.commands.RetrieveLimitedRecordsCommand.execute(Unknown Source)
            at com.sap.mdm.apitutorial.lesson2.RecordsDisplay.getDisplayRecords(RecordsDisplay.java:303)
            at org.apache.jsp.Sample_jsp._jspService(Sample_jsp.java:190)
            at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:99)
            at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
            at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:325)
            at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295)
            at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:245)
            at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
            at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
            at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
            at org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:362)
            at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
            at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
            at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:214)
            at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
            at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
            at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
            at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
            at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
            at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:825)
            at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:738)
            at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:526)
            at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
            at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
            at java.lang.Thread.run(Thread.java:534)
    If anyonw worked on this concept..., please provide me the solution
    Regards
    Praveen k

    Which version are you using?  Can you please try and narrow down to the offending field?  You can do this by limiting the fields you provide to ResultDefinition.

  • Can I create a Master PDF that pulls field values from multiple PDFs?

    I am designing a tracking system for a class and want to have the student fill out a basic information form that tracks personal information and individual test grades.  As an administrator, I want to have a master list that can track the entire class and pull in their grades, calculate class average, and order them accordingly.  Ideally, it would pull from a folder of these student PDFs.
    Does Adobe have a way to do this?  I have LiveCycle and Acrobat Pro.

    Thanks for the very prompt answer!  That seems like it sort of does what I want - however, once I leave the course, I want to have the system continue to work - and future Admins probably wont have access to Acrobat Pro, or the technical knowledge to send out looking for responses.  Nor is there a sharepoint (or equivalent drive) to set.  Perhaps some further explanation is required.
    There are multiple classes going on at one time, and each class gets a folder on a standalone machine, with a different Admin in charge of each class.  When one graduates, another one fills in behind them a week or so afterwards.  So what I need is a "template" file for student data, and a template "Master list" that pulls from all of the student data PDFs in that folder, locally, without the Master list having to send out requests for information.  That way, when a new class starts, the students can email in their student data, the Admin can pop them all in a folder with a blank Master List template, and when the admin opens the Master list, it populates with all the data from the student sheets.
    Hopefully that is a little clearer, and hopefully doable!  It really needs to be pretty darn simple.  We used to do it in Excel, and gave each student a tab where we copy/pasted their basic data - and a crosslinked sheet pulled it into the master list.  Alas, that looked unprofessional and sometimes was very troublesome when the students altered the Excel form in any way or put things in the wrong cells.
    Thanks!

  • How to read LONG RAW data from one  table and insert into another table

    Hello EVERYBODY
    I have a table called sound with the following attributes. in the music attribute i have stored some messages in the different language like hindi, english etc. i want to concatinate all hindi messages and store in the another table with only one attribute of type LONG RAW.and this attribute is attached with the sound item.
    when i click the play button of sound item the all the messages recorded in hindi will play one by one automatically. for that i'm doing the following.
    i have written the following when button pressed trigger which will concatinate all the messages of any selected language from the sound table, and store in another table called temp.
    and then sound will be played from the temp table.
    declare
         tmp sound.music%type;
         temp1 sound.music%type;
         item_id ITEM;
    cursor c1
    is select music
    from sound
    where lang=:LIST10;
    begin
         open c1;
         loop
              fetch c1 into tmp; //THIS LINE GENERATES THE ERROR
              temp1:=temp1||tmp;
              exit when c1%notfound;
         end loop;
    CLOSE C1;
    insert into temp values(temp1);
    item_id:=Find_Item('Music');
    go_item('music');
    play_sound(item_id);
    end;
    but when i'm clicking the button it generates the following error.
    WHEN-BUTTON-PRESSED TRIGGER RAISED UNHANDLED EXCEPTION ORA-06502.
    ORA-06502: PL/SQL: numeric or value error
    SQL> desc sound;
    Name Null? Type
    SL_NO NUMBER(2)
    MUSIC LONG RAW
    LANG CHAR(10)
    IF MY PROCESS TO SOLVE THE ABOVE PROBLEM IS OK THEN PLESE TELL ME THE SOLUTION FOR THE ERROR. OTHER WISE PLEASE SUGGEST ME,IF ANY OTHER WAY IS THERE TO SOLVE THE ABOVE PROBLEM.
    THANKS IN ADVANCE.
    D. Prasad

    You can achieve this in many different ways, one is
    1. Create another VO based on the EO which is based on the dest table.
    2. At save, copy the contents of the source VO into the dest VO (see copy routine in dev guide).
    3. commiting the transaction will push the data into the dest table on which the dest VO is based.
    I understand that if we attach VO object instance to region/page, we only can pull and put data in to only one table.
    if by table you mean a DB table, then no, you can have a VO based on multiple EOs which will do DMLs accordingly.Thanks
    Tapash

  • How to get the data from one table and insert into another table

    Hi,
    We have requirement to build OA page with the data needs to be populated from one table and on save data into another table.
    For the above requirement what the best way to implement in OAF.
    I understand that if we attach VO object instance to region/page, we only can pull and put data in to only one table.
    Thanks

    You can achieve this in many different ways, one is
    1. Create another VO based on the EO which is based on the dest table.
    2. At save, copy the contents of the source VO into the dest VO (see copy routine in dev guide).
    3. commiting the transaction will push the data into the dest table on which the dest VO is based.
    I understand that if we attach VO object instance to region/page, we only can pull and put data in to only one table.
    if by table you mean a DB table, then no, you can have a VO based on multiple EOs which will do DMLs accordingly.Thanks
    Tapash

  • Copying from one arrangement and pasting into another arrangement

    Hi, I'm using Logic Express 8.
    I'm wondering if there is a way to copy several tracks from one arrangement window into another. I've tried to do this simply by copying and pasting, but when I paste into the new arrangement window I get error messages and the tracks pasted into the new window have a speaker icon with an "X" through it - and obviously no sound.
    Am I missing something, or perhaps this is simply a limitation that exists with using express instead of pro?
    Thanks a lot.

    You can do this by simply importing the data from one project to your new one. Check it out here.

  • Delete records from multiple tables and add delay in execution

    Dear All,
    My Database is Oracle 11gR2 on Linux.
    I have to schedule delete in 5 tables. For this i will write a procedure with delete queries and schedule the procedure to run daily in night.
    I want to give delay in the execution of delete queries within procedure? How can i add this functionality within a procedure?
    I don't want to lock the tables as other queries may be accessing the same table meanwhile.
    Looking for your help.
    Regards,
    Imran

    Duplicate thread - see https://forums.oracle.com/thread/2553380 for answer.

  • How to concatinate values of two columns and update into another column

    There is a table : TEST contains three columns - Column1 , Column2 , Column 3
    Column1 contains values - (1,2,4)
    Column2 contains values : (a,b,c)
    Column 3 is empty .
    Target : Values in column 3 should be (1a,2b,4c)
    Need to achieve this through procedure .

    Paul if i want to concatenate two strings or alpha numeric characters from 2 fields and display in the third field,Will this code be able to do that?

  • How can I paste title/artist info from iTunes(on my iphone) into another app?

    Almost daily a friend or two with an Android phones will ask me for a song recommendation. I'd like an easy way to find a song in iTunes on my iPhone and copy/paste the artists/song title into my texting application and send it to them.
    Is there a way to do this?

    You can have a look at iCloud.com on a Mac/PC and, by clicking on Photos (beta), see if there's something saved to iCloud servers. In this case, I think you can simply activate the iCloud Photo Library on your iPhone and you're done.

  • Export from one version and import into another version

    We have a customer database that accidently got updated to 10.2.x but our application only supports 10.1.5 What we are wondering can we export the 10.2 database and import it into a new system that is at our supported version of 10.1.0.5?
    Will the import even work or will it fail with unsupported version? Any other things we should be aware of?

    ro**** wrote:
    We have a customer database that accidently got updated to 10.2.x but our application only supports 10.1.5 What we are wondering can we export the 10.2 database and import it into a new system that is at our supported version of 10.1.0.5?
    Will the import even work or will it fail with unsupported version? Any other things we should be aware of?between versions export MUST ALWAYS be done with lowest version of export utility!

  • Exclude Holiday hours from overtime hours and add into regular hours

    In our current scenario any holiday hours are included in Overtime hours. We want to exclude these holiday hours from overtime hours
    Two examples:
    In one week an employee works 35 regular hours, with 8 holiday hours, for a total of 43 hours. Currently, the employee would get 40 hours of straight time, with 3 hours of OT. The change required is that it should have 43 hours of straight time, with no OT.
    Another example - In one week an employee submits 42 hours of time, with 8 holiday hours for a total of 50 hours. Currently, the employee would get 40 hours of straight time, with 10 hours of OT. With the change, the employee would receive 48 hours of straight time, with 2 hours of OT.
    In summary any holiday hours should be included into regular hours not in Overtime hours.
    Which setup changes are required to achive this functionalty?

    You can exclude the holiday hours from the OT calculation by excluding it from the earning group setup.
    --Shiv                                                                                                                                                                                                                                   

  • We are trying to do a Quick payment from payment workbench and getting 'FRM-41830: List of values contains no entries' error for payment document column/field. Payment document setup looks good. Not sure what the issue is.

    We are trying to do a Quick payment from payment workbench and getting 'FRM-41830: List of values contains no entries' error for payment document column/field. Payment document setup looks good. Not sure what the issue is.

    Already gone through following three notes but didn't found resolution.
    APXPAWKB: FRM-41830 When Clicking on Payment Document LOV (Doc ID 1081305.1)
    R12: APXPAWKB: Payment Document Lov Is Empty When Entering A Payment (Doc ID 857587.1)
    R12: Payment Workbench Error: FRM-41830 List Of Values Contains No Entries (APXPAWKB.FMB) (Doc ID 1323875.1)

Maybe you are looking for

  • If my device does not respond in MAX does it mean it is damaged?

    I was using an example vi to acquire digital data, however the output LEDs on the vi front panel started to show random results.  So I closed the vi down and tried again but nothing happened at all?  So I went to check acquisition in MAX and the foll

  • Mac mini losing signal over vga when using adapter.

    At my church we are installing 2014 Mac minis in the classrooms and occasionally when we power them up the main display works perfect but the projector which is plugged in through the mini display port to vga adapter the screen will just be blue like

  • No Results after build a Parent-Child Hierarchy in OBIEE11G

    Hi All: Here's an problem. I followed the "http://sandybi.wordpress.com/2010/08/17/hierarchies-in-obiee-11g-part-1/" this article step by step to create a parent-child hierarchy in admin tool in OBIEE11G. But after check in and try to retrieve the hi

  • ITunes 10.7 crashing as soon as it loads

    Hi, Ever since I updated iTunes to the latest update, when it opens it crashes. It seems to be when it is trying to load the store. As it does this straight away I can't do anything in iTunes before it crashes. Tried Reinstalling it - No help OS - Wi

  • Query on Java Bean Usage in R12 Forms

    Hi, I have a scenario, There is a Java bean which has been working on Oracle 11i Forms for quite a while now.The bean is used to display two text fields which are populated on selecting a file using the Browse button on the right hand side. We have r