Order actions in case of amouse
Hello
My .swf file, when a mouse event occurs, I would like events to occur. However, I would like that they occur ion a certain order, instead of past all at once.
My code has objects that appear and an object moving diagonally upward and left at the same time. However, I would like to have objects appear and then have the displacement of an object on the left, and then up.
Here is my code:
I have more code in the mouse event, but it is arbitrary.
So is it possible to order the events?
Thank you.
It seems yopu use the Tween class, so what you can do, is have the interpolation of first occur and assign an MOTION_FINISHED event listener to the Tween so that you can use its event handler to trigger the following interpolation.
Tags: Adobe Animate
Similar Questions
-
To hide multiple items via javascript or actions in case of different variable values - how?
Note: I'm still Captivate 8
The Question has 2 parts:
(1) is there a possibility to hide (or show) of the elements via javascript instead of shares advanced? I think it would be a much faster workflow. I think of something as
If variable1 < = 100 screenx.elemeta.hide;
If variable1 < = 90 screenx.elemetb.hide.
If variable1 < = 80 screenx.elemetc.hide;
If variable1 < = 70 screenx.elemetd.hide;
(2) if it is not possible... OK, I use advanced actions. But there is the 2nd problem: it runs only the first part of it when exporting in HTML5.
See photo. I try to hide - or no - hide the 9 elements in case of different values in a Variable. Lets say that the value is "7". In se9 is Laura if the value is less than or equal 9 to hide the element ausw_se_10. This method works. In se8 is asket if the value is less than or equal 8 in order to hide the element ausw_se_09 - what you see in the image. This and the following mask does not work. I'm doing something wrong or is this a bug? And is there a solution?
Showing and hiding are a relatively easy control if you use HTML5:
CP. Hide ("element_name");
If you want to hide as much as you describe, you would need a very strict naming convention and use a loop to hide items.
-
My folders of bookmarks in the bookmarks Yahoo toolbar are suddenly out in alphabetical order. Also doesn't let me save all bookmarks. And does not allow me to open in a new tab of these favorites, it will allow for open in current tab simply not a new tab.
Any thoughts? Start over? YIKES!Try to ask questions about this problem using Yahoo toolbar?
-
SNMP Trap to order Action Script in Foglight rule
Hello everyone,
I need to make a rule that runs a script via the Action control when a SNMP Trap has arrived. I create this?
The script is required for integration with my SMS server.
Best regards
There is a similar example in our documentation, see if that helps
Golan
-
Advanced actions in CP6 combination
It seems so simple, that I'm almost embarrassed to post.
(1) is it possible to use [if, else if, elseif, else] structure in conditional actions?
(2) is it possible to call several advances in stocks of a trigger (eg. entering a slide)?
(3) is it possible for a tip action call advanced further action?
What I'm trying to accomplish:
At the end of the quiz, display a rating grid (several legends of text) and automatically highlight the part of the scale that corresponds to the way in which the user has made. Assume that the user has marked a 3. The scale can have 3 Legends: caption1 = [0-2: below average], caption2 = [3-4: average], caption3 = [5-6: above average]. Users see the same 3 legends, but the appropriate legend should be highlighted (I set its Alpha to 100% and the other legends at 50%).
What I tried:
(1) to build a conditional action: If score > 4 then highlight caption3, elseif score > 3 then highlight caption2, otherwise select caption1. Unfortunately I do not see how to use the elseif construction.
(2) create 3 separate actions advanced conditional and call each of them entering a slide: (A) if there are 5 < = score < = 6, then highlight caption3 only. (B) if 3 < = score < = 4, then highlight caption2 only. (C) If 0 < = score < = 2, then highlight caption1 only. Unfortunately I can not understand how to call all advanced actions when the user enters the slides
(3) create an advanced standard action that will call the above 3 conditional actions in order. Unfortunately I don't see a way to call advanced actions of in a tip action.
The goal seems so simple, but I am at a loss on how to do it. Help please.
Hello
The workflow in the conditional shares advanced is a bit different from normal programming languages. You have the possibility to create and/or conditions and have a series of decisions (the buttons without a title at the top) with different conditions in each decision. But be aware that Captivate will always evaluate all decisions, in order. So I recommend especially for complicated situations create a flowchart with the logic before you create the action.
No, you can use only a single trigger action. But it is possible to combine in a single conditional action. To mimic a standard action, you use a condition which is always filled as "If 1 is equal to 1"
It is not possible to call a tip for any other action action, no subroutines. There is also no loops, without tables.
I have many examples on my blog for advanced actions use cases: http://blog.lilybiri.com
Your example is quite easy:
Decision 1 "Excellent".
IF cpQuizInfoPointsscored is greater than or equal to 5
Apply the effect... to the proper shape
Decision 2 "average."
IF cpQuizInfoPointsscored is greater than or equal to 3 AND
cpQuizInfoPointsscored is less than 5
Apply the effect... to the proper shape
Decision 3 "Low".
IF cpQuizInfoPointsscored is less than 3
Apply the effect... to the proper shape
-
I tUNES PLAYS SYMPHONY MOVEMENTS in THE WRONG ORDER. HOW TO PROPERLY RE-ORDER THEM?
iTunes plays the movements of the Symphony in the wrong order. How can - I have properly rearrange the order?
With a playlist, you can organize tracks in order any you want. iTunes normally the media played in the order indicated on the screen. In the view of songs sort as Album of the artist should give the right order. in some cases an album may be put with movements out of sequence to adapt to the constraints of the CD format, but there is nothing to stop change you the disc and track numbers according to your desires.
TT2
-
Question,
I'm changing the order in which runs a business structure. I have a structure as a form of State machine, and I want to move from one State to the top so that she runs a State earlier in the structure. I tried to reorganize the case but he always follows the order of execution is created. How to change an order of execution of the state machine?
The order of the cases in a case structure has no effect on the order of execution of the state machine. The state machine runs based on the values you provide to the case selector. You can read this article: Application Design Patterns: State Machines
-
For a 15-7559 Inspiron laptop bag. Get a case 15.6 "or 16"?
I get a new Inspiron 15-7559 15.6 "laptop.
A 15.6 "or 16" laptop backpack box would be better for her?
I've been using a Swiss Gear WA-7652-14F00 15.6 "case for my current Laptop Inspiron.
Hi Naraman,
Wait until you get the new laptop and try your Swiss Gear bag. If it is to close or rub the laptop, you can order a larger case.
-
enableBackButtonDrag - Action Bar back button drag-need help!
All,
Can anyone share please an example on how to implmenet the button back dragging in adobe air. I would like to put this in my application. And I couldn't get it working properly.
There is a api for it: enableBackButtonDrag = true; https://developer.BlackBerry.com/air/APIs/BB10/QNX/fuse/UI/ActionBar/ActionBar.html#enableBackButton...
Thank you!
Here's how I solved it. It's a little complicated, because when you drag the back button you also get an ACTION_SELECTED event, which probably you hung to close the current page (round trip), which must therefore be disabled during travel.
So if anyone has a cleaner way to do it, please let us know!
private function initActionBar():void { actionBar = new ActionBar(); actionBar.backButton = new Action(Strings.BACK[lang], null, "back"); actionBar.enableBackButtonDrag = true; actionBar.y = display.stage.stageHeight - actionBar.height; actionBar.addEventListener(ActionEvent.ACTION_SELECTED, onActionSelected); actionBar.addEventListener(DragEvent.DRAG_BEGIN, onDragBegin); display.addChild(actionBar); } protected function onDragBegin(event:DragEvent):void { actionBar.addEventListener(DragEvent.DRAG_MOVE, onDragMove); actionBar.addEventListener(DragEvent.DRAG_END, onDragEnd); firstMove = true; } protected function onDragMove(event:DragEvent):void { // move the ctrlPanel with the dragged button display.x += event.deltaX; if (firstMove) { // start intercepting ACTION_SELECTED events to prevent Back-button 'tap' to register during drag actionBar.addEventListener(ActionEvent.ACTION_SELECTED, ignoreBackButton, false, 100); firstMove = false; } } protected function ignoreBackButton(event:ActionEvent):void { // do nothing and stop the event to get to trigger the onActionSelected handler event.stopImmediatePropagation(); } protected function onDragEnd(event:DragEvent):void { actionBar.removeEventListener(DragEvent.DRAG_MOVE, onDragMove); actionBar.removeEventListener(DragEvent.DRAG_END, onDragEnd); // depending on how far the user has dragged, close the current page or snap back if (display.x > display.stage.stageWidth/2) { close(); restoreBackButton(); } else { Tweener.addTween(display, {x: 0, time: .3, transition: "EaseOutCubic", onComplete: restoreBackButton}); } } protected function restoreBackButton():void { // stop intercepting taps actionBar.removeEventListener(ActionEvent.ACTION_SELECTED, ignoreBackButton, false); } private function onActionSelected(actionEvent:ActionEvent):void { // TODO: add other actions switch(actionEvent.action.data) { case "back": close(); break; default: } }
My app: Get set - get up! Get ready for the revolution snooze.
-
select * from SCOTT.EMP order by case when ename='SCOTT' THEN 1 END , CASE when ename='TURNER' THEN 2 END, CASE WHEN ename NOT IN ('TURNER','SCOTT') THEN 3 END ASC; Out Put -- SCOTT TURNER WARD JONES MARTIN BLAKE MILLER KING ADAMS JAMES FORD ALLEN SMITH CLARK
My results are after scott turner with A names should come.
SCOTT TURNER ADAMS ....
so you expect the wrong thing... you said oracle to
Use the constant 1 as a policy for all SCOTT test, use 2 for all TURNER and 3 for the rest... so the rest of the group is not really ordered
what you need to do is:
Select * from SCOTT. EMP
order by ename case when 'SCOTT' then 1 when 'TURNER' then 2 3 OTHER END, ename;
HTH
-
I have a very basic SQL statement that I am running on a simple table of three columns. I just want to choose two of the three columns basing selection on a column, then rank each other. I use version 9.2.0.1.0 and I tried to use sqlplus and toad 10.6 and the results are the same in both. My problem is that even if I use an Order By clause the results not be sorted. I have countless statements written and never had a problem with the Order By clause before. I'm puzzled.
Executed SQL statement:
Select COL3 From Table1 where COL2 = 1 Order By COL3;
Result:
DXXXXX
NXXX Mxxx/Cxxxx CXXV
Nzzzz Ezzzz
Oxxxxxxxxxx Exxxx
Rxxxxxxxxx Exxxx
Sxxxxxxx Exxxx
Sxxxxxx Hxxx
gxxxxxxxYou should know that I replaced everything except the first letter of each letters to alter woth Word. There's nothing remarkable about the table:
Executed SQL statement:
DESC Table1;
Result:
Table1 TABLE:
Name Null? Type
----------------------------------------- -------- ----------------------------
COL1 NUMBER
COL2 NUMBER
COL3 VARCHAR2 (255)Hello
Use this...
Select COL3 From Table1 where COL2 = 1 Order By LOWER (COL3);
It should work once you order by the case-based.
When you view, its up to you, if you want to use all the conversions of case or not
-
How to order a tree balanced with SQL hierarchical queries
by searching the forum I found this
is there a way I can order this tree in alphabetical order so that the result looks like
LEVEL INDENTED_ENAME
---------- --------------------
1 KING BED
2 BLAKE
3 ALLEN
3 JAMES
MARTIN 3
3 TURNER
WARD 3
2 CLARK
3 MILLER
2 JONES
3 FORD
4 SMITH
3 SCOTT
4 ADAMS
-the original query-
SELECT THE LEVEL
, LPAD (' ', 3 * LEVEL) | Ename AS indented_ename
FROM scott.emp
START WITH mgr IS NULL
CONNECT BY PRIOR empno = mgr
;
LEVEL INDENTED_ENAME
---------- --------------------
1 KING BED
2 JONES
3 SCOTT
4 ADAMS
3 FORD
4 SMITH
2 BLAKE
3 ALLEN
WARD 3
MARTIN 3
3 TURNER
3 JAMES
2 CLARK
3 MILLERHello
Bodin wrote:
Hi Frank, I can order it selectively depending on the level, which means that only siblings stopped at third level, but rest of the brothers and sisters remain Nations United orderedIt's actually quite difficult. You can "ORDER of brothers and SŒURS BY CASE... ', like this:
SELECT LEVEL , LPAD (' ', 3 * LEVEL) || ename AS indented_ename FROM scott.emp START WITH mgr IS NULL CONNECT BY mgr = PRIOR empno ORDER SIBLINGS BY CASE WHEN job = 'MANAGER' THEN ename ELSE NULL END ;
In this case to get desired results in table scott.emp, as the lines are LEVEL = 2 if and only if use = "MANAGER".
But if you reference LEVEL in the CASE expression (for example, if you replace ' job = 'MANAGER' ' with "2 LEVEL =" above "), then you will get the error" ORA-00976: LEVEL, PRIOR or ROWNUM not allowed here. "
The best way I can think to do exactly what you asked is to do 2 CONNECT BY queries; one just to get the LEVEL and the other for the brothers and SŒURS ORDER BY:
{code}
WITH got_lvl AS
(
SELECT LEVEL AS lvl
Bishop
empno
ename
FROM scott.emp
START WITH mgr IS NULL
CONNECT BY PRIOR empno = mgr
)
SELECT lvl
, LPAD (' ', 3 * LEVEL) | Ename AS indented_ename
OF got_lvl
START WITH mgr IS NULL
CONNECT BY PRIOR empno = mgr
BROTHERS AND SŒURS OF ORDER OF CASES
ONCE lvl = 2 THEN ename
ANOTHER NULL
END
;
{code}
Why you can't simply "Brothers and SŒURS of ORDER BY ename" at all levels? If all you care is the order of the items of LEVEL = 2, then this is probably the most effective and simplest way. It really hurt anything if nodes on levels 3, 4, 5,... are in order, too?Here's something you can do if you want to order by different unique things to different levels:
{code}
WITH got_sort_key AS
(
SELECT LEVEL AS lvl
, LPAD (' ', 3 * LEVEL) | Ename AS indented_ename
empno
SYS_CONNECT_BY_PATH (LPAD (CASE
WHEN LEVEL = 2
THEN ename
Of OTHER TO_CHAR (empno)
END
10
)
, ','
) AS sort_key
FROM scott.emp
START WITH mgr IS NULL
CONNECT BY PRIOR empno = mgr
)
SELECT lvl
indented_ename
empno
OF got_sort_key
ORDER BY sort_key
;
{code}
However, all possible values of the CASE expression must uniquely identify the node; otherwise, the output won't necessarily hierarchical order. You can assign arbitrary unique IDS to the lines (using the ROW_NUMBER analytic function, for example), but that requires another subquery and is also complex and perhaps as ineffective as the solution above with 2 garages CONNECT. -
Sorting does not work with ROW_NUMBER () OVER (ORDER BY
CREATE OR REPLACE PROCEDURE SP_SALES)
p_sales_id IN VARCHAR2,
p_rownnum_from in NUMBERS
p_rownnum_to in NUMBERS
p_sort_by IN VARCHAR2,
p_query ON SYS_REFCURSOR,
)
AS
v_query VARCHAR2 (32000);
v_sort_list VARCHAR2 (32000);
BEGIN
IF p_spv_sort_by IS NULL THEN
v_sort_list: = 'nom_donne ASC ";
ON THE OTHER
v_sort_list: = p_spv_sort_by;
END IF;
DBMS_OUTPUT. Put_line ('v_sort_list' | v_sort_list);
OPEN FOR P_query
SELECT sales_id
item_id,
order_num,
Employee_Name
nom_donne
dept_id,
manager_name,
NO_LIG
Of
(SELECT x.*,
ROW_NUMBER () OVER (ORDER BY v_sort_list) no_lig
OF (sales_id,
item_id,
order_num,
Employee_Name
nom_donne
dept_id,
manager_name,
Vaughan Williams order.
sale pol,
CA of the EMP,
WHERE pol.id = rvw.pr_order_id
AND ca.empid = pol.employee_id
(AND status = "SUP") x)
WHERE the arguments no_lig BETWEEN p_rownnum_from AND p_rownnum_to;
-ORDER by v_sort_list;
DBMS_OUTPUT. Put_line ('v_sort_list' | v_sort_list);
EXCEPTION
WHILE OTHERS THEN
DBMS_OUTPUT. PUT_LINE ('EX');
END;
END;
/
DISPLAY ERRORS
Sorting does not work. I'm doing something wrong here?
How to run for help below
declare
x SYS_REFCURSOR;
number of y;
BEGIN
SP_SALES ('70159_502', 1, 5, 'GIVEN_NAME' |') ASC',: x);
-dbms_output.put_line (: x);
END;Hello
According to the number of columns different, you can sort on and data types, it may be possible for you to include conditional logic in the existing statement without requiring dynamic sql code...
DTYLER_APP@pssdev2> var p_spv_sort_by varchar2(100) DTYLER_APP@pssdev2> DTYLER_APP@pssdev2> exec :p_spv_sort_by:='some other column' PL/SQL procedure successfully completed. P_SPV_SORT_BY ---------------------------------------------------------------------------------------- some other column DTYLER_APP@pssdev2> DTYLER_APP@pssdev2> WITH source AS 2 ( SELECT 'a' given_name, 'z' other_column from dual UNION ALL 3 SELECT 'b' given_name, 'y' other_column from dual UNION ALL 4 SELECT 'c' given_name, 'x' other_column from dual 5 ) 6 SELECT 7 given_name, 8 other_column, 9 ROW_NUMBER () 10 OVER ( 11 ORDER BY 12 CASE 13 WHEN :p_spv_sort_by IS NULL THEN given_name 14 WHEN :p_spv_sort_by = 'some other column' THEN other_column 15 END) 16 ROW_NUM 17 FROM 18 source 19 / G O ROW_NUM - - ---------- c x 1 b y 2 a z 3 3 rows selected. DTYLER_APP@pssdev2> exec :p_spv_sort_by:=NULL; PL/SQL procedure successfully completed. P_SPV_SORT_BY ---------------------------------------------------------------------------------------- DTYLER_APP@pssdev2> WITH source AS 2 ( SELECT 'a' given_name, 'z' other_column from dual UNION ALL 3 SELECT 'b' given_name, 'y' other_column from dual UNION ALL 4 SELECT 'c' given_name, 'x' other_column from dual 5 ) 6 SELECT 7 given_name, 8 other_column, 9 ROW_NUMBER () 10 OVER ( 11 ORDER BY 12 CASE 13 WHEN :p_spv_sort_by IS NULL THEN given_name 14 WHEN :p_spv_sort_by = 'some other column' THEN other_column 15 END) 16 ROW_NUM 17 FROM 18 source 19 / G O ROW_NUM - - ---------- a z 1 b y 2 c x 3 3 rows selected. DTYLER_APP@pssdev2>
But this would depend on the columns that you sort to be of the same data type or at least have the possibility of converting the same type of data without loss of the sort order.
DTYLER_APP@pssdev2> WITH source AS 2 ( SELECT 'a' given_name, sysdate - 2 other_column from dual UNION ALL 3 SELECT 'b' given_name, sysdate - 1 other_column from dual UNION ALL 4 SELECT 'c' given_name, sysdate other_column from dual 5 ) 6 SELECT 7 given_name, 8 other_column, 9 ROW_NUMBER () 10 OVER ( 11 ORDER BY 12 CASE 13 WHEN :p_spv_sort_by IS NULL THEN given_name 14 WHEN :p_spv_sort_by = 'some other column' THEN other_column 15 END) 16 ROW_NUM 17 FROM 18 source 19 / WHEN :p_spv_sort_by = 'some other column' THEN other_column * ERROR at line 14: ORA-00932: inconsistent datatypes: expected CHAR got DATE DTYLER_APP@pssdev2> WITH source AS 2 ( SELECT 'a' given_name, sysdate - 2 other_column from dual UNION ALL 3 SELECT 'b' given_name, sysdate - 1 other_column from dual UNION ALL 4 SELECT 'c' given_name, sysdate other_column from dual 5 ) 6 SELECT 7 given_name, 8 other_column, 9 ROW_NUMBER () 10 OVER ( 11 ORDER BY 12 CASE 13 WHEN :p_spv_sort_by IS NULL THEN given_name 14 WHEN :p_spv_sort_by = 'some other column' THEN TO_CHAR(other_column,'YYYYMMDDHH24MISS') 15 END) 16 ROW_NUM 17 FROM 18 source 19 / G OTHER_COLUMN ROW_NUM - -------------------- ---------- a 12-SEP-2011 15:04:19 1 b 13-SEP-2011 15:04:19 2 c 14-SEP-2011 15:04:19 3 3 rows selected.
HTH
David
-
[10g] complex Order By clause...
I can manually sort my data and can provide logic that I use to do this, but I need some help really put it in order by clause.
I work in the 10th, 10g...
Some examples of data, starting with:
And that's what I want to do... that's how I want this sorted data:CREATE TABLE inventory_history ( time_stamp CHAR(20) , part_nbr CHAR(25) , act_date DATE , ord_nbr CHAR(10) , ln_nbr CHAR(3) , code_pre CHAR(3) , code_sfx CHAR(3) , user_id CHAR(36) , qty NUMBER(15,4) , adj_qty NUMBER(15,4) , cnt_qty NUMBER(15,4) ); INSERT INTO inventory_history VALUES ('20080716100442488094','N174X53A',TO_DATE('07/16/2008','mm/dd/yyyy'),NULL,NULL,'MTL','INS','user2',0,0,31); INSERT INTO inventory_history VALUES ('20080717135714597592','N174X53A',TO_DATE('07/17/2008','mm/dd/yyyy'),NULL,NULL,'MTL','INS','user2',31,0,0); INSERT INTO inventory_history VALUES ('20100401145927954563','N174X53A',TO_DATE('04/01/2010','mm/dd/yyyy'),NULL,NULL,'MTL','INS','user1',0,0,31); INSERT INTO inventory_history VALUES ('20100917085814607499','N174X53A',TO_DATE('09/17/2010','mm/dd/yyyy'),NULL,NULL,'MTL','INS','user1',30,0,0); INSERT INTO inventory_history VALUES ('20080715093021657035','N174X53A',TO_DATE('07/15/2008','mm/dd/yyyy'),'P000012345','001','POR','LIN','user5',31,0,0); INSERT INTO inventory_history VALUES ('20080716100406218646','N174X53A',TO_DATE('07/16/2008','mm/dd/yyyy'),'P000012345','001','MTL','INS','user2',31,0,0); INSERT INTO inventory_history VALUES ('20080819111303812239','N174X53A',TO_DATE('08/19/2008','mm/dd/yyyy'),'P000012345','002','POR','LIN','user5',31,0,0); INSERT INTO inventory_history VALUES ('20100504083427334677','N174X53A',TO_DATE('05/04/2010','mm/dd/yyyy'),'P000012345','002','POR','RTV','user3',31,0,0); INSERT INTO inventory_history VALUES ('20100512095750285578','N174X53A',TO_DATE('05/12/2010','mm/dd/yyyy'),'P000012345','002','POR','LIN','user6',30,0,0); INSERT INTO inventory_history VALUES ('20100614130143734676','N174X53A',TO_DATE('06/14/2010','mm/dd/yyyy'),'P000012345','002','MTL','INS','user1',0,0,30); INSERT INTO inventory_history VALUES ('20100412101824624708','N174X53A',TO_DATE('04/12/2010','mm/dd/yyyy'),'P000012345','004','POR','LIN','user4',31,0,0); INSERT INTO inventory_history VALUES ('20100422150057876187','N174X53A',TO_DATE('04/22/2010','mm/dd/yyyy'),'P000012345','004','MTL','INS','user2',0,0,31); INSERT INTO inventory_history VALUES ('20100504081750020711','N174X53A',TO_DATE('05/04/2010','mm/dd/yyyy'),'P000012345','004','POR','RTV','user3',31,0,0); INSERT INTO inventory_history VALUES ('20100512095303832580','N174X53A',TO_DATE('05/12/2010','mm/dd/yyyy'),'P000012345','004','POR','LIN','user6',31,0,0); INSERT INTO inventory_history VALUES ('20100712133833381506','N174X53A',TO_DATE('07/12/2010','mm/dd/yyyy'),'P000012345','004','MTL','INS','user1',31,0,0); INSERT INTO inventory_history VALUES ('20091124130834762244','015-279A',TO_DATE('11/24/2009','mm/dd/yyyy'),'P000045557','002','POR','LIN','user12',10,0,0); INSERT INTO inventory_history VALUES ('20091124131110241744','015-279A',TO_DATE('11/24/2009','mm/dd/yyyy'),'P000045557','002','POR','ADJ','user12',0,10,0); INSERT INTO inventory_history VALUES ('20091124131850641554','015-279A',TO_DATE('11/24/2009','mm/dd/yyyy'),'P000045557','002','POR','ADJ','user12',0,-20,0); INSERT INTO inventory_history VALUES ('20091124131916249134','015-279A',TO_DATE('11/24/2009','mm/dd/yyyy'),'P000045557','002','POR','LIN','user12',10,0,0); INSERT INTO inventory_history VALUES ('20091124135601215291','015-279A',TO_DATE('11/24/2009','mm/dd/yyyy'),'P000045557','002','POR','ADJ','user12',0,10,0); INSERT INTO inventory_history VALUES ('20091124140318980761','015-279A',TO_DATE('11/24/2009','mm/dd/yyyy'),NULL,NULL,'MTL','INS','user13',10,0,0); INSERT INTO inventory_history VALUES ('20091124142344235001','015-279A',TO_DATE('11/24/2009','mm/dd/yyyy'),'P000045557','002','POR','ADJ','user12',0,-10,0); INSERT INTO inventory_history VALUES ('20100701123833300000','test',TO_DATE('07/01/2010','mm/dd/yyyy'),'P000011111','001','POR','LIN','user12',5,0,0); INSERT INTO inventory_history VALUES ('20100705964833300000','test',TO_DATE('07/05/2010','mm/dd/yyyy'),'P000011111','001','MTL','INS','user2',5,0,0); INSERT INTO inventory_history VALUES ('20100702123456700000','test',TO_DATE('07/02/2010','mm/dd/yyyy'),'P000011111','002','POR','LIN','user6',5,0,0); INSERT INTO inventory_history VALUES ('20100704987654300000','test',TO_DATE('07/04/2010','mm/dd/yyyy'),NULL,NULL,'MTL','INS','user1',5,0,0);
It's the logic that I use to sort the data manually:TIME_STAMP PART_NBR ACT_DATE ORD_NBR LN_NBR CODE_PRE CODE_SFX USER_ID QTY ADJ_QTY CNT_QTY 20091124130834762244 015-279A 11/24/2009 P000045557 002 POR LIN user12 10 0 0 20091124131110241744 015-279A 11/24/2009 P000045557 002 POR ADJ user12 0 10 0 20091124131850641554 015-279A 11/24/2009 P000045557 002 POR ADJ user12 0 -20 0 20091124131916249134 015-279A 11/24/2009 P000045557 002 POR LIN user12 10 0 0 20091124135601215291 015-279A 11/24/2009 P000045557 002 POR ADJ user12 0 10 0 20091124140318980761 015-279A 11/24/2009 MTL INS user13 10 0 0 20091124142344235001 015-279A 11/24/2009 P000045557 002 POR ADJ user12 0 -10 0 20080715093021657035 N174X53A 7/15/2008 P000012345 001 POR LIN user5 31 0 0 20080716100406218646 N174X53A 7/16/2008 P000012345 001 MTL INS user2 31 0 0 20080716100442488094 N174X53A 7/16/2008 MTL INS user2 0 0 31 20080717135714597592 N174X53A 7/17/2008 MTL INS user2 31 0 0 20080819111303812239 N174X53A 8/19/2008 P000012345 002 POR LIN user5 31 0 0 20100401145927954563 N174X53A 4/1/2010 MTL INS user1 0 0 31 20100512095750285578 N174X53A 5/12/2010 P000012345 002 POR LIN user6 30 0 0 20100614130143734676 N174X53A 6/14/2010 P000012345 002 MTL INS user1 0 0 30 20100412101824624708 N174X53A 4/12/2010 P000012345 004 POR LIN user4 31 0 0 20100422150057876187 N174X53A 4/22/2010 P000012345 004 MTL INS user2 0 0 31 20100512095303832580 N174X53A 5/12/2010 P000012345 004 POR LIN user6 31 0 0 20100712133833381506 N174X53A 7/12/2010 P000012345 004 MTL INS user1 31 0 0 20100917085814607499 N174X53A 9/17/2010 MTL INS user1 30 0 0 20100701123833300000 test 7/1/2010 P000011111 001 POR LIN user12 5 0 0 20100705964833300000 test 7/5/2010 P000011111 001 MTL INS user2 5 0 0 20100702123456700000 test 7/2/2010 P000011111 002 POR LIN user6 5 0 0 20100704987654300000 test 7/4/2010 MTL INS user1 5 0 0
If the record has ord_nbr/ln_nbr (they are not NULL), then sort by part_nbr, ord_nbr, ln_nbr and time_stamp, in that order.
And here is the complicated part...
If the record does not ord_nbr/ln_nbr (they have a NULL value, and this can happen only on transactions of MTL-INS), then it must be placed in the kind I described via this logic:
It should be placed with the other records with the same part_nbr, after the closest previous transaction of POR time_stamp FLAX (for part_nbr), but before the next chronological time_stamp MTL-INS transaction (for part_nbr) and between these 2 constraints, made by time_stamp.
Any suggestions?
Published by: user11033437 on September 23, 2010 15:13 (order sets of sample data, so part_nbr went up, although the global sort don't really matter, just sorting within each group of part_nbr.)Hello
I understand a little better now.
It is essentially the same approach that AScheffer posted, but it uses analytical functions, which should be more effective than scalar subqueries.
It also handles ord_nbr and ln_nbr in a single field, for simplicity. (There is an occasion where the CHAR data type is actually practical.)SELECT * FROM inventory_history ORDER BY part_nbr , CASE WHEN ord_nbr IS NOT NULL THEN ord_nbr || ln_nbr ELSE LAST_VALUE ( CASE WHEN code_pre = 'POR' AND code_sfx = 'LIN' THEN ord_nbr || ln_nbr END IGNORE NULLS ) OVER ( PARTITION BY part_nbr ORDER BY time_stamp ) END , time_stamp ;
The result I get is always not very well what you have posted. The above query produces this output:
TIME_STAMP PART_NBR ACT_DATE ORD_NBR LN_ COD COD USER_ID QTY ADJ_QTY CNT_QTY -------------------- ------------ ---------- ---------- --- --- --- ------- ---------- ---------- ---------- 20091124130834762244 015-279A 11/24/2009 P000045557 002 POR LIN user12 10 0 0 20091124131110241744 015-279A 11/24/2009 P000045557 002 POR ADJ user12 0 10 0 20091124131850641554 015-279A 11/24/2009 P000045557 002 POR ADJ user12 0 -20 0 20091124131916249134 015-279A 11/24/2009 P000045557 002 POR LIN user12 10 0 0 20091124135601215291 015-279A 11/24/2009 P000045557 002 POR ADJ user12 0 10 0 20091124140318980761 015-279A 11/24/2009 MTL INS user13 10 0 0 20091124142344235001 015-279A 11/24/2009 P000045557 002 POR ADJ user12 0 -10 0 20080715093021657035 N174X53A 7/15/2008 P000012345 001 POR LIN user5 31 0 0 20080716100406218646 N174X53A 7/16/2008 P000012345 001 MTL INS user2 31 0 0 20080716100442488094 N174X53A 7/16/2008 MTL INS user2 0 0 31 20080717135714597592 N174X53A 7/17/2008 MTL INS user2 31 0 0 20080819111303812239 N174X53A 8/19/2008 P000012345 002 POR LIN user5 31 0 0 20100401145927954563 N174X53A 4/1/2010 MTL INS user1 0 0 31 20100504083427334677 N174X53A 5/4/2010 P000012345 002 POR RTV user3 31 0 0 20100512095750285578 N174X53A 5/12/2010 P000012345 002 POR LIN user6 30 0 0 20100614130143734676 N174X53A 6/14/2010 P000012345 002 MTL INS user1 0 0 30 20100917085814607499 N174X53A 9/17/2010 MTL INS user1 30 0 0 20100412101824624708 N174X53A 4/12/2010 P000012345 004 POR LIN user4 31 0 0 20100422150057876187 N174X53A 4/22/2010 P000012345 004 MTL INS user2 0 0 31 20100504081750020711 N174X53A 5/4/2010 P000012345 004 POR RTV user3 31 0 0 20100512095303832580 N174X53A 5/12/2010 P000012345 004 POR LIN user6 31 0 0 20100712133833381506 N174X53A 7/12/2010 P000012345 004 MTL INS user1 31 0 0 20100701123833300000 test 7/1/2010 P000011111 001 POR LIN user12 5 0 0 20100705964833300000 test 7/5/2010 P000011111 001 MTL INS user2 5 0 0 20100702123456700000 test 7/2/2010 P000011111 002 POR LIN user6 5 0 0 20100704987654300000 test 7/4/2010 MTL INS user1 5 0 0
As you can see, the back row with part_nbr = "N174X53A" which has a NULL ord_nbr value comes before the other lines with the same part_nbr; you said that you wanted changed.
This line has time_stamp = '20100917085814607499'.
Lines with the same part_nbr and codes "POR - LIN" are (in order of time_stamp):20080715093021657035 N174X53A 7/15/2008 P000012345 001 POR LIN user5 31 0 0 20080819111303812239 N174X53A 8/19/2008 P000012345 002 POR LIN user5 31 0 0 20100412101824624708 N174X53A 4/12/2010 P000012345 004 POR LIN user4 31 0 0 20100512095303832580 N174X53A 5/12/2010 P000012345 004 POR LIN user6 31 0 0 20100512095750285578 N174X53A 5/12/2010 P000012345 002 POR LIN user6 30 0 0
The misplaced line has a time_stamp greater than any of them, if I have it was supposed to be sorted as if it were the ord_nbr and the ln_nbr of the last row of POR - LIN before her. The last row of POR - LIN has lin_nbr = '002'. You seem to want it sorted as if it had lin_cd = '004', which is the ln_code of the line of POR - LIN after the last, not the last one.
-
passing parameters in the order by clause of the cursor
Hi friends,
I am facing a strange problem
I have a cursor with an order by clause.
OPEN FOR Cursor_nomrpt
SELECT DISTINCT
CAST (plano.desc3 AS VARCHAR2 (50)) category
plano.name plan_name
, chip nvl (CAST (plano.desc6 AS VARCHAR2 (50)), 'not applicable')
, nvl (trunc(plano.value18,2), 0) nominal_slm
, nvl (trunc(plano.value19,2), 0) blm
plano.dbdateeffectivefrom date_live
,
Plano.DBKEY pog_id
, case when plano.value47 < 0 THEN 0 when plano.value47 IS NULL THEN 0 ELSE plano.value47 END as parent_id
Of
Plano dplapro1.ix_spc_planogram
INNER JOIN dplapro1.ix_spc_performance ON plano.dbkey = perf.dbparentplanogramkey perf
Produces INNER JOIN dplapro1.ix_spc_product ON perf.dbparentproductkey = product.dbkey
INNER JOIN dplapro1.ix_spc_product_key ON product.dbkey2 = prodkey.dbkey prodkey
AND prodkey.keylevel = 2
WHERE
Plano.value50 = 0
AND plano.dbkey4 = p_subcatkey
ORDER BY ltrim (rtrim (p_orderby)) CSA;
p_orderby is the parameter that is passed. But the result is not sorted. But when I run the cursor to hardcode the value of parameter, that it works fine...
Need your help on thisHello
When you use a local variable in a cursor, it's as if you had hard-coded literal in its place, you cannot use a variable to a column name.
If you know all the possible values for p_orderby, you can do something like this:
... ORDER BY TRIM ( CASE p_orderby WHEN 'DESC' THEN plano.desc WHEN 'VALUE' THEN plano.value ... END ) ASC;
If you don't know not all possible values, you can use dynamic SQL statements.
By the way
TRIM (x)
Returns the same results as
LTRIM ( RTRIM (x))
Maybe you are looking for
-
Satellite C660 Wireless stopped since the update of the BIOS 1.4
In fact, there is a thread on this same topic closed. But I would like to add something. My Satellite C660 is dual-boot. I have Ubuntu installed as well as Windows 7. Now, at the moment that I stupidly updated the bios to 1.4 the wireless doesn't wor
-
Hi when I start my laptot get this time on screen, c:window\system\spool\driver\x64\3lxcf time.dll ewry. lack of entry_run dllentry@16 it please can someone tell me what it is regarding
-
Said fan speed its 0% is this normal?
does the fan on my is the fan on my laptop always has to run or it while im using it? because it shows the speed of the fan its 0% what can I do?
-
ITunes, real player and wallet.
I just download a song from itunes plus. I use Real Player with my sansa fuze, so I opened it in there. I always go to change the information to make sure that the album art is there, that he was. So I downloaded the song to my rocket. Problem is tha
-
BlackBerry smartphone email sent to the alias address does not appear on BB
I have a University e-mail address ([email protected]) that works very well with my Blackberry. I also have an alias name in the same University ([email protected]) - a different format for the name of the address and the domain name, but its an