Comparing first row and second row
I have a table which has data like this
Order_id Border_id Start_Dat End_Dat Status
ORDER_1 BORDER_2 04/05/06 05/19/06 R
ORDER_2 BORDER_2 05/19/06 05/20/06 I
ORDER_3 BORDER_3 04/03/06 05/20/06 R
ORDER_4 BORDER_3 05/20/06 06/21/06 I
ORDER_5 BORDER_4 02/05/06 05/06/06 R
ORDER_6 BORDER_4 05/05/06 07/06/06 I
ORDER_7 BORDER_5 10/22/02 02/23/03 R
ORDER_8 BORDER_5 02/23/03 03/04/06 I
ORDER_9 BORDER_6 03/12/06 09/26/06 R
ORDER_10 BORDER_6 09/26/06 11/02/06 I
I want to compare whether the End Date of the first row is equal to the start date of the second row where Borderid are the same
Please help me with code for this
Use Analytical functions
select Start_Dat, lag(end_dat,1) OVER(partition by border_id order by order_id) prev_end_date
FROM TABLEA;
Similar Messages
-
First thing and second...
Hello,
I got the Oracle for Linux but what is the extendtion
*.tgz [not *.tar.gz right] ?
Anyone have problem with Oracle on RedHat 6.0 and prefert others
like Slackware [3.5 maybe]?
Please help me about your opinion,
thanks much
Kam
nullKam (guest) wrote:
: Hello,
: I got the Oracle for Linux but what is the extendtion
: *.tgz [not *.tar.gz right] ?
: Anyone have problem with Oracle on RedHat 6.0 and prefert
others
: like Slackware [3.5 maybe]?
: Please help me about your opinion,
: thanks much
: Kam
Your question shows that you're not only new with Oracle
but also new with Unix. My advice is to find someone more
experienced to do it or be prepared for the baptism by fire.
To answer your question, yes, ".tgz" is the same as ".tar.gz".
I don't want to be condescending or even offensive, but
installing Oracle8i on Linux at the present state of the
8i distribution is certainly not the task for a beginner. If
you really, really want it, at least start with the standard
distribution, not the EE one, or you'll be done just in time
to solve the Y10K problem (5 digits years).
Kindest regards,
Mladen Gogala
null -
Change background and font for first row only?
Hi,
Have a tablix in SSRS (2008R2) and would like to change the background colour and font for the first row only, is this possible and if so how would I achieve this?
I have followed and example on setting alternate row background colour in the properties but can't see how to do this for just the first row.
=IIF(RowNumber(Nothing) MOD 2,”LightGrey”, “LightBlue”)
ThanksHello,
The Expression uses a Modulo function to calculate every second row. In your case just compare with equal 1 for the first row:
=IIF(RowNumber(Nothing) = 1, ”LightGrey”, “LightBlue”)
Olaf Helper
[ Blog] [ Xing] [ MVP] -
The attached file is work inprogress, with some dummy data sp that I can test it out without having to connect to equipment.
The second tab is the one that I am having the problem with. the output array from the replace element appears to be starting at the index position of 1 rather than 0 but that is ok it is still show that the new data is placed in incrementing element locations. However the main array that I am trying to build that is suppose to take each new calculation and place it in the next index(row) does not ap
pear to be working or at least I am not getting any indication on the inidcator.
Basically what I am attempting to do is is gather some pulses from adevice for a minute, place the results for a calculation, so that it displays then do the same again the next minute, but put these result in the next row and so on until the specifiied time has expired and the loop exits. I need to have all results displayed and keep building the array(display until, the end of the test)Eventually I will have to include a min max section that displays the min and max values calculated, but that should be easy with the min max function.Actually I thought this should have been easy but, I gues I can not see the forest through the trees. Can any one help to slear this up for me.
Attachments:
regulation_tester_7_loops.vi 244 KBI didn't really have time to dig in and understand your program in depth,
but I have a few tips for you that might things a bit easier:
- You use local variables excessively which really complicates things. Try
not to use them and it will make your life easier.
- If you flowchart the design (very similar to a dataflow diagram, keep in
mind!) you want to gather data, calculate a value from that data, store the
calculation in an array, and loop while the time is in a certain range. So
theres really not much need for a sequence as long as you get rid of the
local variables (sequences also complicate things)
- You loop again if timepassed+1 is still less than some constant. Rather
than messing with locals it seems so much easier to use a shiftregister (if
absolutely necessary) or in this case base it upon the number of iterations
of the loop. In this case it looks like "time passed" is the same thing as
the number of loop iterations, but I didn't check closely. There's an i
terminal in your whileloop to read for the number of iterations.
- After having simplified your design by eliminating unnecessary sequence
and local variables, you should be able to draw out the labview diagram.
Don't try to use the "insert into array" vis since theres no need. Each
iteration of your loop calculates a number which goes into the next position
of the array right? Pass your result outside the loop, and enable indexing
on the terminal so Labview automatically generates the array for you. If
your calculation is a function of previous data, then use a shift register
to keep previous values around.
I wish you luck. Post again if you have any questions. Without a more
detailed understanding of your task at hand it's kind of hard to post actual
code suggestions for you.
-joey
"nelsons" wrote in message
news:[email protected]...
> how do I create a 1d array that takes a single calculation and insert
> the result into the first row and then the next calculation the next
> time the loop passes that point and puts the results in thsecond row
> and so on until the loop is exited.
>
> The attached file is work inprogress, with some dummy data sp that I
> can test it out without having to connect to equipment.
> The second tab is the one that I am having the problem with. the
> output array from the replace element appears to be starting at the
> index position of 1 rather than 0 but that is ok it is still show that
> the new data is placed in incrementing element locations. However the
> main array that I am trying to build that is suppose to take each new
> calculation and place it in the next index(row) does not appear to be
> working or at least I am not getting any indication on the inidcator.
>
> Basically what I am attempting to do is is gather some pulses from
> adevice for a minute, place the results for a calculation, so that it
> displays then do the same again the next minute, but put these result
> in the next row and so on until the specifiied time has expired and
> the loop exits. I need to have all results displayed and keep building
> the array(display until, the end of the test)Eventually I will have to
> include a min max section that displays the min and max values
> calculated, but that should be easy with the min max function.Actually
> I thought this should have been easy but, I gues I can not see the
> forest through the trees. Can any one help to slear this up for me. -
Assessable Value and Wrong Value in SEcess in first row in J1IS
Hi,
This is a scenario of Vendor Return when we are returning multiple excisable materials to Vendor.
I have created Return Delivery using movement type in MIGO with choosing the option Part 1 only.
In J1IS,
The First problem is the assessable value which is coming wrongly as 111.11 whereas the gross value of the material is Rs. 100 only with Excise Duty 10% BED, 2% ECess and 1% SEcess & 2% CST.
The second problem is
The duty values are showing correct in the screen e.g., BED 10, ECS 0.2 and AT1 0.1 (according to gross value 100, 10% BED, 2% ECess and 1% SEcess )
There are total five items with the same gross value and other duties (gross value 100, 10% BED, 2% ECess and 1% SEcess)
But as soon as the transaction is saved, the AT1 value against first row changes wrongly from 0.1 to 0.6 and the same is flowing to the table.
Can any one provide some idea to resolve this?
Thanks in advanceHi,
Please check my previous reply on this "Get Excise Invoice" problem thro' the link provided below.
Re: J1IS: u2018Get Excise invoiceu2019 not showing any values
Regards,
Siva -
Second row data - First row data of other column?
Hi All,
I have a requirement to show the second row data of the column1 as first row in column2. Please see the example below, where month is filtered <= 05.
Month Sales Sales_New
01 500 600
02 600 700
03 700 800
04 800 900
05 900 NULLIn the above example for month 05, column Sales_New should show NULL because it is the last row of the query.
Thanks in advance.Something gone wrong with your config....!!
How about
"In Criteria tab use Month descending order and in Pivot table use ascending order"
This is mandatory to achieve this..
FYI: I've tested this in my local.
If you need will send screenshot
I appreciate if you mark as correct ;) else let me know -
Grab the first rows and put it to column wise
Below are two dump, i want to grab the first 2 rows in ascending order by from_date and put to column wise, the first row label first_charge and second row as second_charge. AND throw away rows from 3 are not needed.
1st dump 5 columns are my input,
2nd dump 3 columnS ARE my desired output.
I have tried the rank function but can someone please confirm this is correct way to do this for all the accounts in the table
Script (table and data) for 1st dump is at bottom of post.
Can anyone help resolve this issue - thanks.
--FIRST DUMP
ACCOUNT_ID CHARGE_AMT CHARGE_DATE FROM_DATE THRU_DATE
212855740 14.52 5/04/2012 14/03/2012 31/03/2012
212855740 25 5/04/2012 1/04/2012 30/04/2012
212855740 25 5/05/2012 1/05/2012 31/05/2012
212855740 25 5/06/2012 1/06/2012 30/06/2012
212855740 25 5/07/2012 1/07/2012 31/07/2012
212855740 25 5/08/2012 1/08/2012 31/08/2012
212855740 25 5/09/2012 1/09/2012 30/09/2012
212855740 25 5/10/2012 1/10/2012 31/10/2012
212855740 25 5/11/2012 1/11/2012 30/11/2012
--DESIRED DUMP
ACCOUNT_ID PRO_CHARGE MONTHLY_CHARGE
212855740 14.52 25
WITH CHARGE_TABLE_QUERY
AS (SELECT account_id,
charge_amt,
charge_date,
from_date,
thru_date,
ROW_NUMBER ()
OVER (PARTITION BY account_id ORDER BY from_Date)
row_num
FROM my_tbl)
SELECT account_id,
MAX (CASE WHEN ROW_NUM = 1 THEN CHARGE_AMT ELSE 0 END) PRO_CHARGE,
MAX (CASE WHEN ROW_NUM = 2 THEN CHARGE_AMT ELSE 0 END) MONTHLY_CHARGE
FROM CHARGE_TABLE_QUERY q
WHERE row_num IN (1, 2)
GROUP BY account_id;ricard888 wrote:
what happens if a new account where there is no second charge yet. can i have either null or 0 in the monthly_charge.You could test it easily. Anyhow, it will work without any change in the code
insert into my_table
select 1,50,CHARGE_DATE,FROM_DATE,THRU_DATE
from my_table
where rownum = 1;
1 rows inserted.
with CHARGE_TABLE_QUERY as
select account_id,charge_amt,
ROW_NUMBER ()
OVER (PARTITION BY account_id ORDER BY from_Date) rn,
lead(charge_amt)
OVER (PARTITION BY account_id ORDER BY from_Date) MONTHLY_CHARGE
from my_table
select account_id,charge_amt pro_charge,monthly_charge
from CHARGE_TABLE_QUERY
where rn = 1;
ACCOUNT_ID PRO_CHARGE MONTHLY_CHARGE
1 50
212855740 14.52 25 -
I have created a crystal report with credit and debit column. Balance column created on the report. Report running with cummulative balance. THis report contain an option for date range. If i filtered this report its not showing the actual balance. I need
a first row to indicate previous balance as opening balance in this report. And following is the formula for balance column.
Whileprintingrecords;
Shared Numbervar balance;
Shared Numbervar display;
balance:={@debit}-{@credit};
display:=display+balance;
displayAs this question is out of the T-SQL queue, thus I would suggest you consult Crystal Report questions to the correct forums.
C#
https://social.msdn.microsoft.com/Forums/vstudio/en-US/home?forum=csharpgeneral
VB
https://social.msdn.microsoft.com/Forums/vstudio/en-US/home?forum=vbgeneral
people there have more knowledge on Crystal Report. -
Row 6 in this spreadsheet is the result of Row 2/Row 3 as evidenced by the formula listed while Cell Y6 selected. How can I make the values in this row appear as durations of minutes and seconds rather than 3-digit decimals? For example, rather than appearing as 9.84 I would like the value of Cell Y6 to appear as 9:50 or 9min 50sec. (obviously .84x60seconds 50 seconds). I tried changing the cell formats from "number" to "duration," but no change is made. Using the "duration" format does however work if I am manually entering the decimal value into the cell rather than allowing it to result from another caluclation within the spreadsheet. Is there a solution to this within Numbers '09? You can see why I would want the "pace" displayed in minutes and seconds. Thanks in advance!
RyanHi Ryan,
You wrote:
"The problem is that my "Distance" is a row of automatically generated values resulting from ((Row1/60)*Row 6). Changing the format of Row 1 to minutes causes row two to be expressed as a duration, which obviously it shouldn't because it is a distance. The spreadsheet has to be designed so that all I have to manually input on each entry are Row 1 Values (Time) and Row 6 Values (Average Pace). The rest of the cells must be automatically poulated as a result of formulas."
I'm assuming that where you say "Row 1" in this you mean "Row 2", which is labeled "Time" in the example in the OP.
In the original post, you presented a formula from cell Y6. Replacing the Header labels in that formula's cell reference with the Addresses of the referenced cells, the formula was:
Y6: =Y2/Y3
In this post, you are saying that Y6 contains entered data: "...all I have to manually input on each entry are Row 1 Values (Time) and Row 6 Values (Average Pace).
Which is correct?
Regards,
Barry -
Read only af:table first row select and focus on form load
I use a read only af:table in my page. When my page loads and I click on my table, then I can use up / down arrow keys to navigate in my table's rows. But if I don't click on the table, I can't navigate in my table's rpws.
What can do in my page to give the first focus to my table's first row and navigate in my rows without using mouse clicks....
findElementById function in javascript does not work in jdeveloper 11...
Do you help me for this?
Thanks..Hi,
actually findElementById does work, but you should use the ADF client side framework for this. Add a clientListener to the component that intercepts the keyboard usage and make it callin the next record on the table.
I'll take a note for a how-to to put on my blog as I don't have the code ready. However, its possible this way
Frank -
How to get higher and second higher value in one row?
Hello world,
I want to get higher and second higher sal from emp in one row ,,
Thanks1 select e.empno, e.ename, e.sal, lag(sal) over (order by sal) next_sal from emp e
2* order by sal
SQL> /
EMPNO ENAME SAL NEXT_SAL
7369 SMITH 800
7900 JAMES 950 800
7876 ADAMS 1100 950
7521 WARD 1250 1100
7654 MARTIN 1250 1250
7934 MILLER 1300 1250
7844 TURNER 1500 1300
7499 ALLEN 1600 1500
7782 CLARK 2450 1600
7698 BLAKE 2850 2450
7566 JONES 2975 2850
EMPNO ENAME SAL NEXT_SAL
7788 SCOTT 3000 2975
7902 FORD 3000 3000
7839 KING 5000 3000 -
Af:tableselectmany always selects first row and ONLY first row
My table in jsp:
<af:table value="#{bindings.AluNoExpeAluM1.collectionModel}" var="row"
rows="#{bindings.AluNoExpeAluM1.rangeSize}"
first="#{bindings.AluNoExpeAluM1.rangeStart}"
emptyText="#{bindings.AluNoExpeAluM1.viewable ? \'No rows yet.\' : \'Access Denied.\'}"
binding="#{cient20uSeleccionAluBean.tablaMultiple}">
<af:column sortProperty="Vnumdocu" sortable="false"
headerText="#{bindings.AluNoExpeAluM1.labels.Vnumdocu}">
<af:outputText value="#{row.Vnumdocu}"/>
</af:column>
<af:column sortProperty="Vapeynombre" sortable="false"
headerText="#{bindings.AluNoExpeAluM1.labels.Vapeynombre}">
<af:outputText value="#{row.Vapeynombre}"/>
</af:column>
<f:facet name="selection">
<af:tableSelectMany text="Select items and ..." autoSubmit="true">
<af:commandButton text="commandButton 1"
action="#{cient20uSeleccionAluBean.elegirAlumnoAction}"
partialSubmit="true" immediate="true"/>
</af:tableSelectMany>
</f:facet>
</af:table>
Table don't have SelectionListener and SelectionState, but the method only select the first row from iterator.
This method "elegirAlumnoAction":
public String elegirAlumnoAction() {
Iterator itRs = this.getTablaMultiple().getSelectionState().getKeySet().iterator();
while(itRs.hasNext()){
Key k = (Key) itRs.next();
System.out.println(k.toString());
Row r = IteratorUtil.obtenerIteradorPorDefecto(this.ITERADOR_RESULTADO).getRow(k);
System.out.println(r.getAttribute("Vnumdocu"));
IteratorUtil.obtenerIteradorPorDefecto(this.ITERADOR_RESULTADO).setCurrentRow(r);
return null;
Message was edited by:
jortri
Message was edited by:
jortriMaybe the following can help you:
http://andrejusb.blogspot.com/2007_02_01_archive.html
http://andrejusb-samples.blogspot.com/2007/02/jdevadf-sample-multi-selection-feature.html -
Give some hints that in a table control , first row will be editable and
pls,
give some hints that in a table control , first row will be editable and
rest of the rows will be non-editable.Hi,
Take the group1 for all the textboxes in table control as 'ABC'.
Use this code, its working:-
it_zekpo is my internal table w/o header line,
wa_zekpo is work area.
Name of input/output fields on screen are:-
wa_zekpo-field1,
wa_zekpo-field2, and so on...
At screen flow-logic
PROCESS BEFORE OUTPUT.
* MODULE status_8003.
LOOP WITH CONTROL po_tb.
MODULE read_data.
ENDLOOP.
PROCESS AFTER INPUT.
* MODULE user_command_8003.
LOOP WITH CONTROL po_tb.
MODULE modify_data.
ENDLOOP.
In PBO
*& Module READ_DATA OUTPUT
MODULE read_data OUTPUT.
READ TABLE it_zekpo INTO wa_zekpo INDEX po_tb-current_line. "po_tab is table control name
"enable only first row and disable rest rows in table control.
IF sy-subrc EQ 0.
IF sy-tabix GE 2.
IF screen-group1 = 'ABC'.
LOOP AT SCREEN.
SCREEN-INPUT = 0.
SCREEN-ACTIVE = 0.
ENDLOOP.
MODIFY SCREEN.
ENDIF.
ENDIF.
"disable empty rows
ELSE.
IF screen-group1 = 'ABC'.
LOOP AT SCREEN.
SCREEN-INPUT = 0.
SCREEN-ACTIVE = 0.
ENDLOOP.
MODIFY SCREEN.
ENDIF.
ENDIF.
data : line_count type i.
describe it_zekpo
lines line_count.
po_tb-lines = line_count + 10.
"to increase the number of lines in table control dynamically
ENDMODULE. " READ_DATA OUTPUT
In PAI
*& Module MODIFY_DATA INPUT
MODULE MODIFY_DATA INPUT.
MODIFY IT_ZEKPO FROM WA_ZEKPO INDEX po_tb-currentline.
ENDMODULE. " MODIFY_DATA INPUT
Hope this solves your problem.
Thanks & Regards,
Tarun Gambhir -
Lock first column and row of a grid so they don't scroll of the screen
Hello,
In a flex app we use a grid with repeaters to build it dynamically depending on a datafeed. But we need the first row and column to stay always on the screen. Any ideas on how to do this ? Did a search for an example but couldn't find anything like it.
I know it exists for a datagrid, but can't find any similar for a grid...
http://flexonblog.wordpress.com/2008/04/22/lock-columns-and-rows-in-datagrid-for-visibilit y/
Thanks for any ideas!
FrankDoesn't exist for Grid container. You might just remove the first items from the dataProvider and place them outside the Grid.
Alex Harui
Flex SDK Developer
Adobe Systems Inc.
Blog: http://blogs.adobe.com/aharui -
I'm using a DataGridView (I call it "dg") to display a list of items. I want the user to be able to position the cursor on a row in the middle of the list then click a button to move that row to the top of the list (and move the other rows between
the first row and the row being moved down one row to accomodate the new first row).
Robert HomesHello,
If the DataGridview does not have it's DataSource set we can use the following logic
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim data = (From T In DataGridView1.Rows(DataGridView1.CurrentRow.Index).Cells.Cast(Of DataGridViewCell)() Select T.Value).ToArray
DataGridView1.Rows.RemoveAt(DataGridView1.CurrentRow.Index)
DataGridView1.Rows.Insert(0, data)
End Sub
If the DataSource is set then we need to do what was done above but against the underlying data rather than the DataGridView itself. The base logic can be found in
the following article in LanguageExtensions.vb but please note the code there is for a different type of move yet the logic is still the same in the end.
Please remember to mark the replies as answers if they help and unmark them if they provide no help, this will help others who are looking for solutions to the same or similar problem.
Maybe you are looking for
-
I am creating a subVI state machine (case structure) which will run inside a while loop which will be executing every 250ms. The reason I wanted to make the state machine case structure into a subVI is because I want to execute 64 of the machines wit
-
Need help identifying .......
Can anyone tell me how to accomplish the animation in the top 6 squares of this site? H3Bmedia.com I know its not flash but was wondering it its just a animated gif or something, although it is interactive to a mouse over......hmm Any insight is appr
-
Goal: type arabic in a java application
hi all: i have a java application in which i would want to type in arabic into a text field.. this works in windows but not in my mandrake linux.. Q1: can this be easily solved in linux, knowing that i can type arabic in some applications, say mozila
-
Can i customize the dialog box message
hi, i wnt to change dialog box message in business catalyst like BC Default Message Is "ERROR: Please choose relevant options before adding to cart" But i want "Please Select The Size" anyone have any idea please tell me thanks
-
Changement ID iCloud pas automatique
Bonjour a tous, J'ai récemment du changer mon Apple ID suite a la perte de mon ancienne adresse email (mot de passe ne marchant plus). Problème, je ne peux pas changer l'ancien Apple ID inscrit sur l'iCloud de l'iPhone, faute de mot de passe, alors q