Previous value in the VO
Hi,
Is there anyway that i can track the changed value in the VO and the previous value?? I am not using EO in my programme.
Thanks
Thanks Prasanna, Its the right way. But one quick question before i mark this question as correct and close it. I was wondering if we have some method which we can use from CO to do the same because
i am not using VO to update the details into the table. I have a procedure in AM which inturn calls a pl/sql procedure. In this case, can i still follow the method you suggested??
Thanks once again.
Similar Messages
-
Compare previous value in the table
Hi:
I want to compare the previous value in the Acute Amt# with the current record and pass previous value to the Return Value column based on they are eqaul or not. Can you please help me how to get this ?
Here is the sample data.
REN# End# Acute Amt# Return Value
1 0 1583 1583
2 0 1587 1587
2 1 1572 1572
3 0 1572 Null
3 1 1572 Null
4 0 1572 Null
4 1 1572 Nullhttp://download.oracle.com/docs/cd/B13789_01/appdev.101/b10795/adfns_fl.htm
Would this feature help with your problem? Depending on the version of your database.
"This example uses a Flashback Query to examine the state of a table at a previous time............." -
Compare the current value with the previous value in the same column
Hi all,
I have to include a statement in a query which allows to compare the current value of column A with the previous value of column A (same column). from there, I need to add a condition in order to have the expected result.
Let's take an example to illustrate what I want to achieve:
I have the following columns in table called 'Charges':
Ship_id batch_nr Order_nr Price
SID1111 9997 MD5551 50
SID1111 9998 MD5552 50
SID1111 9999 MD5553 50
SID2222 8887 MD6661 80
SID2222 8887 MD6662 80
SID2222 8887 MD6662 80
SID3333 6666 MD7771 90
I want to check if the ship_id of row 2,3 (and more if available) is equal to the ship_id of row 1.
If it is the case, then value 'together with the first batch_nr' in row 2 and 3 under Price column. If not, then keep the original value of Price column
PLease see below the expected result:
Ship_id batch_nr Order_nr Price
SID1111 9997 MD5551 50
SID1111 9998 MD5552 together with 9997
SID1111 9999 MD5553 together with 9997
SID2222 8887 MD6661 80
SID2222 8887 MD6662 together with 8887
SID2222 8887 MD6663 together with 8887
SID3333 6666 MD7771 90
Thanks in advance for your help, it is really urgent.
Imco20030Hi,
user11961002 wrote:
Hi,
Here is the query that I use:
[ select
sl.ship_id,
o.ordnum,
o.reffld_5 "BatchNR",
sum(tc1.chrg_amt) "FreightPRC",
sum(tc2.chrg_amt) "FuelPRC",
sum (tc1.chrg_amt + tc2.chrg_amt + tc3.chrg_amt) "Total Price"
from ord_line ol
join ord o on (ol.ordnum = o.ordnum and ol.client_id = o.client_id)
join shipment_line sl on (ol.ordnum = sl.ordnum and ol.client_id = sl.client_id and ol.ordlin = sl.ordlin)
join adrmst a2 on (o.rt_adr_id = a2.adr_id)
left join tm_chrg tc1 on (tc1.chargetype = 'FREIGHT' and tc1.chrg_role = 'PRICE' and tc1.ship_id = sl.ship_id)
left join tm_chrg tc2 on (tc2.chargetype = 'FUELSURCHARGE'and tc2.chrg_role = 'PRICE' and tc2.ship_id = sl.ship_id)
where sl.ship_id = 'SID0132408'
group by o.client_id, o.ordnum, o.reffld_2, sl.ship_id, a2.adrnam, a2.adrln1, a2.adrpsz, a2.adrcty, a2.ctry_name,
o.reffld_5, ol.early_shpdte
order by ship_id
]That looks like the query you were using before you started this thread.
Modify it, using the analytic fucntions FIRST_VALUE and LAG, like I showed you.
I see that you did simplify the problem quite a bit, and it's good that you did that.
It doesn't matter that your real problem involves joins or GROUP BY. Analytic functions are calculated on the results after all joins and GROUPS BYs are done. Just substitute your real expressions for the simplified ones.
For example, in your simplified problem, there was a column called order_nr, but I see now that's it's really called o.ordnum. Where the solution I posted earlier says "ORDER BY order_nr", you should say "ORDER BY o.ordnum".
Here's a less obvious example: in your simplifed problem, there was a column called price, but I see now that it's really SUM (tc1.chrg_amt + tc2.chrg_amt + tc3.chrg_amt). Where the solution I posted earlier says "TO_CHAR (price)", you should say "TO_CHAR (SUM (tc1.chrg_amt + tc2.chrg_amt + tc3.chrg_amt))". (You can't use an alias, like "Total Price", in the same SELECT clasue where it is defined.)
I removed some columns from the select as they are not relevant for the wanted action like 'adress details or other references'.
Now here is the result:
Shipment ID Order Number WMS Batch Freight Fuel Price Order Total Price
SID0132408 MDK-000014-05602649 04641401 110 10 120
SID0132408 MDK-000014-05602651 04641402 110 10 120
SID0132408 MDK-000014-05602652 04641363 110 10 120
as you can see, the 3 orders have the same shipment ID.
The expected result should be shown under column 'Total Price' as follows:
Shipment ID Order Number WMS Batch Freight Fuel Price Order Total Price
SID0132408 MDK-000014-05602649 04641401 110 10 120
SID0132408 MDK-000014-05602651 04641402 110 10 tog with 04641401
SID0132408 MDK-000014-05602652 04641363 110 10 tog with 04641401Okay, so those are the correct results that I asked for, plus the incorrect results you're getting now. Thanks; extra information doesn't hurt.
But where is the raw data that you're starting with?
It looks like you tried to format the code (but not the results) by typing this 1 character:
before the formatted section and this different character
after the formatted section. To post formatted text on this site, type these 6 characters
before the formatted section, and the exact same 6 characters again after the formatted section. -
How to get warning by using the previous value of the column and new value
Hi all,
Suppose the column A has the true and when I click on button which also sets the value of the column as true I should dispaly warning that column a is already true.How can I achieve this.How to store the original value of the column and then check wirth the new value.
Thanks in advance.You dont have to store the value anywhere
You can do this from setMethod of EOImpl.java
eg:
void setAttributeXXX(String Value)
// value contains new value
// getAttributeXXX() contains oldValue
if (value.equals(getAttributeXXX()))
// Verify value is > 0 if (value.compareTo(0) <= 0)
throw new OAAttrValException(OAException.TYP_ENTITY_OBJECT, // indicates EO source
getEntityDef().getFullName(), // entity name
getPrimaryKey(), // entity primary key
"AttributeXXX", // attribute Name
value, // bad attribute value
"AK", // nessage application short name
"FWK_TBX_T_EMP_SALARY_REQUIRED"); // message name
setAttributeInternal(AttributeXXX, value);
--Prasanna -
I am implementing a minimal Calculation Chain restricted to the current row. When the user types some new
value in a cell (part of a column named "Length"), some sections of the row are re-calculated.
See my handler code:
The problem is that the value found in gridModel.Length is the old one, while I need the one just typed by the user.
TIAThat is because the CellEditingEnded event is raised before the a cell edit is committed so the new value is not yet available:
https://msdn.microsoft.com/en-us/library/system.windows.controls.datagrid.celleditending%28v=vs.110%29.aspx?f=255&MSPPError=-2147217396
You better handle this kind of logic in the setter of the *Length properties in the GridModel class:
private string _SomeLength;
public string SomeLength {
get {
return _SomeLength;
set {
_SomeLength = value;
recalculateLengthDependingCells();
private void Validate() {
//validation logic...
Please remember to close your threads by marking helpful as answer and then start a new thread if you have a new question. -
Create a new column in a table that compares the value of one column with its previous value
The DDL:
DECLARE
@T TABLE
IDNO
int,
name
varchar(40),
[Date]
datetime2,
Price1
float,
Price2
float
DECLARE
@K TABLE
IDNO
int,
name
varchar(40),
[Date]
datetime2,
Price1
float,
Price2
float
INSERT
INTO @T
VALUES(22,'C_V_Harris','2014-01-02 10:23:49.0000000',
23.335,
23.347)
INSERT
INTO @T
VALUES(21,'C_V_Harris','2014-01-02 10:05:13.0000000',
23.357,
23.369)
INSERT
INTO @T
VALUES(20,'C_V_Harris','2014-01-02 09:56:15.0000000',
23.364,
23.377)
INSERT
INTO @T
VALUES(19,'C_V_Harris','2014-01-02 09:45:26.0000000',
23.351,
23.367)
INSERT
INTO @T
VALUES(18,'C_V_Harris','2014-01-02 09:43:20.0000000',
23.380,
23.396)
INSERT
INTO @T
VALUES(17,'C_V_Harris','2014-01-02 09:34:28.0000000',
23.455,
23.468)
INSERT
INTO @T
VALUES(16,'C_V_Harris','2014-01-02 09:30:37.0000000',
23.474,
23.486)
INSERT
INTO @T
VALUES(15,'C_V_Harris','2014-01-02 09:18:12.0000000',
23.419,
23.431)
INSERT
INTO @T
VALUES(14,'C_V_Harris','2014-01-02 09:16:06.0000000',
23.360,
23.374)
INSERT
INTO @K
SELECT
ROW_NUMBER()
OVER (ORDER
by IDNO)
AS RN,*
FROM
@T
SELECT
* FROM
@K
--not working:
SELECT
a.RN,a.Price2
FROM
@K a
INNER
JOIN @K
b
ON
a.RN=b.RN-1
WHERE
a.Price2>b.Price2
I need to create a view with a column (say 'Comp' below) that compares the value of each row in Price2 with the previous Price2 row, and it is greater then +1, the
same 0, and less -1.
The processed table should be:
IDNO
name
Date
Price1
Price2
Comp
22
C_V_Harris
1/2/2014 10:23:49
23.335
23.347
0
21
C_V_Harris
1/2/2014 10:05:13
23.357
23.369
1
20
C_V_Harris
1/2/2014 9:56:15
23.364
23.377
1
19
C_V_Harris
1/2/2014 9:45:26
23.351
23.367
-1
18
C_V_Harris
1/2/2014 9:43:20
23.38
23.396
1
17
C_V_Harris
1/2/2014 9:34:28
23.455
23.468
1
16
C_V_Harris
1/2/2014 9:30:37
23.474
23.486
1
15
C_V_Harris
1/2/2014 9:18:12
23.419
23.431
-1
14
C_V_Harris
1/2/2014 9:16:06
23.36
23.374
-1
How can I structure the statement to get (the most recent - order by date ) result for Comp?Satheesh Variath, I just had to make some corrections from your script to get the correct answer:
CREATE
VIEW vw_Comp
AS
SELECT
TOP 1 t.IDNO,t.name,t.[Date],t.Price1,t.Price2,
CASE
WHEN t.Price2
> LAG(Price2,1)
OVER (PARTITION
BY name
ORDER BY IDNO)
THEN 1
WHEN t.Price2
< LAG(Price2,1)
OVER (PARTITION
BY name
ORDER BY IDNo)
THEN -1
ELSE 0
END
AS Comp
FROM
@T t
ORDER
BY DATE
DESC
The adjustments: the selection of the most recent comparison (Top 1) and the use of the function LAG (instead of LEAD) to get the previous value of the column. -
How to get the previous value of Potential Revenue, as Number
PRE('<Revenue>') will return the previous value of the Potential Revenue (in Opportunity object), as a string.
However, i need to manipulate the returned value as number in order to evaluate if the previous value is less a certain amount.
PRE('<Revenue>')*.3204<50000
The expression about, is meant to convernt the value to a different currency, and evaluate if its less than 50000.
Is there any way I can be able to achive this?
appreciate you response! :)
Edited by: mack on Apr 15, 2012 1:31 AManswered.
-
Previous Values of Selected Items in a Datagrid
I have a datagrid which the dataprovider is bound to an ArrayCollection of Value Objects from a web service.
One other thing which is important to point out. The Value Objects are created automatically for the Data/Service and so if I change the files, they will just be overwritten the next time I make a change to the service.
The grid displays Inventory Items. Lets say that Item 1 has a qty of 20. Item 5 has a Qty of 10.
The list in this grid is based upon the selection of a Location tree. So it lists the inventory items for a certain location.
I also have a second tree and grid for the to location inventory items.
Between the two grids, there is a button which when clicked it iterates thru the selected items and creates a new item in the to list with qty 1 and saves it. then decreases the current qty in the from list by one.
So lets say I selected items 1 and 5 and then clicked the button. A new copy of Items 1 and 5 are created in the to list with a qty of 1 and then saved. Then the qty in the from list is decreased by 1 and saved and so the vales for 1 is now 19 and for 5 is 9.
I would like to be able to change the qty in the from list to the qty I want to move. So when the button is clicked the new item in the to list reflects the new qty and is saved. Then the previous value of the current qty is decreased by the qty which is displayed in the grid
So lets say I changed item 1 to 2 and Item 5 to 3 and then selected items 1 and 5 and then clicked the button. A new copy of Items 1 and 5 are created in the to list with a qty of 2 for item 1 and 3 for item 5 and then saved. Then the qty in the from list is decreased for Item 1 by 2 and item 5 by 3 and so now Item 1s qty is now 18 and items 5 qty is now 7.
My first thought was if I had the previous values stored then no big deal. But I put a break point at the point where the SelectedItems list is being iterated through and the previous values are not stored anywhere.
Any suggestions for this?...in the mean time, this should be enough
win.pnl.list1.onChange = function() {
alert(this.selection.index); // for this to work set, multiselect:false
I guess you already tried and the result is "undefined", the reason is you have this property
multiselect:true
in that case, selection returns an array,
this.selection[0].index;
would give you the first selected item, even if you only have one item selected, to get all selected items loop thru all items in the selection array.
not sure if Peter's wonderful guide explains this (it is explained in the Tools Guide), but you should read it too, it has tons of great info. -
PPR event getting previous value
Hi
There is a PPR event on a standard text box. I am handling PPR event in my custom CO. Whenever I change the value abd tab out of the text box I get the previous value not the current(changed) value.
ExpenseReportLinesVORowImpl expensereportlinesvorowimpl = (ExpenseReportLinesVORowImpl)expensereportlinesvoimpl.getCurrentRow();
please help
ThanksHi,
Here are three different ideas:
(1) Copy the current row into a local RECORD variable inside the loop.
(2) Do a self-join in the query, so that the cursor itself has the previous and current rows. (If necessary, use the analytic ROW_NUMBER function to number the rows so you can do the self-join correctly.)
(3) Use the analytic LAG function to copy the necesssary columns from the previous row in the query. -
JTable get Old Value in the Listener of change Value
Software
JDK 1.5 Update 6
Requirements
I have a JTable I want to show the sum total of certain Cell Value.So I have added a TableModelListener by which on updating the cell Value I change the total in the JTextField. The Problem is If I change the value then I have to get the previous value that the cell had. How to get that original value before the update.
There is a way by which we can get the same by inserting one dummy column which stores previous value.But this method inserts unneccessary if you require the total of 3 columns and if you require the same thing again and again in different frames
Is There any way by which we can show the total
Thanks in advance
CSJakhariaCan I maintain a sum of a column in a JTextField such that I change the sum as soon as any value in that column is changed without recalculating the totalYes, now I understand the question you just want to update the total with the difference between the old value and the new value.
I don't see why you are going to all this trouble. Why complicate your program, just loop though all the values in each column and add them together. You will not have a performance problem. Here is a similiar example of this approach:
http://forum.java.sun.com/thread.jspa?forumID=57&threadID=566133
However, if you still don't like that solution then you can try overriding the getCellEditor(...) or prepareEditor(...) methods of JTable. These methods should be invoked when you start editing the cell and you could query the TableModel and save the current value. -
Hi there,
I have two columns, let's call them Event Date (Column A) and Previous Event Date (Column B).
I would like to implement some <acronym title="visual basic for applications">VBA</acronym> code (or use formulas if necessary) that automatically keeps the previous value of Event Date and retains it in the adjacent cell for Previous
Event Date.
For example, if A3 = Jan-03 and I update A3 to Jan-04, B3 would then show Jan-03 as it is the previous value of the cell.
I would like this code to work for a whole column of cells, not just a single cell.
I'm open to any & all ideas and appreciate the help. If any clarifications are necessary, just let me know.Right-click the sheet tab.
Select View Code from the context menu.
Copy the following code into the worksheet module:
Private Sub Worksheet_Change(ByVal Target As Range)
Dim newVal As Variant
' Code won't work if multiple cells have been changed
If Target.Count > 1 Then
Exit Sub
End If
' Only act if cell in column A has been changed
If Intersect(Range("A:A"), Target) Is Nothing Then
Exit Sub
End If
' Turn off events and screen updating
Application.EnableEvents = False
Application.ScreenUpdating = False
' Get new value
newVal = Target.Value
' Undo to restore old value
Application.Undo
' Copy old value to adjacent cell
Target.Offset(0, 1).Value = Target.Value
' Redo the change
Target.Value = newVal
' Turn on screen updating and events
Application.ScreenUpdating = True
Application.EnableEvents = True
End Sub
Remarks:
If you change multiple cells at once, the code won't do anything.
When you change a cell in column A, that cell will remain the active cell, i.e. Tab or Enter won't activate another cell.
When you change a cell in column A, Undo will be disabled.
Regards, Hans Vogelaar (http://www.eileenslounge.com) -
Compare current value with previous value
Hello,
I would like to compare the current value with the previous value of the current value.
How can I solve this problem?
MauritsHi,
after going through the basics course you surely can understand that example:
Best regards,
GerdW
CLAD, using 2009SP1 + LV2011SP1 + LV2014SP1 on WinXP+Win7+cRIO
Kudos are welcome -
Compare previous value and new value on Campaign Save
Hi All,
I create a campaign. I need some exit ( badi etc.) which is called before saving the campaign and after saving the campaign. My main intention is to compare the previous value and the new value.
Thanks in advance,
RavirajYes, you would have to write code that specifically compared each column. And update that code when the column list changed. Of course, you could always write code that generated your triggers for you based on the column definitions.
On the other hand, I would tend to suggest that if you need an audit history, you want to store the whole row. Otherwise, the queries necessary to parse your audit table get to be hideously complicated and people spend a lot of time trying to reconstruct the state of a row at a particular point in time, often introducing errors.
If you need an audit history, I would also tend to look into Oracle's auditing features or something like Workspace Manager that automatically tracks a version history for rows. Both of those are built into the database, which tends to make them a lot easier to deal with than a custom trigger solution.
Justin -
TSQL Get Previous values for each group by
Dear Friends,
I have a problem with my TSQL statment.
I need to get previous value for each day and specific unit. Everything goes fine if I have always 2 unit in each day. But if same day has just one unit or less, I cannot have the previous value in the current record.
The Output is this one:
SK_DAY SK_UNIT
VALUE VALUE_PREVIUS_DAY
20131112 2
30.00 NULL
20131112 3
34.00 NULL
20131113 2
40.00 30.00
20131113 3
45.00 34.00
20131114 2
50.00 40.00
I dont have the second record for 2013-11-14, because in this date I just have value for unit 2.
The final output should include the record:
20131114 3
0 45.00
The Statment I have is:
SELECT MAIN.SK_DAY, MAIN.SK_UNIT, SUM(MAIN.VALUE) AS VALUE
SELECT SUM(VND1.VALUE) AS VALUE
FROM FCT_TEST VND1
WHERE CONVERT(DATE,CONVERT(VARCHAR(10),VND1.SK_DAY))>=DATEADD(dd,-1,CONVERT(DATE,CONVERT(VARCHAR(10),MAIN.SK_DAY)))
AND CONVERT(DATE,CONVERT(VARCHAR(10),VND1.SK_DAY))<CONVERT(DATE,CONVERT(VARCHAR(10),MAIN.SK_DAY))
AND VND1.SK_UNIT=MAIN.SK_UNIT
) AS VALUE_PREVIUS_DAY
FROM FCT_TEST MAIN
GROUP BY SK_DAY, MAIN.SK_UNIT
SQL CREATE SCRIPT:
CREATE TABLE [dbo].[FCT_TEST](
[SK_DAY] [int] NOT NULL,
[SK_UNIT] [int] NOT NULL,
[VALUE] [decimal](18, 2) NULL,
CONSTRAINT [PK_FCT_TEST] PRIMARY KEY CLUSTERED
[SK_DAY] ASC,
[SK_UNIT] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
Thank you!!!
PPSQLThank you Kalman,
But my problem is not with date! Fortunately I have dates for all days.
The problem is for dimension tables like UNITS that I dont have values for all days, and when I try to get the previous value for previous day and each unit I dont have records.
20131112
2
30.00
NULL
20131112
3
34.00
NULL
20131113
2
40.00
30.00
20131113
3
45.00
34.00
20131114
2
50.00
40.00
20131114
3
0
45.00 [I NEED THIS RECORD AS IS]
Could you help me??
Thank you!! -
How to get a value from the previous element (XSLT/XPATH gurus ahoy!)
Hi All,
I am building an RTF template for a "letter of reference"-report. Sometimes there are several rows in the data, that need to be printed as one. This is due to consecutive temporary contracts, which will be printed out as one period of service.
Here's a simplified data example to illustrate the problem.
<ROW>
<START_DATE>01-01-1980</START_DATE>
<END_DATE>01-01-1988</END_DATE>
</ROW>
<ROW>
<START_DATE>01-01-1988</START_DATE>
<END_DATE>01-01-1990</END_DATE>
</ROW>
<ROW>
<START_DATE>01-01-2000</START_DATE>
<END_DATE>01-01-2005</END_DATE>
</ROW>
With the data above, I should print two lines:
01-01-1980 - 01-01-1990
01-01-2000 - 01-01-2005
I need to compare START_DATE of an element (except for the first one) with the END_DATE of the previous element, to find out whether to print the END_DATE for that element or not. How can I get that value from the previous element?
Thanks & Regards, Matildause this to get the following End_date
<?following-sibling::../END_DATE?>
Try this
<?for-each:/ROOT/ROW?>
==================
Current StartDate <?START_DATE?>
Current End Date <?END_DATE?>
Next Start Date <?following-sibling::ROW/END_DATE?>
Previous End Date <?preceding-sibling::ROW[1]/END_DATE?>
================
<?end for-each?>
o/p
==================
Current StartDate 01-01-1980
Current End Date 01-01-1988
Next Start Date 01-01-1990
Previous End Date
================
==================
Current StartDate 01-01-1988
Current End Date 01-01-1990
Next Start Date 01-01-2005
Previous End Date 01-01-1988
================
==================
Current StartDate 01-01-2000
Current End Date 01-01-2005
Next Start Date
Previous End Date 01
Maybe you are looking for
-
How to print at the bottom for an ALV report ?
Hi , I need to print footer information at bottom line of the ALV grid report. (using REUSE*GRID_DISPLAY) and how to get comments(120 chars) in header of the same ALV grid report? it is accepting only 60 chars. Please provide me the code here? Thanks
-
Last receipt date of materials vendor wise
Dear All, Plz suggest is there any standard report available which gives us the last date of receipt,material wise and vendor wise. Rgds
-
EWA Configuration in Solution Manager 7.1 in SP08
Hi All, Could any one please advice on the Changes that has been taken place for EWA configuration in Solution Manager 7.1. Warm Regards, Sudhakar G
-
Exporting in 6.0.1
Just upgraded to 6.0.1 and now I can't export. When I select an image and click export...it doesn't even bring up the export window anymore. Any ideas? Anyone else having the same problem?
-
IPhoto automatically flags all photos in Library
I feel like I am going crazy. I am using photo-flagging in iPhoto as a way of creating long-lists and short-lists as albums. Should work fine, although people may have a better way to do this. However what's really frustrating is that once I have c