Best way to change TreeMap value?
Hello,
I am wondering what is the best way to change a value in a TreeMap? I have retrieved a value by .get on the key i.e.
String aString = (TreeMap) aTreeMap.get(aKey);but would now like to change aString and ?.put? it back into the map?
How would I do this?
Thank you,
Poot.
but would now like to change aString and ?.put? it
back into the map?Do I just have to keep a note on the (key,value) - especially key - change the value and then .put(key,value) back in? Though I'll need to remove the initial pairing if I do this since TreeMap won't allow duplicate keys!
There must be an easier way as this.
Thank you for your reply,
Regards,
Poot.
Similar Messages
-
Best way to change config then change it back after a while.
I spent some time today trying a couple approaches to this, but they all seemed a little klunky.
I'm looking for the best way to change the BGP prefixes which are advertised out to an ISP, based on some check. I want to set a timeout so the router won't attempt to send the route again for say 30 minutes after it is triggered, but then will start advertising it again, and monitor to see if the trigger condition returns. If the trigger condition returns then again withdrawl the route for 30 minutes and so on.
I'm using a prefix-list already to limit outbound route advertisments, so it seems simplest to just make a config change to remove one line in the prefix-list, then a few minutes later put it back.
I tried just using the "cli command wait", but if I set the wait period too long, the applet seemed to die, and never ran the later cli commands to put the prefix-list line back. There is also a exit-time clause for the event, but I couldn't figure out how to put the line back after the exit-time expired. Lastly I tried doing an event with a watchdog timer, but also couldn't get that to work either. Before I spend too much time working on differant options, I wanted to see if anyone had any recommendations.
I've done some TCL scripting on Cisco routers, but that seemed to be overkill for this, and I wanted to keep the config easy to manage for peers who might not be as proficient in TCL scripting.
This is intended for ASR-1002X routers if it matters.
Any suggestions would be much appreciated.
Thanks
DerekThanks for all your help Joe.
Ok, so here is my current script, which seems to be working pretty well (changing to entry-type "value" fixed the variability in detection times). For testing in the script below, I'm using a 30 second timeout for when the line gets put back, and a 60 second timeout for when monitoring should resume after the event is triggered. The script checks the value of the OID every 5 seconds.
The only other thing I would like to do with it that I can't figure out, is how to use an environment variable for the exit-time. Ideally, I would just add a value, like 10 seconds, to the ATimeout variable. However I can't figure out the syntax to just use a var for the exit-time. Anyone know the secret (or if it is possible?)
event manager environment ATimeout 30
event manager environment q "
no event manager applet DDOS_RESPONSE01
event manager applet DDOS_RESPONSE01
event snmp oid 1.3.6.1.4.1.9.9.166.1.17.1.1.21.80.65538 get-type exact entry-op gt entry-val "0" entry-type value exit-time 60 poll-interval 5
trigger
action 001 cli command "enable"
action 002 cli command "config term"
action 003 cli command "no ip prefix-list PUBLIC_NETWORKS seq 140 permit 10.4.1.0/24 le 32"
action 004 syslog msg "DDoS Attack Detected. Removing Web Srvr Subnet from PUBLIC_NETWORKS for ($ATimeout) seconds."
action 005 cli command "event manager applet RESTORE_PREFIX"
action 006 cli command "event timer countdown time $ATimeout "
action 007 cli command "action 101 cli command $q enable $q"
action 008 cli command "action 102 cli command $q config term $q"
action 009 cli command "action 103 cli command $q no event manager applet RESTORE_PREFIX $q"
action 010 cli command "action 104 cli command $q ip prefix-list PUBLIC_NETWORKS seq 140 permit 10.4.1.0/24 le 32$q"
action 011 cli command "action 105 syslog msg $q DDoS Attack Timeout ($ATimeout) reached. Re-adding Web Srvr Subnet to PUBLIC_NETWORKS. $q "
action 012 cli command "action 106 cli command $q no event manager applet RESTORE_PREFIX $q"
exit
event manager environment ATimeout 30
event manager environment q "
event manager applet DDOS_RESPONSE01
event snmp oid 1.3.6.1.4.1.9.9.166.1.17.1.1.21.80.65538 get-type exact entry-op gt entry-val "0" entry-type value exit-time 60 poll-interval 5
trigger
action 001 cli command "enable"
action 002 cli command "config term"
action 003 cli command "no ip prefix-list PUBLIC_NETWORKS seq 140 permit 10.4.1.0/24 le 32"
action 004 syslog msg "DDoS Attack Detected. Removing Web Srvr Subnet from PUBLIC_NETWORKS for ($ATimeout) seconds."
action 005 cli command "event manager applet RESTORE_PREFIX"
action 006 cli command "event timer countdown time $ATimeout "
action 007 cli command "action 101 cli command $q enable $q"
action 008 cli command "action 102 cli command $q config term $q"
action 009 cli command "action 103 cli command $q no event manager applet RESTORE_PREFIX $q"
action 010 cli command "action 104 cli command $q ip prefix-list PUBLIC_NETWORKS seq 140 permit 10.4.1.0/24 le 32$q"
action 011 cli command "action 105 syslog msg $q DDoS Attack Timeout ($ATimeout) reached. Re-adding Web Srvr Subnet to PUBLIC_NETWORKS. $q "
action 012 cli command "action 106 cli command $q no event manager applet RESTORE_PREFIX $q"
exit -
Best way to change fund posted in an EBS document
What is the best way to change the fund in one line item in a document produced when the electronic bank statment is processed? The bank charges fees that come through the statement and should post to a different fund then any other item such as checks, etc.
I am trying a substitution but coming across the error Field COBL-KOSTL. does not exist in the screen SAPLKACB 0002.The error message that I was receiving...Field COBL-KOSTL. does not exist in the screen SAPLKACB 0002, was coming from function module EXIT_RFEBBU10_001 and include ZXF01U01. The programming code was attempting to default a cost center when the external transaction code = 661. The coding was removed and the default acct assignment cost center was added to the cost element master data. The substitution also worked correctly as it should.
-
Newbie Quesion: Best way to change colour of a movie
Hi,
Could someone tell me the best way to change the colour of
one element of a
movieclip in AS2?
Say for example I had a filled white circle in the middle of
a black square,
how can I change just the colour of the circle?
I have tried this.myColor.setRGB( color ); but that sets the
entire clip to
be of one colour. Do I need ( as I suspect ) one clip on top
of another or
is there any way of keeping details of the clip being
changed?
TIA
WilCheers jdh,
This is one method I'd considered.
I'll give it a bash.
Wil
"jdh239" <[email protected]> wrote in
message
news:ens1vd$ahn$[email protected]..
> Don't know if this will help, but this code changes the
color of my
> "LOADING"
> text while it is loading. Should have the essential code
to do what you
> are
> looking for.
>
> Make the white circle a movie clip and pick the
following code apart to
> get it
> to change colors:
>
>
>
> stop();
> loading.gotoAndPlay(1);
> import flash.geom.ColorTransform;
> import flash.geom.Transform;
> var colorTrans:ColorTransform = new ColorTransform();
> var trans:Transform = new Transform(loading);
> trans.colorTransform = colorTrans;
> loadI = setInterval(loadF, 100);
> function loadF() {
> percent =
Math.floor(_root.getBytesLoaded()/_root.getBytesTotal()*100);
> if (percent<=39) {
> colorTrans.rgb = 0x0000FF;
> // blue
> trans.colorTransform = colorTrans;
> } else if ((percent>39) && (percent<60)) {
> colorTrans.rgb = 0x00FF00;
> // green
> trans.colorTransform = colorTrans;
> } else if ((percent>60) && (percent<80)) {
> colorTrans.rgb = 0xFF8000;
> // orange
> trans.colorTransform = colorTrans;
> } else if ((percent>80) && (percent<99)) {
> colorTrans.rgb = 0xFF0000;
> // red
> trans.colorTransform = colorTrans;
> } else if (percent>=99) {
> clearInterval(loadI);
> _root.gotoAndPlay(16);
> } else {
> loading.gotoAndPlay(1)
> }
> }
> -
Best way to extract XML value wiith an xpath
Hello,
I wonder what is the best way to extract text value from XmlType with an xpath.
I need to insert a row inside a table where the row's data come from xpath extractions of an XmlType. I do a lot of (approximative 20) :
EXTRACTVALUE(var.myxmltype , '/an/xpath/to/extract/elem1').
EXTRACTVALUE(var.myxmltype , '/an/xpath/to/extract/elemI').
EXTRACTVALUE(var.myxmltype , '/an/xpath/to/extract/elem20').
inside the insert statement
Is this way is the best or is there a more optimal way ?
For example extracting the node '/an/xpath/to/extract/' and sarting from this node extracting "elem1", ... , "elemI", "elemN" children.
Thanks for your help,
Regards,
NicolasHi Nicolas,
The answer depends on your actual storage method (binary, OR, CLOB?), and db version.
You can try XMLTable, it might be better in this case :
SELECT x.elem1, x.elem2, ... , x.elem20
FROM your_table t
, XMLTable(
'/an/xpath/to/extract'
passing t.myxmltype
columns elem1 varchar2(30) path 'elem1'
, elem2 varchar2(30) path 'elem2'
, elem20 varchar2(30) path 'elem20'
) x
; -
Best way to change partition key on existing table
Hi,
Using Oracle 11.20.3 on AIX.
We have a table about 800 million rows and 120gb in size.
Want to try copies oif this table to evalaute different partitiong strategies.
What is the quickest way to do this?
Would have liked say datapump table 1 tro disk and datapumo import the data to new table but do the tables need to be of the same format.
Thanks>
Using Oracle 11.20.3 on AIX.
We have a table about 800 million rows and 120gb in size.
Want to try copies oif this table to evalaute different partitiong strategies.
What is the quickest way to do this?
Would have liked say datapump table 1 tro disk and datapumo import the data to new table but do the tables need to be of the same format.
>
First your subject asks a different question that the text you posted: Best way to change partition key on existing table. The answer to that question is YOU CAN'T. All data has to be moved to change the partition key since each partition/subpartition is in its own segment. You either create a new table or use DBMS_REDEFINITION to redefine the table online.
Why do you want to export all data to a file first? That just adds to the time and cost of doing the op.
What problem are you trying to use partitioning to solve? Performance? Data maintenance? For performance the appropriate partitioning key and whether to use subpartitions depends on the types of queries and the query predicates you typically use as well as the columns that may be suitable for partition keys.
For maintenance a common method is to partition on a date by year/month/day so you can more easily load new daily/weekly/monthly data into its own partition or drop old data that no longer needs to be kept online.
You should use a small subset of the data when testing your partitionings strategies.
Can you do the partitioning offline in an outage window? If not then using the DBMS_REDEFINITION is your only option.
Without knowing what you are trying to accomplish only general advice can be given. You even mentioned that you might want to use a different set of columns than the curren table has.
A standard heap table uses ONE segment for its data (ignoring possible LOB segments). A partitioned/subpartitioned table uses ONE segment for each partition/subpartition. This means that ALL data must be moved to partition the table (unless you are only creating one partition).
This means that every partitioning scheme that uses a different partition key requires ALL data to be moved again for that test.
Provide some information about what problem you are trying to solve.
>
Is this quicker than datapump?
>
Yes - exporting the data simplying moves it all an additional time. Ok to export if you need a backup before you start.
>
Found artcle which talks about using merge option on datapump import to convert partitioned table to non-partitioned table.
>
How would that apply to you? That isn't what you said you wanted to do. -
Best way to get the values of local variables
What is currently the best way to get the values of local variables. I know it is not currently possible to set watchpoints on local variables, but what are the best workarounds?
You have to use StackFrame methods, eg, visibleVariables and getValues. To get a StackFrame for a thread, that thread has to be suspended, eg, by a BreakpointEvent.
-
Best Way to Change Source System Client
We initially had a ECC source client for BI as 35. But over time, we suffered with good test data because the ECC team use client 15 and not 35. We want to change BI 7 to use client 15. I have created a new source system in RSA1 for Client 15 but when I try to delete client 35 and /or change the source client on a datasource, all the data mappings are deleted!
I would really appreciate any advice or information on the best way to change the source R3 client for Bi without losing data mappings. Point awarded and much respect
Warm regards
Lee LewisHi,
Yes. There is a way to change the source system without deleting the old system. Please use the T.code BDLS and for more information refer the below link
Re: Changing a Source System.
OSS note 886102 will also give more information about this.
Hope it helps.
Thanks. -
Best way to change workstation
What is the best way to change the workstation name and import it into
edirectory.
We constantly have user change computer name. Most of the time when we
change the computer name it takes day to reflect on the edirectory. When
rename the workstation object, we cannot even remote to the workstation.
I have problem remote to through user name, I keep getting user does login
when in fact the user is login. We have netware 6.5 with the latest
service pack.Sang,
It appears that in the past few days you have not received a response to your
posting. That concerns us, and has triggered this automated reply.
Has your problem been resolved? If not, you might try one of the following options:
- Do a search of our knowledgebase at http://support.novell.com/search/kb_index.jsp
- Check all of the other support tools and options available at
http://support.novell.com.
- You could also try posting your message again. Make sure it is posted in the
correct newsgroup. (http://support.novell.com/forums)
Be sure to read the forum FAQ about what to expect in the way of responses:
http://support.novell.com/forums/faq_general.html
If this is a reply to a duplicate posting, please ignore and accept our apologies
and rest assured we will issue a stern reprimand to our posting bot.
Good luck!
Your Novell Product Support Forums Team
http://support.novell.com/forums/ -
Best way to change the speed of a sequence of linked short clips?
I have a sequenced project of about 150 short 1 second clips linked together via a crossfade transition... I would like to make the timelapse faster. What is the best way to change the speed of the sequence or the clips themselves? I would rather change the sequence for it would be less labor intensive I would imagine!!
Thanks
RDOr...select all the clips in the timeline, control-click (or right-click) on them and select 'Duration'. Change the duration to whatever will fit/fill the timespan you need, then hit OK.
If you're needing to change the dissolve as well, you should remove all but one of them first, then drag the remaining transition into the browser. Dbl-click it into the viewer, set the duration of what you want, then use the hand icon at top right and drag it back into the browser. Rename it relevent to it's new duration, then control-click on it and select "Make Default".
Now, set an inpoint at the first frame of your clips in the timeline, then drag all the shortened clips from the timeline into the canvas and release where it says 'Overwrite with Transition'.
That's another way to accomplish this.
K -
Best way to distribute configuration values to subVIs
I have a main VI with ~10 subVIs, all of which have a number of default constants embedded. I want to change my architecture so that all the constants are moved to a single ASCII text file which is not changed during program execution. I'm trying to decide the best way to do this:
- Read the file every time a subvi is opened (this is frequent).
- Use the "Read Key" function (this may be essentially the same).
- Read the file once at the beginning of execution, and store the values in a cluster which is passed to each subVI.
- Read the file once at the beginning of execution, and store the values in several clusters, passing only the needed values to a given subVI.
- Read the file once at the beginning of execution, and store the values in a functional (LV2) global which is read by each subVI when it is called.
I think all of these would work, but what would be the most efficient in terms of programming time, execution time, memory usage, and ease of future modification? I'm leaning toward the multiple clusters approach so that I'm not constantly reading a file each time a subVI opens.
Thanks to all,
JamesConsider using what I call a "manager" VI. Its purpose is to manage the file for you.
You call it whever you want to know one of these parameters.
It knows whether it's read the file yet or not. If not, it does so on first call.
After that, it simply keeps all your values in its own memory (shift registers).
When you call it, it simply gives you the value(s) out of its memory, either as a big cluster, or as separated values.
That way, you only read the file once.
Steve Bird
Culverson Software - Elegant software that is a pleasure to use.
Culverson.com
Blog for (mostly LabVIEW) programmers: Tips And Tricks -
[8i] Best way to replace "similar" values with one value...?
Below is some sample data:
Sorry for the large set / complex set of sample data, but there should be no need to go through it in detail =).
2 things to keep in mind:
1) This is an 8i db
2) I cannot create any new tables within this db, though I can create views
CREATE TABLE ord_master
( part_nbr CHAR(25)
, ord_nbr CHAR(10)
, sub_ord_nbr CHAR(3)
, ord_type CHAR(2)
, ord_stat CHAR(2)
, date_closed DATE
-- please note, though none of the columns in ord_master are explicitly defined as NOT NULL,
-- none of them are NULL in the db, and given how things are input into the table, I don't
-- even think it's possible
-- a unique order is described by ord_nbr, sub_ord_nbr. there should only be one record in
-- this table for a given unique combination of those columns, though they are not the p.k.
-- NOTE: dates default to 12/31/1900, so in the table above, if an order is still open (thus,
-- not closed), it's date_closed will be 12/31/1900. It will only change once the order closes.
INSERT INTO ord_master
VALUES ('ABC-123','1','1','AA','CL',TO_DATE('05/01/2009','mm/dd/yyyy'));
INSERT INTO ord_master
VALUES ('ABC-123','1','2','AA','CL',TO_DATE('9/14/2009','mm/dd/yyyy'));
INSERT INTO ord_master
VALUES ('ABC-123','2','1','AA','CL',TO_DATE('12/03/2009','mm/dd/yyyy'));
INSERT INTO ord_master
VALUES ('ABC-123','3','1','AA','OP',TO_DATE('12/31/1900','mm/dd/yyyy'));
INSERT INTO ord_master
VALUES ('ABC-123','4','1','AA','CL',TO_DATE('03/12/2004','mm/dd/yyyy'));
INSERT INTO ord_master
VALUES ('XYZ-123','5','1','AA','CL',TO_DATE('03/12/2004','mm/dd/yyyy'));
CREATE TABLE op_detail
( ord_nbr CHAR(10)
, sub_ord_nbr CHAR(3)
, major_seq_nbr CHAR(4)
, wctr_id CHAR(5)
, oper_stat CHAR(2)
, plan_su_rsrc NUMBER(5,2)
, plan_run_rsrc NUMBER(11,8)
, plan_subc_amt NUMBER(15,5)
, act_su_rsrc NUMBER(5,2)
, act_run_rsrc NUMBER(7,2)
, act_subc_amt NUMBER(15,2)
, act_start_dt DATE
, dt_completed DATE
, qty_planned NUMBER(13,4)
, qty_recvd NUMBER(13,4)
, qty_complete NUMBER(13,4)
, qty_scrap NUMBER(13,4)
, qty_on_hold NUMBER(13,4)
-- similar to ord_master, thought none of the columns are explicitly defined as NOT NULL,
-- none of the records have NULL values for any of these columns, and I don't think it's
-- really possible with the way the system is
INSERT INTO op_detail
VALUES ('1', '1', '0081', 'X516 ', 'CP', 0, 0, 0, 0, .2, 0, TO_DATE('02/03/2010', 'mm/dd/yyyy'), TO_DATE('02/03/2010', 'mm/dd/yyyy'), 3, 3, 3, 0, 0);
INSERT INTO op_detail
VALUES ('1', '1', '0324', 'Y000 ', 'CP', .1, .2, 0, 0, .87, 0, TO_DATE('04/06/2010', 'mm/dd/yyyy'), TO_DATE('04/06/2010', 'mm/dd/yyyy'), 3, 3, 3, 0, 0);
INSERT INTO op_detail
VALUES ('1', '1', '0170', 'X928 ', 'CP', 0, 0, 9.6, 0, 0, 159, TO_DATE('03/05/2010', 'mm/dd/yyyy'), TO_DATE('03/05/2010', 'mm/dd/yyyy'), 3, 3, 3, 0, 0);
INSERT INTO op_detail
VALUES ('1', '1', '0130', 'H211 ', 'CP', .5, .1, 0, .08, .63, 0, TO_DATE('02/10/2010', 'mm/dd/yyyy'), TO_DATE('02/10/2010', 'mm/dd/yyyy'), 3, 3, 3, 0, 0);
INSERT INTO op_detail
VALUES ('1', '2', '0120', 'H214 ', 'CP', .3, .05, 0, 0, .68, 0, TO_DATE('05/22/2009', 'mm/dd/yyyy'), TO_DATE('05/22/2009', 'mm/dd/yyyy'), 3, 3, 3, 0, 0);
INSERT INTO op_detail
VALUES ('1', '2', '0122', 'T203 ', 'CP', 2.5, 1, 0, .67, .3, 0, TO_DATE('05/28/2009', 'mm/dd/yyyy'), TO_DATE('05/28/2009', 'mm/dd/yyyy'), 3, 3, 3, 0, 0);
INSERT INTO op_detail
VALUES ('1', '2', '0130', 'H211 ', 'CL', .5, .1, 0, .67, .3, 0, TO_DATE('05/28/2009', 'mm/dd/yyyy'), TO_DATE('05/28/2009', 'mm/dd/yyyy'), 3, 3, 3, 0, 0);
INSERT INTO op_detail
VALUES ('1', '2', '0170', 'X928 ', 'CP', 0, 0, 9.6, 0, 0, 153.12, TO_DATE('06/10/2009', 'mm/dd/yyyy'), TO_DATE('06/10/2009', 'mm/dd/yyyy'), 3, 3, 3, 0, 0);
INSERT INTO op_detail
VALUES ('1', '2', '0324', 'Y000 ', 'CP', .1, .2, 0, 0, .08, 0, TO_DATE('06/17/2009', 'mm/dd/yyyy'), TO_DATE('06/17/2009', 'mm/dd/yyyy'), 3, 3, 3, 0, 0);
INSERT INTO op_detail
VALUES ('2', '1', '0081', 'X516 ', 'CL', 0, 0, 0, 0, 0, 0, TO_DATE('07/20/2009', 'mm/dd/yyyy'), TO_DATE('07/20/2009', 'mm/dd/yyyy'), 4, 4, 4, 0, 0);
INSERT INTO op_detail
VALUES ('2', '1', '0324', 'Y000 ', 'CL', .1, .2, 0, 0, 3.03, 0, TO_DATE('09/11/2009', 'mm/dd/yyyy'), TO_DATE('09/11/2009', 'mm/dd/yyyy'), 4, 4, 4, 0, 0);
INSERT INTO op_detail
VALUES ('2', '1', '0170', 'X928 ', 'CP', 0, 0, 9.6, 0, 0, 204.16, TO_DATE('08/11/2009', 'mm/dd/yyyy'), TO_DATE('08/11/2009', 'mm/dd/yyyy'), 4, 4, 4, 0, 0);
INSERT INTO op_detail
VALUES ('2', '1', '0130', 'H211 ','CP', .5, .1, 0, 1.97, 2.67, 0, TO_DATE('07/28/2009', 'mm/dd/yyyy'), TO_DATE('07/29/2009', 'mm/dd/yyyy'), 4, 4, 4, 0, 0);
INSERT INTO op_detail
VALUES ('3', '1', '0170', 'X928 ', 'CP', 0, 0, 9.6, 0, 0, 255.2, TO_DATE('11/06/2009', 'mm/dd/yyyy'), TO_DATE('11/06/2009', 'mm/dd/yyyy'), 5, 5, 5, 0, 0);
INSERT INTO op_detail
VALUES ('3', '1', '0130', 'H212 ', 'CP', .5, .1, 0, .6, .03, 0, TO_DATE('10/21/2009', 'mm/dd/yyyy'), TO_DATE('10/21/2009', 'mm/dd/yyyy'), 5, 5, 5, 0, 0);
INSERT INTO op_detail
VALUES ('3', '1', '0550', 'R501 ', 'WK', 1, 16, 0, 2.2, 12.4, 0, TO_DATE('05/19/2010', 'mm/dd/yyyy'), TO_DATE('12/31/1900', 'mm/dd/yyyy'), 5, 5, 5, 0, 0);
INSERT INTO op_detail
VALUES ('3', '1', '0324', 'Y000 ', 'CL', .1, .2, 0, 0, .07, 0, TO_DATE('02/04/2010', 'mm/dd/yyyy'), TO_DATE('02/04/2010', 'mm/dd/yyyy'), 5, 5, 5, 0, 0);
INSERT INTO op_detail
VALUES ('4', '1', '0324', 'Y000 ', 'CP', .1, .2, 0, 0, .59, 0, TO_DATE('02/06/2004', 'mm/dd/yyyy'), TO_DATE('02/06/2004', 'mm/dd/yyyy'), 4, 4, 4, 0, 0);This is the query I'm working with right now:
SELECT o.part_nbr
, s.major_seq_nbr AS op_nbr
, CASE -- CASE statement to replace similar-to wctr_id's with a single new wctr_id, so we can treat them as the same
WHEN s.wctr_id IN ('H211','H212')
THEN 'Z211'
ELSE s.wctr_id
END AS wctr
, MIN(s.plan_su_rsrc) AS min_plan_setup
, AVG(s.plan_su_rsrc) AS avg_plan_setup
, MAX(s.plan_su_rsrc) AS max_plan_setup
, STDDEV(s.plan_su_rsrc) AS sdev_plan_setup
, MIN(s.plan_run_rsrc) AS min_plan_run
, AVG(s.plan_run_rsrc) AS avg_plan_run
, MAX(s.plan_run_rsrc) AS max_plan_run
, STDDEV(s.plan_run_rsrc) AS sdev_plan_run
, MIN(s.plan_subc_amt) AS min_plan_subc
, AVG(s.plan_subc_amt) AS avg_plan_subc
, MAX(s.plan_subc_amt) AS max_plan_subc
, STDDEV(s.plan_subc_amt) AS sdev_plan_subc
, MIN(s.act_su_rsrc) AS min_act_setup
, AVG(s.act_su_rsrc) AS avg_act_setup
, MAX(s.act_su_rsrc) AS max_act_setup
, STDDEV(s.act_su_rsrc) AS sdev_act_setup
, MIN(s.act_run_rsrc) AS min_act_run
, AVG(s.act_run_rsrc) AS avg_act_run
, MAX(s.act_run_rsrc) AS max_act_run
, STDDEV(s.act_run_rsrc) AS sdev_act_run
, MIN(s.act_subc_amt) AS min_act_subc
, AVG(s.act_subc_amt) AS avg_act_subc
, MAX(s.act_subc_amt) AS max_act_subc
, STDDEV(s.act_subc_amt) AS sdev_act_subc
, MIN(s.act_start_dt) AS min_start
, MAX(s.act_start_dt) AS max_start
, MIN(s.dt_completed) AS min_comp
, MAX(s.dt_completed) AS max_comp
, MIN(s.qty_planned) AS min_qty_plan
, AVG(s.qty_planned) AS avg_qty_plan
, MAX(s.qty_planned) AS max_qty_plan
, STDDEV(s.qty_planned) AS sdev_qty_plan
, MIN(s.qty_recvd) AS min_qty_recvd
, AVG(s.qty_recvd) AS avg_qty_recvd
, MAX(s.qty_recvd) AS max_qty_recvd
, STDDEV(s.qty_recvd) AS sdev_qty_recvd
, MIN(s.qty_complete) AS min_qty_comp
, AVG(s.qty_complete) AS avg_qty_comp
, MAX(s.qty_complete) AS max_qty_comp
, STDDEV(s.qty_complete) AS sdev_qty_comp
, MIN(s.qty_scrap) AS min_qty_scrap
, AVG(s.qty_scrap) AS avg_qty_scrap
, MAX(s.qty_scrap) AS max_qty_scrap
, STDDEV(s.qty_scrap) AS sdev_qty_scrap
, MIN(s.qty_on_hold) AS min_qty_hold
, AVG(s.qty_on_hold) AS avg_qty_hold
, MAX(s.qty_on_hold) AS max_qty_hold
, STDDEV(s.qty_on_hold) AS sdev_qty_hold
, COUNT(*) AS rec_cnt
, CASE
WHEN a.ord_min_start > ADD_MONTHS(SYSDATE,-12)
THEN '12 mos. back'
WHEN a.ord_min_start > ADD_MONTHS(SYSDATE,-24)
THEN '24 mos. back'
WHEN a.ord_min_start > ADD_MONTHS(SYSDATE,-36)
THEN '36 mos. back'
ELSE '37 mos. back +'
END AS time_period
FROM ord_master o
, op_detail s
, ( -- begin in-line view a, to get the min act_start_dt for each order
SELECT s1.ord_nbr
, s1.sub_ord_nbr
, MIN (
CASE
WHEN s1.act_start_dt > TO_DATE('01/01/2000','mm/dd/yyyy')
THEN s1.act_start_dt
END
) AS ord_min_start
FROM op_detail s1
GROUP BY s1.ord_nbr
, s1.sub_ord_nbr
) a -- end in-line view a
WHERE o.ord_nbr = s.ord_nbr
AND o.sub_ord_nbr = s.sub_ord_nbr
AND o.ord_nbr = a.ord_nbr
AND o.sub_ord_nbr = a.sub_ord_nbr
AND o.ord_type = 'AA'
AND o.ord_stat IN ('CL','OP')
AND s.oper_stat IN ('CL','CP')
GROUP BY o.part_nbr
, s.major_seq_nbr
, CASE -- CASE statement to replace similar-to wctr_id's with a single new wctr_id, so we can treat them as the same
WHEN s.wctr_id IN ('H211','H212')
THEN 'Z211'
ELSE s.wctr_id
END
, CASE
WHEN a.ord_min_start > ADD_MONTHS(SYSDATE,-12)
THEN '12 mos. back'
WHEN a.ord_min_start > ADD_MONTHS(SYSDATE,-24)
THEN '24 mos. back'
WHEN a.ord_min_start > ADD_MONTHS(SYSDATE,-36)
THEN '36 mos. back'
ELSE '37 mos. back +'
END
ORDER BY o.part_nbr
, CASE
WHEN a.ord_min_start > ADD_MONTHS(SYSDATE,-12)
THEN '12 mos. back'
WHEN a.ord_min_start > ADD_MONTHS(SYSDATE,-24)
THEN '24 mos. back'
WHEN a.ord_min_start > ADD_MONTHS(SYSDATE,-36)
THEN '36 mos. back'
ELSE '37 mos. back +'
END
, s.major_seq_nbrThis gives me a bunch of descriptive statistics on some data stored in the database, broken into groups by the time period.
I have 7 sets of possible values for the column wctr_id that are groups of similar/same work centers, and should be treated as the same, assuming the ord_nbr, sub_ord_nbr, and major_seq_nbr are the same. In my example case statement above, anytime I find 'H211' or 'H212', I am replacing it with 'Z211', which is my new, unique identifier for any wctr in the group ('H211', 'H212'). I have 7 of these sorts of groups that need to be replaced by a new, unique identifier. Is my CASE statement (noted above) the best way to do this, or is there a better way? These groups of similar-to wctr_id's are not listed in a table anywhere.Hi,
As always, thanks for posting the CREATE TABLE and INSERT statements; that's very helpful, and leads to faster, better solutions.
Another thing that is helpful, and promotes faster, better solutions, is to simplify your problem.
For example, you have to compute a lot of aggregates, but it looks like you already know how to do that. This problem only involves the CASE expressions, and how they interact with the GROUP BY clause. So just cut out most of the aggregate functions.
Also, it looks like the intricacies of in-line view a have nothing to do with your current problem. For purposes of posting this problem, pretend that a is a regular view, so it doesn't clutter up the main query.
I think your problem could be restated like this:
You already have a query like this:
CREATE OR REPLACE VIEW a
AS
SELECT s1.ord_nbr
, s1.sub_ord_nbr
, MIN (
CASE
WHEN s1.act_start_dt > TO_DATE('01/01/2000','mm/dd/yyyy')
THEN s1.act_start_dt
END
) AS ord_min_start
FROM op_detail s1
GROUP BY s1.ord_nbr
, s1.sub_ord_nbr
SELECT o.part_nbr
, s.major_seq_nbr AS op_nbr
, CASE -- CASE statement to replace similar-to wctr_id's with a single new wctr_id, so we can treat them as the same
WHEN s.wctr_id IN ('H211','H212')
THEN 'Z211'
ELSE s.wctr_id
END AS wctr
, MIN(s.plan_su_rsrc) AS min_plan_setup
-- lots of other agtgregates go here in real query
, CASE
WHEN a.ord_min_start > ADD_MONTHS(SYSDATE,-12)
THEN '12 mos. back'
WHEN a.ord_min_start > ADD_MONTHS(SYSDATE,-24)
THEN '24 mos. back'
WHEN a.ord_min_start > ADD_MONTHS(SYSDATE,-36)
THEN '36 mos. back'
ELSE '37 mos. back +'
END AS time_period
FROM ord_master o
, op_detail s
, a -- in real query, a is an in-line view
WHERE o.ord_nbr = s.ord_nbr
AND o.sub_ord_nbr = s.sub_ord_nbr
AND o.ord_nbr = a.ord_nbr
AND o.sub_ord_nbr = a.sub_ord_nbr
AND o.ord_type = 'AA'
AND o.ord_stat IN ('CL','OP')
AND s.oper_stat IN ('CL','CP')
GROUP BY o.part_nbr
, s.major_seq_nbr
, CASE -- CASE statement to replace similar-to wctr_id's with a single new wctr_id, so we can treat them as the same
WHEN s.wctr_id IN ('H211','H212')
THEN 'Z211'
ELSE s.wctr_id
END
, CASE
WHEN a.ord_min_start > ADD_MONTHS(SYSDATE,-12)
THEN '12 mos. back'
WHEN a.ord_min_start > ADD_MONTHS(SYSDATE,-24)
THEN '24 mos. back'
WHEN a.ord_min_start > ADD_MONTHS(SYSDATE,-36)
THEN '36 mos. back'
ELSE '37 mos. back +'
END
ORDER BY o.part_nbr
, CASE
WHEN a.ord_min_start > ADD_MONTHS(SYSDATE,-12)
THEN '12 mos. back'
WHEN a.ord_min_start > ADD_MONTHS(SYSDATE,-24)
THEN '24 mos. back'
WHEN a.ord_min_start > ADD_MONTHS(SYSDATE,-36)
THEN '36 mos. back'
ELSE '37 mos. back +'
END
, s.major_seq_nbr
;that produces this output:
` MIN_
PLAN_
PART_NBR OP_N WCTR SETUP TIME_PERIOD
ABC-123 0081 X516 .0 12 mos. back
ABC-123 0130 Z211 .5 12 mos. back
ABC-123 0170 X928 .0 12 mos. back
ABC-123 0324 Y000 .1 12 mos. back
ABC-123 0120 H214 .3 24 mos. back
ABC-123 0122 T203 2.5 24 mos. back
ABC-123 0130 Z211 .5 24 mos. back
ABC-123 0170 X928 .0 24 mos. back
ABC-123 0324 Y000 .1 24 mos. back
ABC-123 0324 Y000 .1 37 mos. back +The output is correct; the problem is, can we get the same results without 2 copies of the wctr CASE expression, and 3 copies of the time_period CASE expression?
Is that a fair description of the problem?
For starters, you can use column aliases in the ORDER BY clause. Unfortunately, that's the only place where you can use column aliases in the same query where they are defined . You can compute them in a sib-query, and then use them in super-queries.
In other words, wouldn't it be nice if we had a table just like op_detail, but with an additional column called wctr? Make a view: either a regular view (especially if wctr, computed the same way, will be used in several different queries) or an in-line view, as shown below.
Wouldn't it be great if there was a table that was just like a, except that it had time_period alreay computed? Make a view: either a regular view or an in-line view, as shown below.
SELECT o.part_nbr
, s.major_seq_nbr AS op_nbr
, s.wctr
, MIN(s.plan_su_rsrc) AS min_plan_setup
-- lots of other agtgregates go here in real query
, a2.time_period
FROM ord_master o
, ( -- Begin in-line view s, with data from op_detail
SELECT op_detail.* -- or list all columns needed in main query
, CASE -- replace similar-to wctr_id's with a single new wctr_id, so we can treat them as the same
WHEN wctr_id IN ('H211','H212')
THEN 'Z211'
ELSE wctr_id
END AS wctr
FROM op_detail
) s -- End in-line view s, with data from op_detail
, ( -- Begin in-line view a2, to compute time_period
SELECT a.*
, CASE
WHEN ord_min_start > ADD_MONTHS(SYSDATE,-12)
THEN '12 mos. back'
WHEN ord_min_start > ADD_MONTHS(SYSDATE,-24)
THEN '24 mos. back'
WHEN ord_min_start > ADD_MONTHS(SYSDATE,-36)
THEN '36 mos. back'
ELSE '37 mos. back +'
END AS time_period
FROM a -- in real query, a is an in-line view
) a2 -- End in-line view a2, to compute time_period
WHERE o.ord_nbr = s.ord_nbr
AND o.sub_ord_nbr = s.sub_ord_nbr
AND o.ord_nbr = a2.ord_nbr
AND o.sub_ord_nbr = a2.sub_ord_nbr
AND o.ord_type = 'AA'
AND o.ord_stat IN ('CL','OP')
AND s.oper_stat IN ('CL','CP')
GROUP BY o.part_nbr
, s.major_seq_nbr
, s.wctr
, a2.time_period
ORDER BY o.part_nbr
, a2.time_period
, s.major_seq_nbr
;In your example, wctr is the same as wctr_id except for two values. If it was more complicated (e.g., if there were not just 2 values that need to be mapped to 'Z211', but also 3 values to were equivalent to 'Z987', and 1 that was to be treated like 'A012', and 5 that should appear as 'A666', and ...), then you could code all that in a humongeous CASE expression (a nested CASE expression, if it involves more that 128 branches), but it really belongs in a table, where you have the raw wctr_id (like 'H211') in one column, and its corresponding equivalent (such as 'Z211') in another. I know you said you can't create new tables; I'm just pointing this out so you can tell the people who won't let you create new tables that it's a bad idea, likely to cause errors and certain to waste time in the future. -
Best way to change up to 20 controls on the main VI from a subVI
Hi Community,
I have been searching for a good solution for this all day but couldn't come up with anything good. I have around 20 controls on my main VI. I need to access / change their properties from a subVI. ALL the controls are inside a Cluster. I know I can create a reference for all my controls put them in a cluster or array and link it into my subvi ... However this way I end up with a lot of icons on my block diagram ... Does anyone know I better solution to my problem?
Thx you for your support
JanHi Jan,
I'm not sure if I clearly understand your problem...
It's possible to use the reference to the cluster on the main VI front panel as an input of the sub VI : in the simple attached example, the sub VI changes the values of the numeric controls in the cluster in the main VI.
Best regards,
HL
PS. Sorry, it's a french version of LabVIEW
Attachments:
Main VI.vi 7 KB
Sub VI.vi 8 KB
Example.png 46 KB -
Best way to check boolean value
Hi!
I have a schema defining an XML element with a boolean attribute. The document related to this schema use true/false literal boolean values, eg:
<myelement myattribute="false"/>....<myelement myattribute="true"/>
The data is stored in binary xml storage.
I query the db on the boolean attribute with an xpath condition like this:
..../myelement[@myattribute=false()]
Querying the db with this method:
SELECT XMLQuery('....' returning content) from dual
all works as expected.
Instead, using:
SELECT XMLQuery('....' ' PASSING OBJECT_VALUE RETURNING CONTENT)
FROM "myxmltable"
WHERE XMLExists('....' PASSING OBJECT_VALUE);
I get the error: ORA-31038: Invalid hexBinary value: "false"
To get the second query method working, I have to change the xpath condition, forcing a string comparison:
..../myelement[string(@myattribute)="false"]
Can someone explain me this behaviour? What is the best way to check a boolean value? I'd like to write the same xquery working in both methods!
Thank you.
Bye
MirkoHi Geoff
here the schema:
<xs:schema xmlns:tns="http://OracleTest" xmlns:xdb="http://xmlns.oracle.com/xdb" elementFormDefault="qualified" targetNamespace="http://OracleTest" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:complexType name="MyComplexType">
<xs:sequence>
<xs:element minOccurs="0" name="FirstChild">
<xs:complexType>
<xs:attribute name="A" type="xs:string" />
<xs:attribute name="B" type="xs:string" />
</xs:complexType>
</xs:element>
<xs:element minOccurs="0" name="SecondChild">
<xs:complexType>
<xs:attribute name="S" type="xs:string" />
<xs:attribute name="B" type="xs:boolean" />
<xs:attribute name="I" type="xs:integer" />
</xs:complexType>
</xs:element>
<xs:element minOccurs="0" name="ThirdChild">
<xs:complexType>
<xs:sequence>
<xs:element minOccurs="0" name="ThirdChildA">
<xs:complexType>
<xs:attribute name="A" type="xs:string" />
<xs:attribute name="B" type="xs:string" />
</xs:complexType>
</xs:element>
<xs:element minOccurs="0" name="ThirdChildB">
<xs:complexType>
<xs:attribute name="C" type="xs:string" />
<xs:attribute name="D" type="xs:string" />
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute name="ID" type="xs:string" />
</xs:complexType>
<xs:element xdb:defaultTable="MyElement" name="MyElement" type="tns:MyComplexType" />
</xs:schema>
and here two sample XML documents:
<tns:MyElement ID="ID1" xmlns:tns="http://OracleTest" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://OracleTest http://OracleTest.xsd">
<tns:FirstChild A="a" B="b" />
<tns:SecondChild S="s" B="true" I="1" />
<tns:ThirdChild>
<tns:ThirdChildA A="aa" B="bb" />
<tns:ThirdChildB C="cc" D="dd" />
</tns:ThirdChild>
</tns:MyElement>
<tns:MyElement ID="ID2" xmlns:tns="http://OracleTest" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://OracleTest http://OracleTest.xsd">
<tns:FirstChild A="aa" B="bb" />
<tns:SecondChild S="ss" B="false" I="2" />
<tns:ThirdChild>
<tns:ThirdChildA A="aaaa" B="bbbb" />
<tns:ThirdChildB C="cccc" D="dddd" />
</tns:ThirdChild>
</tns:MyElement>
I registered the schema using Enterprise Manager. The "Show SQL" function returned this script:
BEGIN
DBMS_XMLSCHEMA.REGISTERSCHEMA(
schemaurl => 'http://OracleTest.xsd',
schemadoc => sys.UriFactory.getUri('/Testing/test.xsd'),
local => FALSE,
gentypes => FALSE,
genbean => FALSE,
gentables => TRUE,
force => FALSE,
owner => 'EMILIAROMAGNABUY',
OPTIONS => DBMS_XMLSCHEMA.REGISTER_BINARYXML);
END;
This is my test script:
-- This works fine: returns only the requested row.
SELECT XMLQuery('declare default element namespace "http://OracleTest"; collection("/Testing")/MyElement/SecondChild[@B=true()]' returning content) from dual;
-- This raises the error = SQL Error: ORA-31038: Invalid hexBinary value: "true"
select xmlquery('declare default element namespace "http://OracleTest"; /MyElement/SecondChild[@B=true()]' passing object_value returning content).getclobval() from "MyElement";
-- This doesn't work correctly: returns the requested row and two empty rows ?!? I don't like this cast, anyway.
select xmlquery('declare default element namespace "http://OracleTest"; /MyElement/SecondChild[string(@B)="true"]' passing object_value returning content).getclobval() from "MyElement";
Thank you
Mirko -
Best way to use return values in a webservices
Hi all,
Scenario: We have three web services. What is the best way to do this acitivity or is it possible?
webservice1
webservice2
webservice3
Call invoke webservice1 & 2 (they need to their work do be done parallely and will return a value eg "string")and call webservices3 with input values as the returned value from webservice 1 & 2.
Thanks,
Shashi
Edited by: Shashi_sr on Sep 17, 2010 1:46 PMHi Shashi,
The way to achieve your desired functionality is as follows:
Create a flow activity, and within that flow activity, you will call web services (using an invoke activity) webservice1 and webservice2.
After the flow activity, you will then use another invoke activity to call the 3rd webservice using the output given by the first 2 webservices.
Maybe you are looking for
-
I have been trying to download a charter toolbar but it does not show up on the homepage along with the other toolbars. When I go to tools it does appear on the add on tab.
-
After I burn a disk in idvd onto an imation dvd-r (8x), I get the message - "device drained it's buffer without burn underrun protection". What does this mean? When I play the dvd's on the mac they work great, but on my own dvd player, they stop, hes
-
Reporting on Multi Select Picklists
According to Doc ID 553362.1 Multi Value Picklists are available for Custom Reports. However, it does not appear in the list of fields in my Custom Object #2 reporting and/or analytics area. Can someone confirm they are available for reporting. Thank
-
I am a new customer with Verizon and have encountered a sticky situation. Started my service August 11th and take ownership for going over with my data but on August 18th went to the emergency room and was admitted to the hospital August 19th. During
-
Call function SXMB_SELECT_MESSAGES - determine message type
After calling function SXMB_SELECT_MESSAGES, you get the following information in the return structure. How do you determine the message type based upon this information? Programatically (table name or functions)? outbound system,outbound namespace,o