Import Format script required to update multiple fields
Further to my previous post yesterday (Import Format script required to work across multiple fields I now need my import script to update multiple (two) fields at the same time, based on criteria set across multiple fields. So far, I can use DW.Utilities.fParseString to assess the values across multiple fields, but I now need to update not only the field in question, but also an additional field at the same time. For example:
Function TBService(strField, strRecord)
' How do I update a second field at the same time?
Dim strField2 As String
If Left(strField, 1) = "S" Then
If DW.Utilities.fParseString (strRecord, 3, 8, ",") = "B1110" Then
strField2 = "N101"
Else
strField2 = "Network N/A"
End If
TBService = strField
Else
TBService = "Service N/A"
End If
End Function
Is this even possible? Should I be looking at creating an event script which would work post-import? Or can this be done right here in the import script?
All the logic you require can be encapsulated in the import script for the second field. You don't need to reference the second field in the first import script.
Edited by: SH on May 2, 2012 5:39 PM
Similar Messages
-
Import Format script required to work across multiple fields
I am currently constructing an Import Format, and using datapump import scripts on several of the fields to implement specific logic based on the values present. For example:
Function TBNetwork(strField, strRecord)
If Left(strField, 1) = "N" Then
TBNetwork = strField
Else
TBNetwork = "Network N/A"
End If
End Function
However, I need this to also evaluate the values across other fields too, but the default two inputs for the function are strField and strRecord.
How can I achieve this? Can I declare new variables and define as follows?
Dim strCustomer = varValues(23)
Or do I need to look at implementing a different type of script? Any suggestions would be greatly appreciated!strRecord represents the entire data line from your source file that is currently being processed. You can parse this to get any of the values from your data line to use/evaluate in your script. There is an accelarator script DW.Utilities.fParseString which will do the string parsing for you. As you probably know strField only returns the field from the data file that you have specified in your import format for the associated dimension.
-
Updating multiple fields ... need an advice.
Hello all,
I have a bit of a trouble with updating multiple fields in one table...
Lets say we have two tables. Table one is called t_employe for example:
create table t_employe (
year number,
line varchar2(1),
counter number,
value number)Lets set some random data into table:
insert all
into t_employe (year, line,counter, value)
values(2011,'3','2946','3344')
into t_employe (year, line,counter, value)
values(2011,'3','2947','4433')
into t_employe (year, line,counter, value)
values(2011,'3','2948','4455')
into t_employe (year, line,counter, value)
values(2011,'3','2949','5544')
select * from dualOk second table would be:
create table to_update (
year number,
line varchar2(1),
counter number,
date_pos_1 date,
value_pos_1 number,
date_pos_2 date,
value_pos_2 number,
date_pos_3 date,
value_pos_3 number,
date_pos_4 date,
value_pos_4 number,
date_pos_5 date,
value_pos_5 number)Data:
insert all
into to_update (year, line,counter, date_pos_1,value_pos_1,date_pos_2,value_pos_2,date_pos_3,value_pos_3,date_pos_4,value_pos_4,date_pos_5,value_pos_5)
values(2011,'3','2946',sysdate,'5434',null,null,null,null,null,null,null,null)
into to_update (year, line,counter, date_pos_1,value_pos_1,date_pos_2,value_pos_2,date_pos_3,value_pos_3,date_pos_4,value_pos_4,date_pos_5,value_pos_5)
values(2011,'3','2947',sysdate,'11',sysdate,'123',null,null,null,null,null,null)
into to_update (year, line,counter, date_pos_1,value_pos_1,date_pos_2,value_pos_2,date_pos_3,value_pos_3,date_pos_4,value_pos_4,date_pos_5,value_pos_5)
values(2011,'3','2948',sysdate,'33',sysdate,'44',sysdate,'8908',null,null,null,null)
into to_update (year, line,counter, date_pos_1,value_pos_1,date_pos_2,value_pos_2,date_pos_3,value_pos_3,date_pos_4,value_pos_4,date_pos_5,value_pos_5)
values(2011,'3','2949',sysdate,'1',sysdate,'2',sysdate,'343',sysdate,'78',null,null)
select * from dualOk now what i want to do is to update table to_update fields where value_pos is NULL. To explain it better imagine
collums are from left to right in that order value_pos_1, value_pos_2, value_pos_3 .... Now i would want to check for each row
if value_pos_1 is null ... if it is then update. Finist with this row and move to the next. If its not move to value_pos_2 in
same row and again check if its null. If it is ... update, if not, again move forward. Each cullum value_pos_X has a cullom date_pos_x
which has to be updated same as Value_pos_ cullums (if value_pos_X is null then coresponding date_pos_X will be null as well - thats
a fact in my table).
So is this doable by using only one update?
I manage to write a select statment using case clause which does those things perfectly only for value_pos_X fields. I wonder if i can use it in my
update statment?
select
case when a.value_pos_1 is null then b.value else
case when a.value_pos_2 is null then b.value else
case when a.value_pos_3 is null then b.value else
case when a.value_pos_4 is null then b.value else
case when a.value_pos_5 is null then b.value else to_number('99999','9999,99')
end
end
end
end
end as value
from to_update a,t_employe b
where a.year = b.year
and a.line= b.line
and a.counter = b.counter Any suggestions how to pull this one of?
Thank you!SQL> select *
2 from to_update
3 /
YEAR L COUNTER DATE_POS_ VALUE_POS_1 DATE_POS_ VALUE_POS_2 DATE_POS_ VALUE_POS_3 DATE_POS_ VALUE_POS_4 DATE_POS_ VALUE_POS_5
2011 3 2946 27-AUG-11 5434
2011 3 2947 27-AUG-11 11 27-AUG-11 123
2011 3 2948 27-AUG-11 33 27-AUG-11 44 27-AUG-11 8908
2011 3 2949 27-AUG-11 1 27-AUG-11 2 27-AUG-11 343 27-AUG-11 78
SQL> merge
2 into to_update a
3 using (
4 select a.rowid rid,
5 b.value
6 from to_update a,
7 t_employe b
8 where a.year = b.year
9 and a.line= b.line
10 and a.counter = b.counter
11 ) b
12 on (
13 a.rowid = b.rid
14 )
15 when matched then update set value_pos_1 = nvl2(value_pos_1,value_pos_1,b.value),
16 value_pos_2 = nvl2(value_pos_1,nvl2(value_pos_2,value_pos_2,b.value),value_pos_2),
17 value_pos_3 = nvl2(value_pos_1 + value_pos_2,nvl2(value_pos_3,value_pos_3,b.value),value_pos_3),
18 value_pos_4 = nvl2(value_pos_1 + value_pos_2 + value_pos_3,nvl2(value_pos_4,value_pos_4,b.value),value_pos_4),
19 value_pos_5 = nvl2(value_pos_1 + value_pos_2 + value_pos_3 + value_pos_4,nvl2(value_pos_5,value_pos_5,b.value),value_pos_5)
20 /
4 rows merged.
SQL> select *
2 from to_update
3 /
YEAR L COUNTER DATE_POS_ VALUE_POS_1 DATE_POS_ VALUE_POS_2 DATE_POS_ VALUE_POS_3 DATE_POS_ VALUE_POS_4 DATE_POS_ VALUE_POS_5
2011 3 2946 27-AUG-11 5434 3344
2011 3 2947 27-AUG-11 11 27-AUG-11 123 4433
2011 3 2948 27-AUG-11 33 27-AUG-11 44 27-AUG-11 8908 4455
2011 3 2949 27-AUG-11 1 27-AUG-11 2 27-AUG-11 343 27-AUG-11 78 5544
SQL> Or yhis might be more readable:
merge
into to_update a
using (
select a.rowid rid,
b.value
from to_update a,
t_employe b
where a.year = b.year
and a.line= b.line
and a.counter = b.counter
) b
on (
a.rowid = b.rid
when matched then update set value_pos_1 = case when value_pos_1 is null then b.value else value_pos_1 end,
value_pos_2 = case when value_pos_1 is not null and value_pos_2 is null then b.value else value_pos_2 end,
value_pos_3 = case when value_pos_1 + value_pos_2 is not null and value_pos_3 is null then b.value else value_pos_3 end,
value_pos_4 = case when value_pos_1 + value_pos_2 + value_pos_3 is not null and value_pos_4 is null then b.value else value_pos_4 end,
value_pos_5 = case when value_pos_1 + value_pos_2 + value_pos_3 + value_pos_4 is not null and value_pos_5 is null then b.value else value_pos_5 end
/SY. -
Help with centrally locating a script so it updates all fields?
Hello,
At work we use a form I built that shows were each employee in assigned for the day. We have some part-time personal and I've made it so that they show up in red where all normal employee's show up as black. This works great, my issue is when a new employee is hired or a part-time goes full time I am having to go into each individual field and change this script. There is 60 fields total so as you would imagine this takes a lot of time to update just one employee. Below is a sample of the script I am using to designate if the name should be black (full-time) or red (part-time).
Is there a way that I can point all fields to one location? Then I would only have to update one field and it fix them all??
if (event.value=="BRACKETT" || event.value=="Deleted" ||
event.value=="P. BOWMAN" ||
event.value=="TALLENT" ||
event.value=="EDWARDS" ||
event.value=="MEJIA" ||event.value=="ROGERS" ||event.value=="LASKEY" ||
event.value=="HOUSER" ||
event.value=="BROOKS" ||
event.value=="GORDON") event.target.textColor = color.red;
else event.target.textColor = color.black;
Thank-you so much,
DavidOK, remove all of the code from the document JavaScript and replace it with the code shown below. When you need to update the names in the dropdowns, set up a button and use the following as its Mouse Up script:
// Mouse Up script for a button
updateDropdowns();
You can hide the button and unhide it whenever you need to update, and then hide it again. You can also run that line of code from the interactive JavaScript console, but a button is a bit easier.
This way, you just have to add names and what color you want for each by editing the oEmpNames object code. When you're done editing the list of names, run the updateDropdowns routine and all of the dropdowns will be updated with the new list.
// All if the code below goes in a document JavaScript
// Create an object to associate an employee name with text color to user when selected in a dropdown
var oEmpNames = {
"George Washington" : color.black,
"Thomas Jefferson" : color.red,
"Abraham Lincoln" : color.black,
"Teddy Roosevelt" : color.black,
"John Kennedy" : color.red,
"Ronald Reagan" : color.black
// Validate script for dropdowns
function validateEmpName() {
event.target.textColor = oEmpNames[event.value];
// Function to update dropdowns with list of employee names
function updateDropdowns() {
// Create an array of names to populate the dropdown items
var aItems = [];
for (var name in oEmpNames) {
aItems.push(name);
// Loop through the dropdowns and populate them with names in the array
for (var i = 0; i < aDropdowns.length; i += 1) {
getField(aDropdowns[i]).setItems(aItems);
// Create an array of dropdown names
var aDropdowns = [
"Dropdown1",
"Dropdown4922",
"Dropdown4923",
"Dropdown4924",
"Dropdown490",
"Dropdown482",
"Dropdown470",
"Dropdown4600",
"Dropdown491",
"Dropdown480",
"Dropdown471",
"Dropdown461",
"Dropdown492",
"Dropdown481",
"Dropdown472",
"Dropdown4620",
"Dropdown493",
"Dropdown483",
"Dropdown473",
"Dropdown463",
"Dropdown494",
"Dropdown48",
"Dropdown47",
"Dropdown460",
"Dropdown47011",
"Dropdown46011",
"Dropdown47211",
"Dropdown4621",
"Dropdown47311",
"Dropdown46311",
"Dropdown2",
"Dropdown4",
"Dropdown5",
"Dropdown11",
"Dropdown4925",
"Dropdown4926",
"Dropdown4927",
"Dropdown4901",
"Dropdown4821",
"Dropdown4701",
"Dropdown4601",
"Dropdown4911",
"Dropdown4801",
"Dropdown4711",
"Dropdown4611",
"Dropdown4921",
"Dropdown4811",
"Dropdown4721",
"Dropdown462",
"Dropdown4931",
"Dropdown4831",
"Dropdown4731",
"Dropdown4631",
"Dropdown4941",
"Dropdown4813",
"Dropdown4712",
"Dropdown46",
"Dropdown47019",
"Dropdown460116",
"Dropdown472129",
"Dropdown462186",
"Dropdown473115",
"Dropdown463158" -
Update multiple fields using select query efficiently – 9i
I need to populate a table called prop_charact used for synching data to a legacy system.
Prop_charact has fields that are found in a few other tables (no one field is found in more than one table outside of prop_charact). I want to pull the data from the corresponding fields in the source tables and put it into prop_charact. I only want to populate prop_charact with records that have been updated, but want to pull all fields for those records (whether or not that field has been updated). I am getting the list of updated records from a transaction history table.
After getting that list, I was not sure what to do with it.
I put what I want to do in terms of strictly SQL. I am thinking there are more efficient (less system resources) ways of doing this, but I am not sure what to pursue. I can use PL/SQL, but please keep in mind I am limited to using version 9i. Anyone have any hints about what I should look into using instead of just thes particular SQL statements?
insert into eval.prop_charact (parcelno, propertyid)
select distinct p.parcelno, p.propertyid
from eval.transaction_history tr,
admin.properties p
where tr.propertyid = p.propertyid
and trim(tr.tablename) in ('PROPERTIES', 'PROPERTYCHARACTERISTICS','EQID','NEWCHARACTERISTICS','DIMENSIONS', 'NON_RESIDENTIALS')
and trim(tr.fieldname) in ('BLDGCODE', 'CATCODE', 'UNFINISHED', 'TOPOGRAPHY', 'GARAGETYPE', 'GARAGESPACES', 'OPENSPACES',
'VIEW', 'GENERALCONSTRUCTION', 'YEARBUILT', 'ESTIMATEDYEAR', 'TOTALROOMS', 'TOTALBEDROOMS',
'BASEMENTTYPE', 'NUMBEROFFIREPLACES', 'HEAT', 'CENTRALAIR','CONDITION','SITE_TYPE','TOTALDWELLINGAREA',
'PLOTFRONT','PLOTDEPTH','PLOTSQFT','SHAPE','STORIES','FULLBATHROOMS','PARTBATHROOMS','MULTIPLE_BLDGS')
and tr.trans_date >= to_date('01-01-2010', 'MM/DD/YYYY')
and tr.trans_date < sysdate
order by p.parcelno;
update
select p.BLDGCODE pBLDGCODE, epc.BLDGCODE epcBLDGCODE, p.CATCODE pCATCODE,epc.CATCODE epcCATCODE,
p.UNFINISHED pUNFINISHED, epc.UNFINISHED epcUNFINISHED,
pc.TOPOGRAPHY pcTOPOGRAPHY, epc.TOPOGRAPHY epcTOPOGRAPHY,
pc.GARAGETYPE pcGARAGETYPE, epc.GARAGETYPE epcGARAGETYPE,
pc.GARAGESPACES pcGARAGESPACES, epc.GARAGESPACES epcGARAGESPACES,
pc.OPENSPACES pcOPENSPACES, epc.OPENSPACES epcOPENSPACES, pc.VIEW_ pcVIEW_, epc.VIEW_ epcVIEW_,
pc.GENERALCONSTRUCTION pcGENERALCONSTRUCTION,
epc.GENERALCONSTRUCTION epcGENERALCONSTRUCTION,
pc.YEARBUILT pcYEARBUILT, epc.YEARBUILT epcYEARBUILT,
pc.ESTIMATEDYEAR pcESTIMATEDYEAR, epc.ESTIMATEDYEAR epcESTIMATEDYEAR,
pc.TOTALROOMS pcTOTALROOMS, epc.TOTALROOMS epcTOTALROOMS,
pc.TOTALBEDROOMS pcTOTALBEDROOMS, epc.TOTALBEDROOMS epcTOTALBEDROOMS,
pc.BASEMENTTYPE pcBASEMENTTYPE, epc.BASEMENTTYPE epcBASEMENTTYPE,
pc.NUMBEROFFIREPLACES pcNUMBEROFFIREPLACES, epc.NUMBEROFFIREPLACES epcNUMBEROFFIREPLACES,
pc.HEAT pcHEAT, epc.HEAT epcHEAT, pc.CENTRALAIR pcCENTRALAIR, epc.CENTRALAIR epcCENTRALAIR,
e.CONDITION eCONDITION, epc.CONDITION epcCONDITION,
n.SITE_TYPE nSITE_TYPE, epc.SITE_TYPE epcSITE_TYPE,
d.TOTALDWELLINGAREA dTOTALDWELLINGAREA, epc.TOTALDWELLINGAREA epcTOTALDWELLINGAREA,
d.PLOTFRONT dPLOTFRONT, epc.PLOTFRONT epcPLOTFRONT,
d.PLOTDEPTH dPLOTDEPTH, epc.PLOTDEPTH epcPLOTDEPTH,
d.PLOTSQFT dPLOTSQFT, epc.PLOTSQFT epcPLOTSQFT,d.SHAPE dSHAPE, epc.SHAPE epcSHAPE,
pc.STORIES pcSTORIES, epc.STORIES epcSTORIES,
n.FULLBATHROOMS nFULLBATHROOMS,epc.FULLBATHROOMS epcFULLBATHROOMS,
n.PARTBATHROOMS nPARTBATHROOMS, epc.PARTBATHROOMS epcPARTBATHROOMS,
nr.MULTIPLE_BLDGS nrMULTIPLE_BLDGS, epc.MULTIPLE_BLDGS epcMULTIPLE_BLDGS
from eval.prop_charact epc, admin.properties p, admin.propertycharacteristics pc, admin.eqid e,
admin.dimensions d, eval.newcharacteristics n, EVAL.non_residentials nr
where epc.propertyid = p.propertyid and epc.propertyid = pc.propertyid and epc.propertyid = e.propertyid(+)
and epc.propertyid = d.propertyid(+) and epc.propertyid = n.propertyid(+) and epc.propertyid = nr.propertyid(+)
set epcBLDGCODE= pBLDGCODE, epcCATCODE= pCATCODE, epcUNFINISHED = pUNFINISHED,
epcTOPOGRAPHY = pcTOPOGRAPHY, epcGARAGETYPE = pcGARAGETYPE, epcGARAGESPACES = pcGARAGESPACES,
epcOPENSPACES = pcOPENSPACES, epcVIEW_ = pcVIEW_, epcGENERALCONSTRUCTION = pcGENERALCONSTRUCTION,
epcYEARBUILT = pcYEARBUILT, epcESTIMATEDYEAR = pcESTIMATEDYEAR, epcTOTALROOMS = pcTOTALROOMS,
epcTOTALBEDROOMS = pcTOTALBEDROOMS, epcBASEMENTTYPE = pcBASEMENTTYPE,
epcNUMBEROFFIREPLACES = pcNUMBEROFFIREPLACES, epcHEAT = pcHEAT, epcCENTRALAIR = pcCENTRALAIR,
epcCONDITION = eCONDITION, epcSITE_TYPE = nSITE_TYPE, epcTOTALDWELLINGAREA = dTOTALDWELLINGAREA,
epcPLOTFRONT = dPLOTFRONT, epcPLOTDEPTH = dPLOTDEPTH, epcPLOTSQFT = dPLOTSQFT,
epcSHAPE = dSHAPE, epcSTORIES = pcSTORIES, epcFULLBATHROOMS = nFULLBATHROOMS,
epcPARTBATHROOMS = nPARTBATHROOMS, epcMULTIPLE_BLDGS = nrMULTIPLE_BLDGS;The following example may be of help.
SQL> create table mytable(col1 number(1),
2 col2 date);
Table created.
SQL> insert into mytable values(1,sysdate);
1 row created.
SQL> select * from mytable;
COL1 COL2
1 20-AUG-04
SQL> update mytable
2 set (col1,col2) = (select 2, sysdate-1 from dual);
1 row updated.
SQL> select * from mytable;
COL1 COL2
2 19-AUG-04 -
Update multiple fields with same/diffrent name
I have the form is displayed order no, message and sent_date. Mesage and Date sent are editable. I can change value from both colums in diffrent values then hit submit for update. My code below is loop thur message and date sent field then update them based on the pk ID. Unfortunately, it didn't work as the expected. Can you please help?
Oder NO
Message
Date Sent
5463
first message
12-10-12
5463
second message
10-13-12
<cfset myIds = ArrayNew(1)>
<cfform name="update" method="post">
<cfloop query="qMesg">
<cfscript>
ArrayAppend(myIds, "#id#");
</cfscript>
<cfinput type="text" value="#mesg#" name="mesg">
<cfinput type="text" value="#dateformat(sent_date, 'mm-dd-yy')#" name="sent_date" validate="date" />
<cfinput type="submit" name="submit" value="Update">
</cfloop>
<cfset myIdsList = #ArrayToList(myIds, ",")#>
<cfinput type="hidden" name="ids" value="#myIdsList#">
</cfform>
<!---update--->
<cfif isDefined("form.submit")>
<cfloop index="idIdx" list="#newsids#" delimiters=",">
<cfloop list="#form.mesg#" index="x">
<cfloop list="#form.sent_date#" index="y">
update [tblMessg]
set mesg = <cfqueryparam value="#x#" cfsqltype="cf_sql_varchar">,
sent_date = <cfqueryparam value="#y#" cfsqltype="cf_sql_date">
where id = <cfqueryparam value="#idIdx#" cfsqltype="cf_sql_integer">
</cfloop>
</cfloop>
</cfloop>
</cfif>I am with Dan on this (identifying the field names with IDs), but prefer cfloop to cfoutput within cfform. Furthermore, I would put the submit button outside the loop.
<cfloop query="qMesg">
<cfscript>
ArrayAppend(myIds, "#id#");
</cfscript>
<cfinput type="text" value="#mesg#" name="mesg#id#">
<cfinput type="text" value="#dateformat(sent_date, 'mm-dd-yy')#" name="sent_date#id#" validate="date" />
</cfloop>
<cfinput type="submit" name="submit" value="Update">
With proper handling, one loop should be sufficient on the action page.
<cfloop index="idIdx" list="#form.ids#" delimiters=",">
<cfset current_message = form["mesg" & idIdx]>
<cfset current_date_sent = form["sent_date" & idIdx]>
<cfquery>
UPDATE tblMessg
SET mesg = <cfqueryparam value="#current_message#" cfsqltype="cf_sql_varchar">,
sent_date = <cfqueryparam value="#current_date_sent#" cfsqltype="cf_sql_date">
WHERE id = <cfqueryparam value="#idIdx#" cfsqltype="cf_sql_integer">
</cfquery>
</cfloop> -
Updating multiple fields at once
i have a form with a check box
<cfinput type="checkbox" name="update_friend" value="1"
checked="yes">
then on the action page my query reads
<cfparam name="FORM.update_friend" default="0">
<cfquery datasource="#application.datasource#">
UPDATE user_friend
SET update_friend = #FORM.update_friend#
WHERE id_friend =#FORM.id_friend# (THIS IS THE PRIMARY KEY
FOR THE TABLE I AM TRYING TO UPDATE)
</cfquery>
when i submit this, i am getting a mysql error message,
any help would be appreciated
thanksok let me explain a bit more...
i have a system which shows what your friends have been doing
on my website...what artists they have added into the database
etc(Updates)....what i am trying to do is allow people to choose
which friends they would like to recieve updates for...
so i have a column called update_friend which is set to
default 1 in the friends table...then I have a query on the updates
page which shows the activity of all of your friends with a 1 in
the update_friend column...
to allow people to control which friends they recieve updates
from I have a form which checkboxes
<a href="
http://www.musicexplained.co.uk/delete/updates_opt.cfm">click</a>
if you want to remove a friend from your updates list you
would decheck the checkbox next to their name and then submit...
what i would then like to happen.....is for the query to
update the checked check boxes with 1 so the user will still
recieve updates from those people, and update the unchecked check
boxes with 0 so they no longer recieve updates from them
if I have 4 checked check boxes out of the 7 i am getting a
list (1,1,1,1) as an output, which would suggest initially that the
<cfparam name="FORM.update_friend" default="0"> isnt working,
but regardless of this I would like if john was checked, dave was
checked, mary was checked and james was checked, and then hilary,
donny and gas was unchecked.......john, dave, mary and james would
be updated with 1 in their update_friend columns, and the rest
would be updated with 0 ..
so essentially the query would be
UPDATE user_friend
SET update_friend = 1,1,1,1,0,0,0
WHERE id_friend IN (12,13,14,15,16,17,18)
thanks -
Updating multiple fields using a single update statement.
Hi All,
I am a beginner to Oracle. I have used the following Hint in an update query that is executed in Oracle 10G. We recently updated the Oracle to version 11g and when executing the query getting the following Error: ORA-01779: cannot modify a column which maps to a non key-preserved table. PFB the query. Please suggest me some ways that I can do to avoid this error.
UPDATE /*+ bypass_ujvc */
(SELECT t1.STG_DEL_CONDITION, t2.condition
FROM stg_reports_membenft_latest T1 JOIN (select ods_ssn_grp,sys_id, first_value(STG_DEL_CONDITION) over(PARTITION BY ods_ssn_grp,sys_id
ORDER BY STG_DEL_CONDITION DESC) AS
condition from stg_reports_membenft_latest) T2
ON T1.ods_ssn_grp = T2.ods_ssn_grp AND T1.SYS_ID=T2.SYS_ID ) x
SET x.STG_DEL_CONDITION = x.condition;
Thanks and Regards,
Karthik Sivakumar.I used the below query and got the Result.
Thank You all
MERGE INTO stg_reports_membenft_latest x1
USING (SELECT distinct ods_ssn_grp,
sys_id,
First_value(STG_DEL_CONDITION) OVER(partition BY ods_ssn_grp,sys_id
ORDER BY STG_DEL_CONDITION DESC)
AS condition
FROM stg_reports_membenft_latest) x2
ON ( x1.ods_ssn_grp = x2.ods_ssn_grp
AND x1.SYS_ID = x2.sys_id )
WHEN matched THEN
UPDATE SET x1.STG_DEL_CONDITION=x2.condition; -
FDM Fixed-Width Import Format & Multiple Accounts/Periods Issue
Hi FDM experts,
I have an issue that I wanted to reach out to you on regarding fixed-width import formats and how to cater for my current scenario for export to Hyperion Planning.
I am working with a flat file (.txt) I need to import to FDM with the current format;
A
B
C
D
E
F
G
Z
Year
Channel
Product
Jan-MTD-Account 1
Jan-MTD-Account 2
Jan-YTD-Account1
Jan-YTD-Account2
Dec-YTD-Account2
2013
Channel_1
Product_1
1000
2000
1000
2000
10000
These are all fixed in width so the field lengths will need to be defined in the import format. The requirement for loading to the system is only a speciifc Month YTD value for both Account1 and Account 2.
If my chosen Month is 2013 Jan, I will only require columns F and G to be loaded. These are the issues I have identified;
Can a fixed width import format cater for loading to multiple accounts in the same file? Or would I need a separate import format per account?
Can a fixed width import format cater for loading to a variable Actual Month period? Or do I need 12 import formats/locations per month?
Your help is much appreciated!
Many thanks
AaronHi Aaron,
the solution you are looking for needs pivoting your source file.
Think that FDM, by default, only accepts files with one single column for amount. You have to pivot your file based on your logic and import the pivoted file.
For example:
Year Channel Product ... Jan-YTD-Acc1 Jan-YTD-Acc2 ...
2013 CH1 PR1 1000 2000
If your POV is Jan-2013, your data imported will look like:
Year Channel Produc Account Amount
2013 CH1 PR1 ACC1 1000
2013 CH1 PR1 ACC2 2000
All this process can be automated by playing with Import Scripts.
HTH -
need to run through a list of old to new data (.csv) file and change them in a sharepoint list - can not make it work
here is my base attempt.
$web = Get-SPWeb site url
$list = $web.lists["List Name"]
$item = $list.items.getitembyid(select from the items.csv old)
$modifiedBy = $item["Editor"]
#Editor is the internal name of the Modified By column
$item["old"] = "new from the .csv file parsed by power sehll
$ite.Syste,Update($false);
$web.Dispose()Hi,
According to your description, my understanding is that you want to update SharePoint field value from a CSV file recursively.
We can import CSV file using the Import-CSV –path command, then update the field value in the foreach loop.
Here is a code snippet for your reference:
Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue
$csvVariable= Import-CSV -path "http://sp2010.contoso.com/finance/"
# Destination site collection
$WebURL = "http://sp2010.contoso.com/sites/Utility/"
# Destination list name
$listName = "Inventory"
#Get the SPWeb object and save it to a variable
$web = Get-SPWeb -identity $WebURL
#Get the SPList object to retrieve the list
$list = $web.Lists[$listName]
#Get all items in this list and save them to a variable
$items = $list.items
#loop through csv file
foreach($row in $csvVariable)
#loop through SharePoint list
foreach($item in $items)
$item["ID #"]=$row."ID #"
$item.Update()
$web.Dispose()
Here are some detailed articles for your reference:
http://blogs.technet.com/b/stuffstevesays/archive/2013/06/07/populating-a-sharepoint-list-using-powershell.aspx
http://social.technet.microsoft.com/wiki/contents/articles/25125.sharepoint-2013-powershell-to-copy-or-update-list-items-across-sharepoint-sites-and-farms.aspx
Thanks
Best Regards
Jerry Guo
TechNet Community Support -
I need to export data from BW (7.0) to another non-SAP Oracle based DB table. This external DB system has a text file interface that BW must export to that requires an update method field in order to use a delta method. The values required are "I" for input, "U" for update and "D" for delete.
I was thinking of using a DSO with the 0RECORDMODE field to indicate the delta method. Research tells me that to populate the 0RECORDMODE field I need to add it to the "Record Mode Field" (INVFIELD) in the ROOSFIELD table. How do I do that without editing ROOSFIELD table directly, i.e. is there a transaction to edit like RSA2 Extraction tab, Record Mode Field?
On a sidenote, has anyone else exported to a non-SAP Oracle DB from BW using a delta update?
AlHello,
Not sure why you are going for ROOSFIELD tables.
Since its a text file interface then you may want to use open hub to store the file imported from DSO to a text file and then use it as source for the oracle system.
If you use the delta option from the DSO to update to the files then the recordmode field is automatically populated based on kind of change to the records.
Since the delta will be loaded from the change log of the DSO therefore you need not maintain it manually in a table.You may not get the values which you are looking for like I and U but it will contain before and after image which you can try to use ...may be only after image is required.
As far as I know nothing needs to be maintained for the table ROOSFIELD.
Thanks
Ajeet -
How can I create a search plugin for multiple fields
There are a number of sites that have search capabilities but they require entries into multiple fields.
One such site is for instance the IBM Employee directory.
(http://www.ibm.com/contact/employees/servlets/lookup)
On this site - in order to get usable results - I have to enter both First name and Last name of the employee I'm looking for.
I created a search plugin for the site, however I wasn't able to split the entered text into two parts and provide them as separate fields for the form.
Is there a way to do this?
Regards,
ImreHi,
This is excellent. Not search-plugin though but but this is as good as a search-plugin. (Even better, as I haven't seen any solution with the plugins for the problem.)
I didn't know that it was possible to use javascript as bookmark location.
Thanks,
Imre -
Need to update custom fields in MSEG table using "BAPI_GOODSMVT_CREATE"
Hi All,
There is a requirement to update custom fields in table MSEG which are part of append structure. There is a option to update the custom fields using the one of the tables parameters "EXTENSIONIN". Anyone please advice how can I update the custom field thru EXTENSIONIN.
Thanks in advance.
cheers,
Vijaysee the help
http://help.sap.com/saphelp_nw04/helpdata/en/c3/4099948b8911d396b70004ac96334b/frameset.htm
Regards
Kiran Sure -
Update OIM field with process form fields
Hi,
I have configured AD as a target resource to my OIM. Now i have a requirement to update few fields of OIM , on the basis of change in the fields of process form when target recon will run. For this, as per my understanding i can use the post insert/post update adapter. I wrote the adapter code as well. But when now i am running the recon against my resource, and updating the field, it couldn't even run the adapter as nothing has been written in logs (not even the println statements mentioned in adapter code :( ). Could anyone please tell me where i am missing.Hi,
I did create a task and assign it on "Event Processed" (Response) under reconciliation insert recieved and reconciliation update recieved. Now when i tried to run recon it is giving me error while processing the recon event. Error is "An error occured while processing the off lined reconciliation event. [xellerate.jms] processing reconciliation message with id <recon event id> failed" . Am i missing something.... Please help
TIA -
Initial download - update additional fields/execute additional funct.
Hi All,
We are in the process of uploading data from SAP system to CRM system as a initial download (Transaction code R3CS). Customer has a unique requirement of updating additional fields (configurable fields) from ISU to CRM which are not covered in the initial upload program.
Is there any enhancement/BADI/customizing available in initial or delta upload program to plug in customer specific updates/steps (ie executing Zxxx function module) ?
Thanks in advance ,
NitinHello Michael,
I'd appreciate if you could forward me this document, too.
[email protected]
Thanks in advance & kind regards
Wolfgang
Maybe you are looking for
-
CreateInsert and LOV with multiple return values
HI. I am on Build JDEVADF_11.1.2.3.0_GENERIC_120914.0223.6276.1 I have a View Object which is based on Entity Object. View Object has customer_name and customer_id attributes. customer_name attribute has LOV (input field with LOV) based on some other
-
Want to understand SID concept...
Hello experts, why not using the value like e. g. customer number directly in the dimension table instead of a SID? So I also could save one table (SID table) and with this on JOIN by linking directly to the master data tables (text, attributes, hie
-
Call WS from stored procedure (Oracle)
Hi All I have scenario: JDBC - XI - RFC. It works fine. Now I want to change it to SOAP - XI - RFC. I can take wsdl url in Sender Agreement. I can test it from Web Services Navigator - it is ok. Can I send message from Oracle using soap_api? Give me
-
Install script - checking install option and forcing exit
Anyone know how to accomplish these two things: 1. Determine if the installation was called with a "/silent" switch on the command line 2. Force the install to stop after checking a condition (e.g. a process running) - during the "On Begin Install" s
-
LRM-00101: unknown parameter name _optimizer_use_feedback
HI team, I have got issue while starting the database using pfile, as the queries are getting slower in fetching the result, we have decided to add the parameter optimizeruse_feedback=false in the pfile and bring up the database. but the startup is t