How to update column value dynamically
Hi All,
I have created a simple mapping and selected insert/update on target table. In target table there is one column record_type which will hold either 'NEW' (if new record is inserting) or 'UPDATED'(if existing record is updating) value. Please let me know how can I do this using OWB PL/SQL map?
Thanks
Bhushan
Hi Sanjaya,
Thank you for your reply.
I like your approch but i think there is need to pass 'UPDATED' when intersect is being used and 'NEW' when minus is being used.
I have developed an OWB map as mentioned in below steps.
1. Chose source (TableA) and target (TableB) as source using table operator.
2. Joined TableA to TableB on col1 using left outer join using joined operator.
3. In expression operator I have calculated value for TableB.col3 using below logic.
CASE WHEN TableB.col1 IS NULL THEN 'NEW' ELSE 'UPDATED' END
4. Mapped columns from expression operator to target table.
I would like to know you comments on above approch. My OWB map has generated below merge statement.
MERGE INTO TableB
USING(SELECT MERGESQL.col1,MERGESQL.col2, CASE WHEN MERGESQL.col3 is null then 'NEW' else 'UPDATED' END col3
FROM (SELECT TableA.col1, TableA.col2,TableB.col1 AS col3
FROM TableA
LEFT OUTER JOIN TableB
ON (TableA.col1 = TableB.col1)) MERGESQL
ON (col1 = MERGESQL.col1)
WHEN NOT MATCHED THEN INSERT(col1,col2,col3) VALUES(MERGESQL.col1,MERGESQL.col2,MERGESQL.col3)
WHEN MATCHED THEN
UPDATE SET col2 = MERGESQL.col2,
col3 = MERGESQL.col3;
Similar Messages
-
How to update column values in a table where that column is referring to different tables
i have a table Order it has columns
OrderID, Name, Total
1 trade value populated from i.e. tradeorder table
2 fixed value is populated from fixedorder table
3 annual value populated from another table
I m thinking of creating function for every order id to call those tables..
and there are many insertions taking place in order table ,,at the moment its 20 rows ..
kindly provide your suggestionsYou can group rows in order table and update the set of row from the specific table. For instance
UPDATE [ORDER] SET [TOTAL]=B.[TOTAL] FROM [ORDER] A INNER JOIN [TRADEORDER] B ON A.ORDERID=B.ORDERID WHERE A.NAME='TRADE'
UPDATE [ORDER] SET [TOTAL]=B.[TOTAL] FROM [ORDER] A INNER JOIN [FIXEDORDER] B ON A.ORDERID=B.ORDERID WHERE A.NAME='FIXED'
UPDATE [ORDER] SET [TOTAL]=B.[TOTAL] FROM [ORDER] A INNER JOIN [ANOTHERTABLE] B ON A.ORDERID=B.ORDERID WHERE A.NAME='ANNUAL'
Regards, RSingh -
How to update Column value in a list using powershell.
Hi All,
I am trying to copy value of One column to another column in same list. I am using SPSiteDataQuery for this. I am using following power shell script.
if ((Get-PSSnapin -Name Microsoft.SharePoint.Powershell -ErrorAction SilentlyContinue) -eq $null )
Add-PSSnapin Microsoft.SharePoint.Powershell
$CopyFromColumnName1 = "Section-1 Summary" #column copy source 1
$CopyToColumnName1 = "RichTextBoxControl" #destination column 1
$siteCollectionUrl = http://someURL
$site =new-object Microsoft.SharePoint.SPSite($siteCollectionUrl)
$query = new-object Microsoft.SharePoint.SPSiteDataQuery
$query.ViewFields = "<FieldRef Name='Title' /><FieldRef Name='PublishingPageLayout' /><FieldRef Name='FileLeafRef' /><FieldRef Name='RTC' /><FieldRef Name='SummaryOne' />";
$query.Webs = "<Webs Scope='SiteCollection'>"
$query.Lists = "<Lists ServerTemplate='850'/>"
$query.Query = "<Where>
<Contains>
<FieldRef Name='PublishingPageLayout' />
<Value Type='URL'>SomePageLayout</Value>
</Contains>
</Where>"
$spListItems = $site.rootweb.GetSiteData($query)
#Write-Host $spListItems
foreach($row in $spListItems.Rows)
$row.RTC = $row.SummaryOne
write-Host $row.RTC
$childWeb.Dispose()
$site.Dispose()
Here the column RTC is not updating on executing the script. I want to copy data from "SummaryOne" to "RTC" column.
Please assist me with this issue.
amolHi Bruno,
Thanks for reply I use following script and it is working for me.
if ((Get-PSSnapin
-Name Microsoft.SharePoint.Powershell
-ErrorAction SilentlyContinue)
-eq $null )
Add-PSSnapin
Microsoft.SharePoint.Powershell
#Use the Display Names
$webApplicationURL
= Read-Host
'Provide Site collection/Contnt HUB URL'
$webApp
= Get-SPWebApplication
$webApplicationURL
$CopyFromColumnName1
= "colName"
#column copy source 1
$CopyToColumnName1
= "coltoCopyVal"
#destination column 1
if($webApp
-ne $null)
foreach($siteCollectionUrl
in $webApp.Sites)
$site =new-object
Microsoft.SharePoint.SPSite($siteCollectionUrl.Url)
$query =
new-object Microsoft.SharePoint.SPSiteDataQuery
$query.ViewFields
= "<FieldRef Name='Title' /><FieldRef Name='PublishingPageLayout' /><FieldRef Name='FileLeafRef' /><FieldRef Name='RTC' /><FieldRef Name=’Name’ />";
$query.Webs
= "<Webs Scope='SiteCollection'>"
$query.Lists
= "<Lists ServerTemplate='850'/>"
$query.Query
= "<Where>
<Contains>
<FieldRef Name='PublishingPageLayout' />
<Value Type='URL'>PageLayout</Value>
</Contains>
</Where>"
$spListItems
= $site.rootweb.GetSiteData($query)
#Write-Host $spListItems
foreach($row
in $spListItems.Rows)
$listId
= $row["ListId"]
$webId =
$row["WebId"]
$childWeb
= $site.OpenWeb([GUID]($webId))
$pagesList
= $childWeb.Lists[[GUID]($listId)];
$itemUrl
= $childWeb.Url
+ "/"
+ $pagesList.RootFolder.Url
+ "/"
+ $row['FileLeafRef'].Split(';#')[2]
$listItme
= $pagesList.GetItemById($row.ID)
$listItme['RTC']
= $listItme[Name']
[Microsoft.SharePoint.SPSecurity]::RunWithElevatedPrivileges({
$listItme.SystemUpdate()
$childWeb.Dispose()
$site.Dispose()
else
Echo $webApplicationURL
"does not exist, check the WebApplication name"
Regards
Amol
amol -
How to get column values on item added event receiver
Hi,
I have two columns in a document library and one is people or group column and the other one is choice column with check boxes.
I want to know how to read column values on Item Added event receiver, so that I can create if statements based on those values.
Thank you,
AA.Hi AOK2013,
Have you had a look at this Microsoft tutorial: http://msdn.microsoft.com/en-us/library/office/gg981880(v=office.14).aspx
Essentially, you want to use the AfterProperties property to access the changed field value.
E.g.
var personvalue = properties.AfterProperties["YourPersonFieldName"]
Regards, Matthew
MCPD | MCITP
My Blog
View
Matthew Yarlett's profile
See my webpart on the TechNet Gallery that allows administrative users to upload, crop and format user profile photos. Check it out here:
Upload and Crop User Profile Photos -
How to update field values in a database table using module pool prg?
hi
how to update field values in a database table using module pool prg?
we created a customized table, and we put 2 push buttons in screen painter update and display.
but update is not working?
data is enter into screen fields and to internal table, but it is not updated in database table.
thanks in adv
vidyaHI,
we already used the update statement. but its not working.
plz check this.
*& Module Pool ZCUST_CALL_REC
PROGRAM ZCUST_CALL_REC.
TABLES: ZCUST_CALL_REC,ZREMARKS.
data: v_kun_low like ZCUST_CALL_REC-kunnr ,
v_kun_high like ZCUST_CALL_REC-kunnr,
v_bud_low like ZCUST_CALL_REC-budat,
v_bud_high like ZCUST_CALL_REC-budat.
ranges r_kunnr for ZCUST_CALL_REC-kunnr .
ranges r_budat for zcust_call_rec-budat.
DATA: ITAB TYPE STANDARD TABLE OF ZCUST_CALL_REC WITH HEADER LINE,
JTAB TYPE STANDARD TABLE OF ZREMARKS WITH HEADER LINE.
*data:begin of itab occurs 0,
MANDT LIKE ZCUST_CALL_REC-MANDT,
kunnr like ZCUST_CALL_REC-kunnr,
budat like ZCUST_CALL_REC-budat,
code like ZCUST_CALL_REC-code,
remarks like ZCUST_CALL_REC-remarks,
end of itab.
*data:begin of Jtab occurs 0,
MANDT LIKE ZCUST_CALL_REC-MANDT,
kunnr like ZCUST_CALL_REC-kunnr,
budat like ZCUST_CALL_REC-budat,
code like ZCUST_CALL_REC-code,
remarks like ZCUST_CALL_REC-remarks,
end of Jtab.
CONTROLS:vcontrol TYPE TABLEVIEW USING SCREEN '9001'.
CONTROLS:vcontrol1 TYPE TABLEVIEW USING SCREEN '9002'.
*start-of-selection.
*& Module USER_COMMAND_9000 INPUT
text
MODULE USER_COMMAND_9000 INPUT.
CASE sy-ucomm.
WHEN 'BACK' OR 'EXIT' OR 'CANCEL'.
SET SCREEN 0.
LEAVE SCREEN.
CLEAR sy-ucomm.
WHEN 'ENQUIRY'.
perform multiple_selection.
perform append_CUSTOMER_code.
PERFORM SELECT_DATA.
call screen '9001'.
WHEN 'UPDATE'.
perform append_CUSTOMER_code.
PERFORM SELECT_DATA.
call screen '9002'.
perform update on commit.
WHEN 'DELETE'.
perform append_CUSTOMER_code.
PERFORM SELECT_DATA.
call screen '9002'.
ENDCASE.
ENDMODULE. " USER_COMMAND_9000 INPUT
*& Module STATUS_9000 OUTPUT
text
MODULE STATUS_9000 OUTPUT.
SET PF-STATUS 'ZCUSTOMER'.
SET TITLEBAR 'xxx'.
ENDMODULE. " STATUS_9000 OUTPUT
*& Module USER_COMMAND_9001 INPUT
text
MODULE USER_COMMAND_9001 INPUT.
CASE sy-ucomm.
WHEN 'BACK' OR 'EXIT' OR 'CANCEL'.
SET SCREEN 0.
LEAVE SCREEN.
CLEAR sy-ucomm.
endcase.
ENDMODULE. " USER_COMMAND_9001 INPUT
*& Module STATUS_9001 OUTPUT
text
MODULE STATUS_9001 OUTPUT.
SET PF-STATUS 'ZCUSTOMER'.
SET TITLEBAR 'xxx'.
move itab-MANDT to zcust_call_rec-MANDT.
move itab-kunnr to zcust_call_rec-kunnr.
move itab-budat to zcust_call_rec-budat.
move itab-code to zcust_call_rec-code.
move itab-remarks to zcust_call_rec-remarks.
vcontrol-lines = sy-dbcnt.
ENDMODULE. " STATUS_9001 OUTPUT
*& Module USER_COMMAND_9002 INPUT
text
module USER_COMMAND_9002 input.
CASE sy-ucomm.
WHEN 'BACK' OR 'EXIT' OR 'CANCEL'.
SET SCREEN 0.
LEAVE SCREEN.
CLEAR sy-ucomm.
WHEN 'UPDATE'.
perform move_data.
UPDATE ZCUST_CALL_REC FROM TABLE ITAB.
IF SY-SUBRC = 0.
MESSAGE I000(0) WITH 'RECORDS ARE UPDATED'.
ELSE.
MESSAGE E001(0) WITH 'RECORDS ARE NOT UPDATED'.
ENDIF.
WHEN 'DELETE'.
perform move_data.
DELETE ZCUST_CALL_REC FROM TABLE ITAB.
IF SY-SUBRC = 0.
MESSAGE I000(0) WITH 'RECORDS ARE DELETED'.
ELSE.
MESSAGE E001(0) WITH 'RECORDS ARE NOT DELETED'.
ENDIF.
endcase.
endmodule. " USER_COMMAND_9002 INPUT
*& Module STATUS_9002 OUTPUT
text
module STATUS_9002 output.
SET PF-STATUS 'ZCUSTOMER1'.
SET TITLEBAR 'xxx'.
endmodule. " STATUS_9002 OUTPUT
*& Module update_table OUTPUT
text
module update_table output.
move itab-MANDT to zcust_call_rec-MANDT.
move itab-kunnr to zcust_call_rec-kunnr.
move itab-budat to zcust_call_rec-budat.
move itab-code to zcust_call_rec-code.
move itab-remarks to zcust_call_rec-remarks.
vcontrol-lines = sy-dbcnt.
endmodule. " update_table OUTPUT
***Selection Data
FORM SELECT_DATA.
SELECT mandt kunnr budat code remarks FROM zcust_call_rec INTO
table itab
WHERE kunnr IN r_kunnr AND BUDAT IN R_BUDAT.
ENDFORM.
****append vendor code
FORM APPEND_CUSTOMER_CODE.
clear r_kunnr.
clear itab.
clear r_budat.
refresh r_kunnr.
refresh itab.
refresh r_kunnr.
IF r_kunnr IS INITIAL
AND NOT v_kun_low IS INITIAL
AND NOT v_kun_high IS INITIAL.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
input = v_kun_low
IMPORTING
OUTPUT = r_kunnr-low.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
input = v_kun_high
IMPORTING
OUTPUT = r_kunnr-high.
r_kunnr-option = 'BT'.
r_kunnr-sign = 'I'.
append r_kunnr.
PERFORM V_BUDAT.
ELSEIF r_kunnr IS INITIAL
AND NOT v_kun_low IS INITIAL
AND v_kun_high IS INITIAL.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
input = v_kun_low
IMPORTING
OUTPUT = r_kunnr-low.
r_kunnr-SIGN = 'I'.
r_kunnr-OPTION = 'EQ'.
APPEND r_kunnr.
PERFORM V_BUDAT.
ELSEIF r_kunnr IS INITIAL
AND v_kun_low IS INITIAL
AND NOT v_kun_high IS INITIAL.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
input = v_kun_low
IMPORTING
OUTPUT = r_kunnr-low.
r_kunnr-SIGN = 'I'.
r_kunnr-OPTION = 'EQ'.
APPEND r_kunnr.
PERFORM V_BUDAT.
ELSEIF r_kunnr IS INITIAL
AND v_kun_low IS INITIAL
AND v_kun_high IS INITIAL.
IF SY-SUBRC = 0.
MESSAGE I003(0) WITH 'ENTER CUSTOMER NUMBER'.
CALL SCREEN '9000'.
ENDIF.
PERFORM V_BUDAT.
ENDIF.
ENDFORM.
FORM V_BUDAT.
IF R_BUDAT IS INITIAL
AND NOT v_BUD_low IS INITIAL
AND NOT v_BUD_high IS INITIAL.
r_budat-low = v_bud_low.
r_budat-high = v_bud_high.
r_budat-option = 'BT'.
r_budat-sign = 'I'.
append r_budat.
ELSEIF R_BUDAT IS INITIAL
AND NOT v_BUD_low IS INITIAL
AND v_BUD_high IS INITIAL.
r_budat-low = v_bud_low.
r_budat-high = v_bud_high.
r_budat-option = 'EQ'.
r_budat-sign = 'I'.
append r_budat.
ELSEIF R_BUDAT IS INITIAL
AND v_BUD_low IS INITIAL
AND NOT v_BUD_high IS INITIAL.
r_budat-HIGH = v_bud_HIGH.
r_budat-option = 'EQ'.
r_budat-sign = 'I'.
append r_budat.
ELSEIF R_BUDAT IS INITIAL
AND v_BUD_low IS INITIAL
AND v_BUD_high IS INITIAL.
IF SY-SUBRC = 0.
MESSAGE I002(0) WITH 'ENTER POSTING DATE'.
CALL SCREEN '9000'.
r_budat-low = ''.
r_budat-option = ''.
r_budat-sign = ''.
ENDIF.
ENDIF.
ENDFORM.
*& Form update
text
--> p1 text
<-- p2 text
form update .
commit work.
endform. " update
*& Form move_data
text
--> p1 text
<-- p2 text
form move_data .
clear itab.
refresh itab.
move-corresponding zcust_call_rec to itab.
MOVE ZCUST_CALL_REC-MANDT TO ITAB-MANDT.
MOVE ZCUST_CALL_REC-KUNNR TO ITAB-KUNNR.
MOVE ZCUST_CALL_REC-BUDAT TO ITAB-BUDAT.
MOVE ZCUST_CALL_REC-CODE TO ITAB-CODE.
MOVE ZCUST_CALL_REC-REMARKS TO ITAB-REMARKS.
APPEND ITAB.
delete itab where kunnr is initial.
endform. " move_data
thanks in adv
vidya -
Hi,
We have a requirement to update a column value once the item has been approved.
Following settings have been made in the publishing articles list:
Require content approval for submitted items : yes
Create major and minor (draft) versions
Who should see draft items in this document library? :Only users who can edit items
Require documents to be checked out before they can be edited? : yes
I have createdatu a Sharepoint 2013 workflow to check if Approval sts of current item = 0 i.e. Approved , then check out and update the item and finally checkin the item. Everything works fine till this point except that the minor version of the item is
checked in. Due to this the updated columns are not published to others.
Also, I created a Sharepoint 2010 workflow to SET CONTENT APPROVAL = APPROVED and started this workflow from my list workflow above, but the item does not get checked-in and always shows "In Progress" status with comment "The item is currently
locked for editing. Waiting for item to be checked in or for the lock to be released.".
Please let me know where I am missing out so that once the item is approved, column value gets updated and current item is still in Approved status.
ThanksHi,
According to your post, my understanding is that you want to update Column value after current item is Approved and then publish major version using Sharepoint 2013 designer workflow.
You will get into this kind of Catch-22 situation trying to set the Content Approval Status in SharePoint Designer workflow:
- You must check out the document before you can change the Content Approval Status
- You can't change the Content Approval Status once the document in checked out
Since you set the Require documents to be checked out before they can be edited=Yes, you will need to check out the document when run the workflow on the item. But you cannot approve a document when it is checked
out. So the logic in workflow conflicts.
As a workaround, you can use the Start Another Workflow action to start the normal Approval workflow on the document. The built-in Approval workflow can work with a document that’s not checked out.
The designer approval workflow also can work with a document that’s not checked out.
You can create two workflow using SharePoint Designer 2013.
First, create a SharePoint 2010 platform workflow.
Then, create a SharePoint 2013 platform workflow.
Then when the SharePoint 2013 platform workflow start, it will start the SharePoint 2010 platform workflow to set content approval status, then the SharePoint 2013 platform workflow will update current item value.
More information:
SharePoint Designer Workflow Content Approval Issue
SharePoint 2010 Approval Workflow with Content Approval
Best Regards,
Linda Li
Linda Li
TechNet Community Support -
SOP: How to update ratio values
Hi everyone,
I have defined an Information Structure with some characteristics and ratios, all of them associated to some ZTable fields.
Well, I would be very grateful whether someone could tell how to update ratio values in my Information Structure. I mean I would like to know which are the steps I have to follow in order to update tha value of my ratios everytime its associated ZField changes its value.
I have the idea of using this Information Structure in a "Level-by-Level" planning type using Product Groups.
Thanks in advance and best regards.
Ben.Hi again,
Actually I have already created my planning type with some macro instructions and I have checked that they work properly in MC94. I have also created a planning hierarchy as you requested.
But my problem doesn't deal with this. The key figures that I have included in my structure represent values in SAP (i.e. Sold units, Security stocks...).
What I need to do is update the value of that key figures in my structure for all the combinations of my characteristics.
I hope my explanation is quite better this time.
Thanks. -
Get OLD&NEW value of an UPDATED column selected dynamically in a Trigger
Hi All,
I am writting a trigger which take column name dynamically. And on the basis of that column it should give me old value as well as updated value of a column corresponding to a modified row.
OOO_SCHEDULE is my table name;
Note: This is only for test so I am writting only for update not for insert and delete.
create or replace trigger "OOO_SCHEDULE_AUDIT"
BEFORE
insert or update or delete on "OOO_SCHEDULE"
for each row
begin
DECLARE
v_username varchar2(30);
AUDIT_EMP_ID varchar2(30);
AUDIT_EMP_ID_NEW varchar2(30);
v_Column_name VARCHAR(30);
v_stmt1 VARCHAR(40);
v_stmt2 VARCHAR(40);
CURSOR C1 is
select COLUMN_NAME from user_tab_columns where table_name='OOO_SCHEDULE';
BEGIN
OPEN c1;
LOOP
FETCH c1 into v_Column_name;
EXIT WHEN c1%NOTFOUND;
v_stmt1:=('OLD.'||v_Column_name);
v_stmt2:=('NEW.'||v_Column_name);
AUDIT_EMP_ID:=v_stmt1;
AUDIT_EMP_ID_NEW:=v_stmt2;
INSERT INTO TEMPTEST VALUES(v_stmt1);
INSERT INTO TEMPTEST VALUES(AUDIT_EMP_ID);
END LOOP;
CLOSE c1;
END;
end;
Suppose OOO_EMP_NAME is the column name where user made the change.
If i do like this..
AUDIT_EMP_ID:=OLD.OOO_EMP_NAME;
AUDIT_EMP_ID_NEW:=NEW.OOO_EMP_NAME;
Then it is working fine because I have given column name statically. But I want the column name to be selected dynamically and I am able to do it through cursor. Also I am able to fetch all column names in v_Column_name variable one by one dyanamically for the cursor.
But by executing these statements
AUDIT_EMP_ID:=v_stmt1;
AUDIT_EMP_ID_NEW:=v_stmt2;
I am getting OLD.OOO_EMP_NAME and NEW.OOO_EMP_NAME rather then old and new values of the updated column.
Please help me identifying the problem, where I am doing the mistake? What is the correct way to execute these statements? So that I can get old and new values of the column (updated column).
I have tried it by passing in a procedure also but don't know how to execute this dynamic statement to get the old and new values.
Thanks,
Ishrat.In the given link, column name has been selected statically. But i want that column name should be selected daynamically throgh loop and then check the
condition for any update corresponding to that column value. I don't want to write as many if condition as the no. of column name. I just want one if condition for all column namesDon't be lazy. Write all column names into your trigger. Or use a way to create the trigger "dynamically".
What is the problem that you have with static column names? "I don't want to write many..." is not a problem, but an opinion. -
SSRS - Expression to color column value dynamically in Matrix
Hi ,
I have a matrix which looks like :
The <<Expr>> value can be 1 /0 /"-" .
The Expr value is being calculated dynamically.
The data set query I am using has a column called due_days.
In the color expression of the <<Exp>> box I am using the expression as :
=IIf(Fields!Due_Days.Value>14 and Fields!Notes_Count.Value>0,"Blue",(Iif(Sum(Fields!Notes_Count.Value)=0 ,"Red","Black")))
My requirement is if the Due_Days column value is >14 then I need to highlight the value as blue else black and if value is 0 then red. When I use the above query it is just highlighting the color blue for 1st column only. Eg: 4th row . Due days for month
of Oct and Nov is > 14 but it shows blue only for month of oct.
How can i resolve the issue?In select query i have 5 columns:
Due days(Which is difference between 2 dates) ,
Notes count (Which is just a count of notes entered or not having value 0/1 and value '-' if another column CRD is greater than the matrix month and year.)Eg: below date 11/12/2014 is greater than Oct 2014 hence Oct 2014 should have "-"
Month Name , Year , Month Nbr (last 6 months which I cross joined with the table to get counts for each month)
The matrix has year and last 6 month as column groups
Color coding should be if notes count is 0 then red ,if notes count is 1 and due_days> 14 then blue else black . When i try to use expression for color as i mentioned above, it colors only 1st colum.eg: 2nd row
Nov 2014 is blue but for jan 2014 also it should show blue as due days>14 .
Is there any way i can do that ??
Eg: data set returns value as :
Due Days CRD Month
Month_Nbr Year Notes _Count
5 2014-11-28 00:00:00.000 December 12 2014
0
5 2014-11-28 00:00:00.000 February 2 2015
0
5 2014-11-28 00:00:00.000 January 1 2015
0
5 2014-11-28 00:00:00.000 November 11 2014 1
5 2014-11-28 00:00:00.000 October 10 2014 0
5 2014-11-28 00:00:00.000 September 9 2014 0
Matrix is of the form :
YEAR
MONTH
CRD Notes_count -
How to set column value dependend on other column value?
I have a view that selects values from 2 tables with some simple additional joins. Now, i would like to add a column (boolean/bit or varchar2) that represents a flag and is dependen on the value of another column, e.g.
ID | Value | Flag
1 | 4711 | 1
2 | null | 0
So, the flag should be set to 1 if column 'Value' is not null and to 0 if column 'Value' is null. (In another case, i would like to test for specific values, not just null). How can i do this in ORACEL SQL?This statement will update two flag columns. FLAG1 is set to one or zero depending on whether COL1 is null. FLAG2 is set to one of a range of values depending on whether COL1 is a specific value; the default value is ZERO.
UPDATE your_table
SET flag1 = nvl2(col1, 1, 0)
, flag2 = decode(col1, 5677, 1, 2212, 2, 6276, 3, null, 4, 0)
/Cheers, APC -
How To Concatenate Column Values from Multiple Rows into a Single Column?
How do I create a SQL query that will concatenate column values from multiple rows into a single column?
Last First Code
Lesand Danny 1
Lesand Danny 2
Lesand Danny 3
Benedi Eric 7
Benedi Eric 14
Result should look like:
Last First Codes
Lesand Danny 1,2,3
Benedi Eric 7,14
Thanks,
David JohnsonStarting with Oracle 9i
select last, first, substr(max(sys_connect_by_path(code,',')),2) codes
from
(select last, first, code, row_number() over(partition by last, first order by code) rn
from a)
connect by last = prior last and first = prior first and prior rn = rn -1
start with rn = 1
group by last, first
LAST FIRST CODES
Lesand Danny 1,2,3
Benedi Eric 7,14Regards
Dmytro -
How to insert column values into database as rows
Hi,
I have 8 columns and some not null columns. Based on not null columns I want to insert into table as rows. The 8 columns may contain values or no value. If the first column contains data, then I have to insert into one row. if the second column contains data I have to insert a row and in second column. respectively...So How can I insert column values into rows. Can I write 8 insert statements. (OR) is it possible to insert data from columns using where clause.
Please help me out....
Thanks in AdvanceLines Table:
line_id, orcl_bank_account_num, product_type, service_type, lease_type,
funding_type, cpi, billing_frequency_unit_cd , annual_due_date ,
pricing_start_date, pricing_end_date, install_date, contract_end_date ,
prdct_replacement_cost_amt, cradle_replacement_amt, supranet_contract,
issuance_fee, board_inactive_date, header_id, creation_date, last_modified_date,
created_by_nam, modified_by_nam, activeinactive_flg, prdct_bill_amt_yr1,
prdct_bill_amt_yr2, prdct_bill_amt_yr3, prdct_bill_amt_yr4, prdct_bill_amt_yr5,
prdct_bill_amt_yr6, prdct_bill_amt_yr7, prdct_bill_amt_yr8, activation_fee_yr1,
activation_fee_yr2, activation_fee_yr3, activation_fee_yr4, activation_fee_yr5,
activation_fee_yr6, activation_fee_yr7, activation_fee_yr8,
In this table the columns structure is :
-- PRDCT_BILL_AMT_YR (1 to 8) NUMBER(14,4)
-- ACTIVATION_FEE_YR (1 to 8) NUMBER(8,2)
I have one more table:
PRDCT_INS_AMT NUMBER(14,4)
ACTIVATION_FEE_AMT NUMBER(14,4)
I want to insert prdct_bill_amt_yr (1 to 8) columns data into PRDCT_INS_AMT column. similarly activation_fee (1 to 8) columns data.
But the data should be inserted based product_type, service_type, lease_type columns values. (These 3 columns may contain upto 45 combinations). -
How to get column value from DB grid
Hi!
I wander how to get col value from GridControl?
My app consists of one rowsetinfo with two
columns CODE and DESCRIPTION and a jbutton
titled SELECT. When user clicks SELECT button
the app should show the value of the CODE col
of the selected row in GridControl.
I wander how to make this action ?
XxpsTransTimesMasterIter.setAttributeInfo( new AttributeInfo[] {
CODEXxpsTransTimesMasterIter,
DESCRIPTIONXxpsTransTimesMasterIter} );
XxpsTransTimesMasterIter.setName("XxpsTransTimes");
XxpsTransTimesMasterIter.setQueryInfo(new QueryInfo(
"XxpsTransTimesMasterIterViewUsage",
"lov.XxpsTransTimes",
"CODE, DESCRIPTION",
"XXPS_TRANS_TIMES",
null,
null
));Hi,
You could attach an ActionListener on the JButton, and try the following code :
NavigationManager fm = NavigationManager.getNavigationManager();
DataItem dataItem = fm.getFocusedControl().getDataItem();
ImmediateAccess col_code = null;
String code = null;
if (dataItem != null && dataItem instanceof RowsetAccess) {
RowsetAccess rowset = (RowsetAccess)dataItem;
try {
col_code = (ImmediateAccess) rowset.getColumnItem("CODE");
code = col_code.getValueAsString();
} catch (DuplicateColumnException de) {
return;
} catch (ColumnNotFoundException ce) {
return;
} catch (SQLException se) {
return;
JTextField tf = new JtextField();
tf.setText(code);
I haven't tested this code.
I am curious to know, the Object type of the dataItem.If it doesnot happen to be RowsetAccess ..try.. ScrollableRowsetAccess OR ImmediateAccess.
Your code would change accordingly, depending on the instance.Refer to the product documentation for this.
Do let me know, if this works.
TIA
Sandeep -
Custom row-fetch and how to get column values from specific row of report
Hi -- I have a case where a table's primary key has more than 3 columns. My report on the
table has links that send the user to a single-row DML form, but of course the automatic
fetch won't work because 1) I can't set more than 3 item values in the link and 2) the
auto fetch only handles 2 PK columns.
1)
I have written a custom fetch (not sure it's the most elegant, see second question) that is working
for 3 or few PK columns (it references the 1-3 item values set in the link), but when there are
more than 3, I don't know how to get the remaining PK column values for the specific row that was
selected in the report. How can I access that row's report column values? I'll be doing it from the
form page, not the report page. (I think... unless you have another suggestion.)
2)
My custom fetch... I just worked something out on my own, having no idea how this is typically
done. For each dependent item (database column) in the form, I have a source of PL/SQL
function that queries the table for the column in question, using the primary key values. It works
beautifully, though is just a touch slow on my prototype table, which has 21 columns. Is there
a way to manually construct the fetch statement once for the whole form, and have APEX be smart
about what items get what
return values, so that I don't have to write PL/SQL for every item? Because my query data sources
are sometimes in remote databases, I have to write manual fetch and dml anyway. Just would like
to streamline the process.
Thanks,
CarolHI Andy -- Well, I'd love it if this worked, but I'm unsure how to implement it.
It seems I can't put this process in the results page (the page w/ the link, that has multiple report rows), because the link for the row will completely bypass any after-submit processes, won't it? I've tried this in other conditions; I thought the link went directly to the linked-to page.
And, from the test of your suggestion that I've tried, it's not working in the form that allows a single row edit. I tried putting this manually-created fetch into a before header process, and it seems to do nothing (even with a hard-coded PK value, just to test it out). In addition, I'm not sure how, from this page, the process could identify the correct PK values from the report page, unless it can know something about the row that was selected by clicking on the link. It could work if all the PK columns in my edit form could be set by the report link, but sometimes I have up to 5 pk columns.
Maybe part of the problem is something to do with the source type I have for each of the form items. With my first manual fetch process, they were all pl/sql functions. Not sure what would be appropriate if I can somehow do this with a single (page level?) process.
Maybe I'm making this too hard?
Thanks,
Carol -
How to get column value of a selected row of ALV
Hello ,
I have application POWL POWL_UI_COMP uses another component POWL_TABLE_COMP.
This POWL_TABLE_COMP uses SALV_WD_TABLE.
I want to select value of ORDER id and it need to be passed whenever user selects a display order button(Which is self defined function generated in POWL_TABLE_COMP) . I am calling a display order on action of this display button(http://nap60.nalco.one.net:8042/sap/bc/webdynpro/sap/mt_order_app?IV_ACTIVITYTYPE=A&IV_EQUIPMENT=aaaa&IV_ORDERID=90001511&IV_ORDERTYPE=STD&IV_QMNUM=00&IV_TPLNR=00)
ORDERID is one column value of selected row of ALV table.
So please can you suggest , how to read ORDERID and pass it to the self defined function..
thanks in advance,
SharadaAnoop,
I have plcaed this code in event handler of on_lead_select.
Its giving error the element doesnt exist.
static_attributes should give me row data but it's giving short dump saying
Pl can you suggest.
data: set_of_element type WDR_CONTEXT_ELEMENT_SET,
element1 type ref to IF_WD_CONTEXT_ELEMENT,
result type POWL_CRESULT_STY,
table_helper type ref to CL_POWL_TABLE_HELPER,
context_node type ref to IF_WD_CONTEXT_NODE,
lt_selected_elements TYPE wdr_context_element_set,
static_attributes type ref to data.
table_helper = wd_comp_controller->mr_table_helper.
context_node = table_helper->get_data_node( ).
context_node = wd_comp_controller->mr_table_helper->get_data_node( ).
context_node->get_static_attributes( exporting index = r_param->index
importing static_attributes = static_attributes ).
thanks,
Sharada
Maybe you are looking for
-
Time out error while running the FR report on Workspace
Hi, We are working on Hyperion system 9.3.1 financial reporting with Essbase as a data source. We have built a report, which has many computation, conditional formatting, suppression condtion.Report has around 100 columns. Now when we are try to open
-
Update from 10.6.3 to 10.6.8
I recently updated to snow leopard 10.6.3, but everytime I try to update to 10.6.8 it gets 3/4 of the way through and then it freezes up. I've tried multiple times with no success. I've also tried downloading the file from the internet as opposed to
-
Rented 2 movies, watched one, second one kept downloading for 3 days and finally failed. I was charged for it, it never downloaded, cannot be found in "Available Downloads". When you go to "Report a problem" next to the item (Great Gatsby) on the ema
-
Help on FM LDB_PROCESS for LDB FTI_TR_PL_CF
Hi everyone, Good day! I am currently working on INFOSETS for Treasury Module and there's a requirement to use function module LDB_PROCESS for logical database FTI_TR_PL_CF. I have not worked on the said function module before and i am not familiar
-
How do you reference the main timeline of swf1 from swf2 when swf2 is loaded into swf1?
on this link http://kb2.adobe.com/community/publishing/918/cpsid_91887.html I found this script, but I can not use it can anyone help me // create a variable to reference swf1's main timeline var swf1Main_mc:MovieClip; // this assumes that