Access data from from two lists based on lookup columns and insert into another
Hi,
I am new in SharePoint and is stuck in some problem.
I want to insert data in to a list by fetching data from 2 lists.
The scenario is :
List A Columns : EmployeeName, EmployeeID, EmployeeSalary
List B Columns : DepartmentName, EmployeeID, ManagerID
EmployeeID is lookup column
I want to fetch data from these 2 lists and insert data into another list:
List C Columns: EmployeeName, EmployeeSalary, DepartmentName
Can someone please explain me all the possible approaches to do the above task
If ListA and ListB are the lists that you created, it would be better to generate the lists data into one list not seperate lists, as they both represents the property information of one employee.
If they are existing lists, you may have following considerations:
1. if you are a programmer, it would be easier to have a lookup column at ListA, to generate the EmployeeName, EmplyeeSalary, then using ItemAdded event, to generate the DepartmentName column based on EmployeeID column.
2. have a lookup column look at ListA, use workflow, set when item is created, start the workflow automatically, then in the workflow, find ListB related item based on EmployeeID column, to set the DepartmentName column, SharePoint designer workflow
set Item Value activity can do this work, you can research to find more information about how to do this.
Thanks,
Qiao Wei <br/> My blog:http://blog.goobol.com
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,
bubblyJadz_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,
ZhuozhiIf 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 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.
ThanksYou 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 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. PrasadYou 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 -
Looking data from more than one table and inserting into another.
Hello,
I am giving you the Table structures as per my requirement..
CREATE TABLE TEMP_A
(NAME VARCHAR2(100) primary key);
CREATE TABLE TEMP_B
(STRUCTURE VARCHAR2(10));
CREATE TABLE TEMP_C
( NAME VARCHAR2(100),
STRUCTURE VARCHAR2(10),
VALUE VARCHAR2(10));
Alter table TEMP_C
add constraint fk_name_tempc foreign key(name) references TEMP_A(name)
INSERT INTO TEMP_A VALUES('SMITH');
INSERT INTO TEMP_A VALUES('ALLEN');
INSERT INTO TEMP_A VALUES('WARD');
INSERT INTO TEMP_A VALUES('JONES');
COMMIT;
INSERT INTO TEMP_B VALUES('IN');
INSERT INTO TEMP_B VALUES('IN_MIN');
INSERT INTO TEMP_B VALUES('IN_TYP');
INSERT INTO TEMP_B VALUES('IN_MAX');
INSERT INTO TEMP_B VALUES('DIP');
INSERT INTO TEMP_B VALUES('TIM');
COMMIT;
INSERT INTO TEMP_c VALUES('SMITH','C1','');
INSERT INTO TEMP_c VALUES('SMITH','C2','');
INSERT INTO TEMP_c VALUES('SMITH','D1','');
INSERT INTO TEMP_c VALUES('ALLEN','D2','');
INSERT INTO TEMP_c VALUES('ALLEN','R1','');
INSERT INTO TEMP_c VALUES('WARD','R2','');
COMMIT;
i want to say is it should insert into table 'TEMP_C' values as :
For 'SMITH' there should be (6 * 3) = 18 records.
( 6 distinct values of TEMP_B for SMITH to be inserted into TEMP_C against 'C1')
( 6 distinct values of TEMP_B for SMITH to be inserted into TEMP_C against 'C2')
( 6 distinct values of TEMP_B for SMITH to be inserted into TEMP_C against 'D1')
For 'ALLEN' there should be (6 * 2) = 12 records.
( 6 distinct values of TEMP_B for ALLEN to be inserted into TEMP_C against 'D2')
( 6 distinct values of TEMP_B for ALLEN to be inserted into TEMP_C against 'R1')
For 'WARD' there should be (6 * 1) = 6 records.
( 6 distinct values of TEMP_B for WARD to be inserted into TEMP_C against 'R2')
Like this if there are records for JONES also , it should also do the same way( Depending on the No. of records present
in the table 'TEMP_C' for 'JONES').
Thanks in advance,
AmkotzIs this what you are looking for?
SQL> insert into temp_c (name, structure, value)
2 select c.name, c.structure, b.structure
3 from temp_a a, temp_c c, temp_b b
4 where a.name = c.name
5 ;
36 rows created.
SQL> select * from temp_c;
NAME STRUCTURE VALUE
SMITH C1
SMITH C2
SMITH D1
ALLEN D2
ALLEN R1
WARD R2
SMITH C1 IN
SMITH C1 IN_MIN
SMITH C1 IN_TYP
SMITH C1 IN_MAX
SMITH C1 DIP
SMITH C1 TIM
SMITH C2 IN
SMITH C2 IN_MIN
SMITH C2 IN_TYP
SMITH C2 IN_MAX
SMITH C2 DIP
SMITH C2 TIM
SMITH D1 IN
SMITH D1 IN_MIN
SMITH D1 IN_TYP
SMITH D1 IN_MAX
SMITH D1 DIP
SMITH D1 TIM
ALLEN D2 IN
ALLEN D2 IN_MIN
ALLEN D2 IN_TYP
ALLEN D2 IN_MAX
ALLEN D2 DIP
ALLEN D2 TIM
ALLEN R1 IN
ALLEN R1 IN_MIN
ALLEN R1 IN_TYP
ALLEN R1 IN_MAX
ALLEN R1 DIP
ALLEN R1 TIM
WARD R2 IN
WARD R2 IN_MIN
WARD R2 IN_TYP
WARD R2 IN_MAX
WARD R2 DIP
WARD R2 TIM
42 rows selected.
SQL> -
How to Query from table and insert into another table.
Hi
I am using the following query in VO and all the columns are attached to EO ( table name emp_temp)
select a.npw_number, a.person_id,b.assignment_id,a.title,a.last_name,a.first_name,a.date_of_birth,a.sex,
b.organization_name,b.organization_id,b.job_id,b.job_name,b.position_id,b.position_name,b.supervisor_id,
b.supervisor_name,b.location_id,b.effective_start_date,b.effective_end_date
from per_all_people_f a,per_assignments_v b
where a.person_id=b.person_id
and a.npw_number=:1
I can query the data in screen. I need into insert the data into the emp_temp.
I don't know how to do this . Please help me.
Thanks
SubraYou can create a VO based on EO on emp_temp table.....
And u have attached a Different VO on the page... Right...
Now what u can do is....once u click on apply....
u can set the each attributes of EO based VO explicitly via code, from the values of second VO.... and then commit.....
Perhaps this might help... -
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 to extract data from xml and insert into Oracle table
Hi,
I have a large xml file. which will have hundreds of the following transaction tags having column names and there values.
There is a table one of the schema with coulums "actualCostRate","billRate"....etc.
I need to extract the values of these columns and insert into the table
<Transaction actualCostRate="0" billRate="0" chargeable="1" clientID="NikuUK" chargeCode="LCOCD1" externalID="L-RESCODE_UK1-PROJ_UK_CNT_GBP-37289-8" importStatus="N" projectID="TESTPROJ" resourceID="admin" transactionDate="2002-02-12" transactionType="L" units="11" taskID="5017601" inputTypeCode="SALES" groupId="123" voucherNumber="ABCVDD" transactionClass="ABCD"/>
<Transaction actualCostRate="0" billRate="0" chargeable="1" clientID="NikuEU" chargeCode="LCOCD1" externalID="L-RESCODE_US1-PROJ_EU_STD2-37291-4" importStatus="N" projectID="TESTPROJ" resourceID="admin" transactionDate="2002-02-04" transactionType="L" units="4" taskID="5017601" inputTypeCode="SALES" groupId="124" voucherNumber="EEE222" transactionClass="DEFG"/>Re: Insert from XML to relational table
http://www.google.ae/search?hl=ar&q=extract+data+from+xml+and+insert+into+Oracle+table+&btnG=%D8%A8%D8%AD%D8%AB+Google&meta= -
Read data from E$ table and insert into staging table
Hi all,
I am a new to ODI. I want your help in understanding how to read data from an "E$" table and insert into a staging table.
Scenario:
Two columns in a flat file, employee id and employee name, needs to be loaded into a datastore EMP+. A check constraint is added to allow data with employee names in upper case only to be loaded into the datastore. Check control is set to flow and static. Right click on the datastore, select control and then check. The rows that have violated the check constraint are kept in E$_EMP+ table.
Problem:
Issue is that I want to read the data from the E$_EMP+ table and transform the employee name into uppercase and move the corrected data from E$_EMP+ into EMP+. Please advise me on how to automatically handle "soft" exceptions in ODI.
Thank youHi Himanshu,
I have tried the approach you suggested already. That works. However, the scenario I described was very basic. Based on the error logged into the E$_EMP table, I will have to design the interface to apply more business logic before the data is actually merged into the target table.
Before the business logic is applied, I need to read each row from the E$EMP table first and I do not know how to read from E$EMP table. -
How to get additional field from the second list base on lookup information column ?
Hi everyone,
Currently I created a SharePoint hosted Apps project and I need to know how can I get additional field from the second list base on lookup information column. example List1 Have 2 columns column1 and column2(Lookup Information from list2 (category)),
List2 have 3 columns title, and category, and color. so how can get the title and color from list2 base on this lookup information column (SharePoint Hosted apps and Javascript code)? that is possible?
Best regards,
------------------------------------------------------------ ---Tola---You can build one custom lookup control. Refer to the following post
http://www.stuartroberts.net/index.php/2012/10/03/enhanced-lookup-field-part-1/
Alternatively, try the following solution from codeplex
http://sp2010filteredlookup.codeplex.com/
http://filteredlookup.codeplex.com/
--Cheers -
How to read the data from XML file and insert into oracle DB
Hi All,
I have below require ment.
I will receive data in the XML file. then i need to read that data and insert into oracle tables. please let me know how this can be handled.
Many Thanks.Sounds a lot like this question, only with less details.
how to read data from XML variable and insert into table variable
We can only help if you provide us details to help as we cannot see what you are doing and only know what you tell us. Plenty of examples abound on the forums that cover the topics you seek as well. -
Get the data from excel and insert into the database
I want to read the data from excel file, get the data from excel and insert into the database.
You can use the Apache POI HSSF API to read data from Excel files and you can use the Sun JDBC API to insert data in database.
This has nothing to do with JSP/JSTL. -
Pool data from text file and insert into database
Can anyone tell me how to pool data from a text file and insert into database?
let's say my text file is in this format
123456 Peter 22
234567 Nicholas 24
345678 Jane 20
Then I need to insert the all the value for this three column into a table which has the three column name ID, Name, Age
Anyone knows? I need to do this urgently...Thank in advanced1. Use BufferedReader and read the file line by line.
2. Loop thru the file and do the following steps with in this loop.
3. Use StringTokenizer to seperate each line into three values (columns).
4. Now create a insert statement with these values and add the statement to the batch (using addBatch() method of PreparedStatement or Statement).
5. Finally (after exiting the loop), execute these batch of statements (using ps.executeBatch()).
Sudha -
For some business requirements, users want to extract values from a multi-value enabled lookup column
and add items to another list based on each separate value. In contrast, others want to find duplicate values in the list and merge associated values to a multi-value enabled column and then
add items to another list based on the merged value. All of these can be achieved using SharePoint Designer 2013 Workflow.
How to extract values from a multi-value enabled lookup column and add items to another list based
on each separate value using SharePoint Designer 2013.
Important actions: Loop Shape; Utility Actions
Three scenarios
Things to note
Steps to create Workflow
How to merge values to a multi-value enabled column and add item to another list based on the
merged value using SharePoint Designer 2013.
Important actions: Call HTTP Web Service; Build Dictionary
Things to note
Steps to create Workflow
How to
extract values from a multi-value enabled lookup column and
add items to another list based on each separate value using SharePoint Designer 2013.
For example, they have three lists as below. They want to
extract values from the Destinations column
in Lookup2 and add items to Lookup3 based on each country and set Title to current item: ID.
Lookup1:
Title (Single line of text)
Lookup2:
Title (Single line of text), Destinations (Lookup; Get information from: Lookup1 in Title column).\
Lookup3:
Title (Single line of text), Country (Single line of text).
Important action
1. Loop Shape: SharePoint Designer 2013 support two types of loops: loop n times and loop with condition.
Loops must also conform to the following rules:
Loops must be within a stage, and stages cannot be within a loop.
Steps may be within a loop.
Loops may have only one entry and one exit point.
2. Utility Actions: It contains many actions, such as ‘Extract Substring from Index of String’ and ‘Find substring in String’.
Three scenarios
We need to loop through the string returned from the look up column and look for commas. There are three
scenarios:
1. No comma but string is non-empty so there is only one country.
2. At least one comma so there is at least two or more countries to loop.
3. In the loop we have consumed all the commas so we have found the last country.
Things to note
There are two things to note:
1. "Find string in string (output to Variable:index)" will return -1 if doesn't find
the searched for string.
2. In the opening statement "Set Variable: Countries to Current Item:Destinations" set the return
field as "Lookup Values, Comma Delimited".
Steps to create Workflow
Create a custom list named Lookup1.
Create a custom list named Lookup2, add column: Destinations (Lookup; Get information from: Lookup1 in Title column).
Create a custom list named Lookup3, add column: Country (Single line of text).
Create a workflow associated to Lookup2.
Add conditions and actions:
Start the workflow automatically when an item is created.
Add item to Lookup2, then workflow will be started automatically and create multiple items to lookup3.
See the below in workflow History List:
How to merge values to a multi-value enabled column and add item to another list based on the
merged value using SharePoint Designer 2013
For example, they have three lists as below. They want to find duplicate values in the Title column in
Lookup3 and merge country column to a multi-value enabled column and then add item to lookup2 and set the Title to Current Item: Title.
Lookup1:
Title (Single line of text)
Lookup3:
Title (Single line of text), Country (Single line of text).
Lookup2:
Title (Single line of text), Test (Single line of text).
Important actions
"Call HTTP Web Service"
action: In SharePoint 2013 workflows, we can call a web service using a new action introduced in SharePoint 2013 named Call HTTP Web Service. This action
is flexible and allows you to make simple calls to a web service easily, or, if needed, you can create more complex calls using HTTP verbs as well as allowing you to add HTTP headers.
“Build Dictionary"
action:
The Dictionary variable type is a new variable type in the SharePoint 2013 Workflow.
The following are the three actions specifically designed for the Dictionary variable type: Build Dictionary, Count Items in a Dictionary and Get an Item from a Dictionary.
The "Call HTTP Web Service" workflow action would be useless without the new "Dictionary" workflow action.
Things to note
The
HTTP URI is set to https://sitename/_api/web/lists/GetByTitle('listname')/items?$orderby=Id%20desc and the HTTP method is set to “GET”. Then the list will be sort by Id in descending order.
Use Get
d/results(0)/Id form
Variable: ResponseContent (Output to
Variable: maxid) to get the Max ID.
Use Set
Variable: minid to Current List:ID to get the Min ID.
Use Copy from
Variable: destianation , starting at
1 (Output to
Variable: destianation) to remove the space.
Steps to create Workflow
Create a custom list named Lookup1.
Create a custom list named Lookup2, add column: Test (Single line of text).
Create a custom list named Lookup3, add column: Country (Single line of text).
Create a workflow associated to Lookup3.
Add a new "Build Dictionary" action
to define the http request header:
Add a Call HTTP Web Serviceaction, click on
this and paste your http request.
To associate the
RequestHeader variable, select the Call action property,
set the
RequestHeaders property to
RequestHeader:
In the Call action, click on
response and associate the response to a new
variable: ResponseContent (of type Dictionary).
After the Call action add Get item from Dictionary action to get the Max ID.
Add Set Workflow Variable action to get the Min ID.
Add Loop Shape (Loop with Condition) to get all the duplicate titles and integrate them to a string.
Create item in Lookup2.
The final Stage should look like this:
Start the workflow automatically when an item is created.
Add item to Lookup3, then workflow will be started automatically and create item to lookup2.
See the below in workflow History List:
References
SharePoint Designer 2013 - Extracting values from a multi-value enabled lookup column into a dictionary as separate items:
http://social.technet.microsoft.com/Forums/en-US/97d34468-1b53-4741-88b0-958472f8ca9a/sharepoint-designer-2013-extracting-values-from-a-multivalue-enabled-lookup-column-into-a
Workflow actions quick reference (SharePoint 2013 Workflow platform):
http://msdn.microsoft.com/en-us/library/jj164026.aspx
Understanding Dictionary actions in SharePoint Designer 2013:
http://msdn.microsoft.com/en-us/library/office/jj554504.aspx
Working with Web Services in SharePoint 2013 Workflows using SharePoint Designer 2013:
http://msdn.microsoft.com/en-us/library/office/dn567558.aspx
Calling the SharePoint 2013 Rest API from a SharePoint Designer Workflow:
http://sergeluca.wordpress.com/2013/04/09/calling-the-sharepoint-2013-rest-api-from-a-sharepoint-designer-workflow/GREAT info, but it may be helpful to note that when replacing a portion of the variable "Countries" with a whitespace character, you may cause the workflow to fail in a few specific cases (certain lookup fields will not accept this and will automatically
cancel). I only found this out when recreating your workflow on a similar, but much more complex list set.
To resolve this issue, I used another utility action (Extract Substring from Index of List) to clear out the whitespace. I configured it as "Copy from
Variable: Countries, starting at
1 (Output to Variable: Countries), which takes care of this issue in those few cases.
Otherwise, WOW! AWESOME JOB! Thanks! :)
Maybe you are looking for
-
Alignment into a TableView cell
Hi, I want to display a checkbox inside a cell of a TableView. I would like it to be centered (horizontally and vertically). how do I do that? I was expecting this to be available on the column definition but could not find anything like this. Are we
-
How to find condition type for a material???
How to find condition type for a material??
-
Scale out file server client access point using public nic
Thoughts on this one. I have a Scale Out File Server cluster with a Client Access Point. Whenever i talk to the Client Access Point it uses the public nics. If i talk to the Scale Out File Server directly it uses the private like i want it to. How ca
-
Direct download of Nokia Maps data
Hi, I am using Nokia 5235, and Nokia Ovi Suite 2.2.0.241, and when I am trying to update the map, it's making troubles, it erases my phone data but not completely download and updates with new map data, the application is being reset during download
-
Trouble Importing New C.D.s HELP PLEASE!!!!
My iTunes won't let me upload any c.d.'s that my friend posted on sendspace for me because it may not be safe or something like that but I was able to get sendspace files about a month ago and now it isn't letting me. Is there some firewall or someth