Trouble with nested foreach loop

I got 3 nested foreach loop but the 2nd and the third one outputs no data.
$vss = "vSwitch3"
$vmhost_array = @("host1,host2,host3")
$vss_vlan_array = @("vlan50")
$dvs_vlan_array = @("n1kv_vms_vlan50")
foreach ($vmhost in $vmhost_array) {
foreach ($vss_vlan in $vss_vlan_array) {
foreach ($dvs_vlan in $dvs_vlan_array) {
Get-VMHost $vmhost | Get-VirtualSwitch -Name $vss | Get-VirtualPortGroup -Name $vss_vlan | Get-VM | Get-NetworkAdapter | Set-NetworkAdapter -Portgroup $dvs_vlan -Confirm:$false
I get runtime error at Get-VirtualSwitch -Name $vss 
$vss says vlan50 not found. but its there. anything wrong with this nested foreach?

hi
I am actually getting an error on 
Get-VirtualPortGroup -Name $($vss_vlan_array[$i])
Its trying to give me the whole array instead of the 1st item in the array. so get-virtualportgroup will fail.
I checked it with $vss_vlan_array[0] and gives me 
"vlan50","vlan49"
how do one item at a time instead of the whole array?

Similar Messages

  • Issues with nested for loops - saving images from a camera

    Hi all,
    I've written a vi. to capture a specific number of images ('Image No') and save these images, outputted to a folder of my choice.  Each image is identified sequentially.  However, I wish to do a number of iterations ('Run') of this capture sequence, such that the filename of each image would be 'Filename (Run)_(Image No).png', e.g. run 5, image 10 would be 'Filename 5_10.png'.  I have tried a nested for loop for this but I receive an error 'Asynchronous I/O operation in progress' (I've attached a printscreen).
    Can anyone assist me in solving this problem? I preiously posted this in machine Vision but got no response (http://forums.ni.com/t5/Machine-Vision/Capturing-image-sequences-issues-with-nested-for-loops/m-p/19...).  Please find attached my vi.
    Kindest regards and thanks,
    Miika
    Solved!
    Go to Solution.
    Attachments:
    Labview problem.jpg ‏3841 KB
    Image sequence save to file.vi ‏48 KB

    Miika,
    the problem is not the filenam, but the name of the folder (AHHHHH!). You try to create the same folder in the outer for loop over and over again.... (it is the error message above the '======', not below )
    Norbert
    CEO: What exactly is stopping us from doing this?
    Expert: Geometry
    Marketing Manager: Just ignore it.

  • Nested foreach loops

    On a jsp page, I am trying to iterate though one list via c:foreach, and use the values from this iteration to loop through a second foreach loop. Is it possible to dynamically use the iterator object value to access another hashmap or hashtable?
    Like:
    <c:forEach items="${authors}" var="o">
      <c:out value="${o.name}"/>
    //  then get books by that author
      <c:forEach items="${authorBooks[${o.id}]" var="d">Where authors is a list of author objects with propertyies id, and name. And authorBooks is a Hashtable which has authorId as key values, the data is a list of books for that author.

    It is probably an issue with types.
    Is the type of the object you are looking up on, the same as the type that you created the hashmap with?
    This code might help with debugging:
    <c:out value="The type of o.id = ${o.id}"/></br>
    <c:forEach var="entry" items="${authorBooks}">
      <c:out value="Entry ${entry.key} = ${entry.value}.   Type of key is ${entry.key.class}"/><br>
    </c:forEach>

  • Capturing image sequences - issues with nested for loops

    Hi all,
    I've written a vi. to capture a specific number of images ('Image No') and save these images, outputted to a folder of my choice.  Each image is identified sequentially.  However, I wish to do a number of iterations ('Run') of this capture sequence, such that the filename of each image would be 'Filename (Run)_(Image No).png', e.g. run 5, image 10 would be 'Filename 5_10.png'.  I have tried a nested for loop for this but I receive an error 'Asynchronous I/O operation in progress' (I've attached a printscreen).
    Can anyone assist me in solving this problem?  Please find attached my vi.
    Kindest regards and thanks,
    Miika
    Solved!
    Go to Solution.
    Attachments:
    Image sequence save to file.vi ‏48 KB
    Labview problem.jpg ‏3841 KB

    Hi,
    You cannot create a folder if this one is already existing.
    Just check that the folder exists before creating it.
    Regards

  • Having Trouble with nested Case Statements

    Hi Folks,
    I'm having trouble getting my head round nested case statements. For the life of me I cannot see what I'm missing here (unless my approach is all wrong).
    Any help much appreciated.
    Script:
    set serveroutput on format wrapped
    set feedback off
    set linesize 150
    DECLARE
    /* Set supported version here */
    ora_version VARCHAR2(4);
    unsupp_version EXCEPTION;
    /* Archive Log Info */
    db_log_mode VARCHAR2(12);
    BEGIN
    SELECT SUBSTR(VERSION, 1, 4)
    INTO ora_version
    FROM v$instance;
    SELECT log_mode
    INTO db_log_mode
    FROM v$database;
    CASE
    WHEN ora_version = '10.2' THEN
    DECLARE
    TYPE t_db IS RECORD(
    dflsh VARCHAR2(3),
    dcscn NUMBER);
    v_db t_db;
    BEGIN
    CASE
    WHEN db_log_mode = 'ARCHIVELOG' THEN
    EXECUTE IMMEDIATE 'SELECT INITCAP(flashback_on), current_scn FROM v$database'
    INTO v_db;
    DBMS_OUTPUT.PUT_LINE(' Flashback On : ' || v_db.dflsh);
    DBMS_OUTPUT.PUT_LINE(' Current SCN : ' || v_db.dcscn);
    DBMS_OUTPUT.PUT_LINE(' Log Mode : ' || db_log_mode);
    DBMS_OUTPUT.PUT_LINE(' Version : ' || ora_version);
    END;
    ELSE
    DBMS_OUTPUT.PUT_LINE(' Log Mode : ' || db_log_mode);
    DBMS_OUTPUT.PUT_LINE(' Version : ' || ora_version);
    END CASE;
    END;
    WHEN ora_version = '9.2' THEN
    DECLARE
    TYPE t_db IS RECORD(
    dcscn NUMBER);
    v_db t_db;
    BEGIN
    CASE
    WHEN db_log_mode = 'ARCHIVELOG' THEN
    EXECUTE IMMEDIATE 'SELECT current_scn FROM v$database'
    INTO v_db;
    DBMS_OUTPUT.PUT_LINE(' Current SCN : ' || v_db.dcscn);
    DBMS_OUTPUT.PUT_LINE(' Log Mode : ' || db_log_mode);
    DBMS_OUTPUT.PUT_LINE(' Version : ' || ora_version);
    END;
    ELSE
    DBMS_OUTPUT.PUT_LINE(' Log Mode : ' || db_log_mode);
    DBMS_OUTPUT.PUT_LINE(' Version : ' || ora_version);
    END CASE;
    END;
    ELSE
    RAISE unsupp_version;
    END CASE;
    EXCEPTION
    WHEN unsupp_version THEN
    DBMS_OUTPUT.PUT_LINE('');
    DBMS_OUTPUT.PUT_LINE(' Unsupported Version '||ora_version||' !');
    DBMS_OUTPUT.PUT_LINE('');
    END;
    set linesize 80
    set feedback on
    set serveroutput off
    Gives errors:
    END;
    ERROR at line 31:
    ORA-06550: line 31, column 7:
    PLS-00103: Encountered the symbol ";" when expecting one of the following:
    case
    ORA-06550: line 37, column 1:
    PLS-00103: Encountered the symbol "WHEN"
    ORA-06550: line 50, column 28:
    PLS-00103: Encountered the symbol ";" when expecting one of the following:
    case
    Edited by: milkyjoe on 28-Apr-2010 05:38

    Hi,
    Never write, much less post, unformatted code.
    Indent the code to show the extent of multi-line structures like BEGIN and CASE.
    For example:
    DECLARE
         /* Set supported version here */
         ora_version       VARCHAR2 (4);
         unsupp_version       EXCEPTION;
         /* Archive Log Info */
         db_log_mode      VARCHAR2 (12);
    BEGIN
         SELECT     SUBSTR(VERSION, 1, 4)
         INTO     ora_version
         FROM     v$instance;
         SELECT     log_mode
         INTO     db_log_mode
         FROM     v$database;
         CASE
             WHEN  ora_version = '10.2' THEN
              DECLARE
                  TYPE t_db IS RECORD(
                             dflsh     VARCHAR2(3),
                             dcscn      NUMBER);
                  v_db t_db;
              BEGIN
                  CASE
                      WHEN db_log_mode = 'ARCHIVELOG' THEN
                       EXECUTE IMMEDIATE 'SELECT INITCAP(flashback_on), current_scn FROM v$database'
                                           INTO v_db;
                       DBMS_OUTPUT.PUT_LINE(' Flashback On : ' || v_db.dflsh);
                       DBMS_OUTPUT.PUT_LINE(' Current SCN : ' || v_db.dcscn);
                       DBMS_OUTPUT.PUT_LINE(' Log Mode : ' || db_log_mode);
                       DBMS_OUTPUT.PUT_LINE(' Version : ' || ora_version);
                  END;
    ...The code above is what you posted, with some whitespace added.
    The error is much clearer; the last CASE statement concludes with END, but CASE blocks always have to conclude with END CASE .
    Why are you using a nested BEGIN block in the code above? Are you plannning to add an EXCEPTION handler later?
    When posting formatted text on this site, type these 6 characters:
    \(small letters only, inside curly brackets) before and after each section of formatted text, to preserve spacing.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • Powershell - Daily disk and folder usage; trouble with code to loop through the individual folders

    Hi,
    I'm very new to Powershell but through the help of this forum and the help on the internet I have scraped together a script that will loop through the disks of a set of servers listed in a text document, and give the capacity statistics in html
    format.
    I have two questions. I've tried modifying this to also loop though the individual folders on each disk and give the amount of space used to no avail. does any one have any suggestions?
    Secondly, how do I get this to append? all I want to do is set up a scheduled task that runs this report daily. I know I will need to add a date column, but I just want the data to append to the previous set of results.
    Thanks for any advice in advance.
    # Continue even if there are errors
    $ErrorActionPreference = "Continue";
    # Set your warning and critical thresholds
    $percentWarning = 100;
    $percentCritcal = 15;
    # REPORT PROPERTIES
    # Path to the report
    $reportPath = "C:\";
    # Report name
    $reportName = "DiskSpaceReport_$(get-date -format ddMMyyyy).html";
    # Path and Report name together
    $diskReport = $reportPath + $reportName
    #Set colors for table cell backgrounds
    $redColor = "#FF0000"
    $orangeColor = "#FBB917"
    $whiteColor = "#FFFFFF"
    # Count if any computers have low disk space. Do not send report if less than 1.
    $i = 0;
    # Get computer list to check disk space
    $computers = Get-Content "C:\serverlist.txt";
    $datetime = Get-Date -Format "dd-MM-yyyy_HHmmss";
    # Create and write HTML Header of report
    $titleDate = get-date -uformat "%d-%m-%Y - %A"
    $header = "
    <html>
    <head>
    <meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'>
    <title>DiskSpace Report</title>
    <STYLE TYPE='text/css'>
    <!--
    td {
    font-family: Calibri;
    font-size: 12px;
    border-top: 1px solid #999999;
    border-right: 1px solid #999999;
    border-bottom: 1px solid #999999;
    border-left: 1px solid #999999;
    padding-top: 0px;
    padding-right: 0px;
    padding-bottom: 0px;
    padding-left: 0px;
    body {
    margin-left: 5px;
    margin-top: 5px;
    margin-right: 0px;
    margin-bottom: 10px;
    table {
    border: thin solid #000000;
    -->
    </style>
    </head>
    <body>
    <table width='100%'>
    <tr bgcolor='#0B6121'>
    <td colspan='7' height='30' align='center'>
    <font face='calibri' color='#E0F8F7' size='4'><strong>Daily Disk Utilization Report for $titledate</strong></font>
    </td>
    </tr>
    </table>
    Add-Content $diskReport $header
    # Create and write Table header for report
    $tableHeader = "
    <table width='100%'><tbody>
    <tr bgcolor=#E0F8F7>
    <td width='10%' align='center'>Server</td>
    <td width='5%' align='center'>Drive</td>
    <td width='15%' align='center'>Drive Label</td>
    <td width='10%' align='center'>Total Capacity(GB)</td>
    <td width='10%' align='center'>Used Capacity(GB)</td>
    <td width='10%' align='center'>Free Space(GB)</td>
    <td width='5%' align='center'>Freespace %</td>
    <td width='5%' align='center'>RAM %</td>
    <td width='5%' align='center'>CPU %</td>
    </tr>
    Add-Content $diskReport $tableHeader
    # Start processing disk space
    foreach($computer in $computers)
    $disks = Get-WmiObject -ComputerName $computer -Class Win32_LogicalDisk -Filter #"DriveType = 3"
    $computer = $computer.toupper()
    foreach($disk in $disks)
    $deviceID = $disk.DeviceID;
    $volName = $disk.VolumeName;
    [float]$size = $disk.Size;
    [float]$freespace = $disk.FreeSpace;
    $percentFree = [Math]::Round(($freespace / $size) * 100);
    $sizeGB = [Math]::Round($size / 1073741824, 2);
    $freeSpaceGB = [Math]::Round($freespace / 1073741824, 2);
    $usedSpaceGB = $sizeGB - $freeSpaceGB;
    $color = $whiteColor;
    # Start processing RAM
    $RAM = Get-WmiObject -ComputerName $computer -Class Win32_OperatingSystem
    $RAMtotal = $RAM.TotalVisibleMemorySize;
    $RAMAvail = $RAM.FreePhysicalMemory;
    $RAMpercent = [Math]::Round(($RAMavail / $RAMTotal) * 100);
    # Set background color to Orange if just a warning
    if($percentFree -lt $percentWarning)
    $color = $orangeColor
    # Set background color to Orange if space is Critical
    if($percentFree -lt $percentCritcal)
    $color = $redColor
    # Create table data rows
    $dataRow = "
    <tr>
    <td width='10%'>$computer</td>
    <td width='5%' align='center'>$deviceID</td>
    <td width='10%' >$volName</td>
    <td width='10%' align='center'>$sizeGB</td>
    <td width='10%' align='center'>$usedSpaceGB</td>
    <td width='10%' align='center'>$freeSpaceGB</td>
    <td width='5%' bgcolor=`'$color`' align='center'>$percentFree</td>
    <td width='5%' align='center'>$RAMpercent</td>
    <td width='5%' align='center'>$CPUpercent</td>
    </tr>
    Add-Content $diskReport $dataRow;
    Write-Host -ForegroundColor DarkYellow "$computer $deviceID percentage free space = $percentFree";
    $i++
    # Create table at end of report showing legend of colors for the critical and warning
    $tableDescription = "
    </table><br><table width='20%'>
    <tr bgcolor='White'>
    <td width='10%' align='center' bgcolor='#FBB917'>No Warning</td>
    <td width='10%' align='center' bgcolor='#FF0000'>Critical less than 10% free space</td>
    </tr>
    Add-Content $diskReport $tableDescription
    Add-Content $diskReport "</body></html>"

    The only easy way to create a report like this that accumulates is to design it so the data is output to a CSV file or a database.  YOu can then generate the HTML from the persist6ed data.
    If you store as XML you can use XSLT (transform) to convert to an HTML report.
    I also recommend uing Excel as an HTML report generator.  It is much easier and more flexible.  PowerShell is not intended to do what you want without designing a whole custom reporting system.
    Use the right tool for the right task.
    Just because you own a hammer does not mean that the solution to every problem includes a nail.
    ¯\_(ツ)_/¯

  • Trouble with Menu and Looping

    I have Encore CS6.  I created a Blu Ray Project.  720  50p.   the Preset is H264.   I have two Menus in the Project and each have an Audio of 21 Secs. Duration pickwhiped, and Set to forever in the Properties  Motion tab.  The Menus are PSD and White in colour.  When the Project is Burned to Blu Ray Disc both menus at the 21 sec mark go to Black frames and I can see the Underlined Highlight only for about .9 of a second. How can I get rid of those Black frames and get the Menus to loop properly.
    kind regards,
    Brendan
    Ps. How long does it take to get a reply on this Forum.
    I have returned to this forum on numerous occasions, but not anymore, as it looks like Adobe are not interested in resolving problems for their customers.    I will also be returning the CS6 Production Premium which I paid good money for. I am not going to put up with being mistreated like this anymore.
    Message was edited by: professional videographer

    I had a chance to play around a bit.
    I can confirm the black gap, but there is quite a bit of variation depending on other conditions.
    I was distracted by the audio length and highlights, but now wonder if this is not a variation on the problem discussed here:
    http://forums.adobe.com/message/3633026#3633026
    Using Brendan's menu and wav file (and a made up PAL 720p50 clip for a timeline), I get his results. Brendan, I did not understand that the menu continued normally after the absent menu background. In any event, the audio ends, the menu background is absent (so there is black), the highlight remains, then the menu continues normally through another loop. The audio is playing to the end.
    The problem is not present in Encore preview; it is present to varying degrees playing from a build to folder with Total Media Theater 5 or a burned disk (BD-RE).
    The varying degrees is interesting - Brendan's 59 second clip leaves a pronounced black frame - probably less than a second, but significant. A 30 second audio clip shows only a very, very short flash of black. A 10 second clip had a black frame almost as long as the 59 second clip.
    I wonder about the audio length issues I raised above.
    The full scope of the issue is easier for me to understand using a video background, where the delay is also present - there is just no black frame. For example, simply load the Crib Menu. Playing on the computer from a build to folder, the black is observed. Played from a burned disk on a DVD player, no black flash is present, because the player holds the last image (the final frame of the motion video background) on screen until the menu repeat is loaded. (The highlight disappears briefly.)
    The black is more apparent on an audio only menu, because there is no video background to be held.
    I don't recall whether the frame being held is a build issue or a player function.

  • Trouble with nesting sequences

    Hello.
    The "transparent" elements of my sequences are not preserved when I bring them into another sequence/timeline and apply an effect or motion to it. Is this typical? They appear to be fine, at first, but when they are rendered or exported, the nested sequence has a black background instead of a transparent one. I'm working targa files with transparent elements, which work just fine in their source sequence.
    I apologize if my wording is awkward or if this has been answered elsewhere.

    This is not my experience.
    When I add transparent elements to a sequence and I nest this sequence into another one, transparency is preserved, even after rendering (I can superimpose the sequence with transparent elements to another clip in the timeline, and this appears in the transparent areas).
    Exporting is a different issue. FCE can Export/Quicktime Movie only using DV or HDV codecs that do not preserve transparency. There is a possibility however: you may Export/Using Quicktime Conversion and select the Animation codec which preserves transparency. But before exporting you must make sure that the sequence is not rendered, otherwise the non transparent rendered files will be used (to do that you can make the tracks not Visible and then Visible again, in order to delete the render files; or you can disable and enable again the transparent clips).
    Piero

  • Having trouble with inner for loop values in my procedure

    Hi ...
    I am using oracle 10g and here is my procedure ...
    create or replace procedure sales_information is
    v_qty number(10);
    rem_qty number(10):=0;
    cursor pck_quantity is
    select * from sales_info;
    cursor no_of_labels is
    select ceil(sum(nvl(total_quantity,actual_quantity))/400) from sales_info;
    begin
    for j in no_of_labels
    loop
    for i in pck_quantity
    loop
    select nvl(i.total_quantity,i.actual_quantity) into v_qty from sales_info;
    if v_qty>=i.packed_quantity and rem_qty=0 then
    insert into sales_order values------------
    rem-qty:=v_qty-i.packed_quantity;
    v_qty:=rem_qty;
    exit;
    else if v_qty>=i.packed_quantity and rem_qty>=400 then
    insert into sales_order values-----------
    rem_qty:=v_qty-rem_qty;
    v_qty:=rem_qty;
    exit;
    else if v_qty>=i.packed_quantity and rem_qty>0 then
    rem_qty:=v_qty+rem_qty-i.packed_quantity;
    v_qty:=rem_qty;
    insert into sales_order values-----------
    else if v_qty is null and rem_qty>0 and then
    insert into sales_order values-----------
    else if v_qty<i.packed_quantity and rem_qty:=0 then
    rem_qty:=v_qty;
    else if v_qty<i.packed_quantity and rem_qty>0 then
    if (v_qty+rem_qty)>400 then
    insert into sales_order values-----------
    rem_qty:=v_qty+rem_qty-i.packed_quantity;
    v_qty:=rem_qty;
    end if;
    end if;
    end loop;
    end loop;
    The inner for loop will retrieve the same values of v_qty for every iteration of outer for loop when it runs the following select statement:
    select nvl(i.total_quantity,i.actual_quantity) into v_qty from sales_info;
    and thus loses the previously computed values of v_qty and rem_qty
    in the previous iteration of outer for loop whereas i want the inner for loop to iterate over it's previously computed values of v_qty and rem_qty but cant think of a workaround.

    h4. Thanks Dave for explanation. Hope I understood your requirement and below code resolves that
    -- Creating table SALES_INFO
    CREATE TABLE SALES_INFO
    (    S_NO             NUMBER(1),
         ACTUAL_QUANTITY  NUMBER(10),
         TOTAL_QUANTITY   NUMBER(10),
          PACKED_QUANTITY  NUMBER(10)
    -- Creating table sales_order
    CREATE TABLE SALES_ORDER
    (    S_NO             NUMBER(1),
         LABEL            VARCHAR2(30),
         ORDER_QUANTITY   NUMBER(10)
    -- Push SALES_INFO data
    INSERT INTO SALES_INFO VALUES(1,1000,800,400);
    INSERT INTO SALES_INFO VALUES(2,800,600,400);
    INSERT INTO SALES_INFO VALUES(3,800,NULL,400);
    INSERT INTO SALES_INFO VALUES(4,NULL,600,400);
    CREATE OR REPLACE PROCEDURE populate_sales_order AS
    CURSOR get_sales_info IS
    SELECT s_no,
               NVL(total_quantity,actual_quantity) total_quantity,
            packed_quantity
    FROM   sales_info;
    v_s_no          PLS_INTEGER := 0;
    v_rem_qty     PLS_INTEGER := 0;
    v_label_num   PLS_INTEGER := 1;
    BEGIN
    FOR rec IN get_sales_info LOOP
        v_rem_qty := rec.total_quantity + v_rem_qty;
        v_s_no    := rec.s_no;
         WHILE v_rem_qty >= rec.packed_quantity LOOP
           INSERT INTO sales_order( s_no, label, order_quantity)
           VALUES ( v_s_no, 'LABEL' || v_label_num, rec.packed_quantity );
           -- Reduce the packed qty from total qty and increment label counter
           v_rem_qty   := v_rem_qty - rec.packed_quantity ;
           v_label_num := v_label_num + 1;
         END LOOP;
    END LOOP;
    -- Put the last lot remaining qty into last carton
    IF v_rem_qty > 0 THEN
    INSERT INTO sales_order( s_no, label, order_quantity)
    VALUES (v_s_no, 'LABEL' || v_label_num, v_rem_qty );
    END IF;
    COMMIT;
    END;
    S_NO    LABEL                                ORDER_QUANTITY
      1          LABEL1                                    400
      1          LABEL2                                    400
      2          LABEL3                                    400
      3          LABEL4                                    400
      3          LABEL5                                    400
      4          LABEL6                                    400
      4          LABEL7                                    400
    {code}                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • Please Help: Trouble with nested CASE statement and comparing dates

    Please tell me why the query below is always returning the bold null even when the start_date of OLD is greater than or equal to the start_date of NEW.
    What I want to do is get the difference of the start_dates of two statuses ( Start_date of OLD - Start_date of NEW) if
    1. end_date of NEW is not null
    2. start_date of OLD is greater than start_date of NEW
    else return null.
    select id,
    case when max(end_date) keep (dense_rank last order by decode(request_wflow_status,'New',1,0),start_date) is null then
    null
    else
              case when max(decode(status,'OLD',start_date,null)) > max(decode(status,'NEW',start_date,null))
              then max(decode(status,'OLD',start_date,null)) - max(decode(status,'NEW',start_date,null))
    else
    null
    end
    end result
    from cc_request_status where id =1
    group by id;

    Avinash,
    Thank you for your help.. Here is a more description of my problem..
    Here is a sample of data I have for a table with four columns (id,status,start_date,end_date)
    What I need to do is to get difference of the start dates of the maximum available dates, if data is valid. The pseducode is as follows:
    IF end_date of New status is null
    THEN return null
    ELSE
    IF start_date of old >= start_date of new
    THEN return (start_date of old - start_date of new)
    ELSE return null
    I used the following query but always return the bold null
    select id,
    (case when max(end_date) keep (dense_rank last order by decode(status,'new',1,0),start_date) is null then
    null
    else
              (case when max(decode(status,'old',start_date,null)) >=
              max(decode(status,'new',start_date,null))
              then max(decode(status,'old',start_date,null)) - max(decode(status,'new',start_date,null))
    else
    null
    end)
    end) result
    from tbl where id =1
    Based on the below sample, I expected to get the following result; 14-Mar-07 - 16-Feb-07 which is the difference of the maximum start_dates of the two statuses. However the query is not working.. Please help me.. Thank you..
    Id    Status    start_date      end_date
    1     new      03-Feb-07      07-Feb-07
    1     new      16-Feb-07      21-Feb-07
    1     old      '10-Mar-07      12-Mar-07
    1     old      '14-Mar-07      16-Mar-07

  • What wrong with this foreach loop

    int[] arr=new int[]{1,2,3};
         List list=Arrays.asList(arr);
    for(List li:list){
           System.out.println(li);
         }This returns incompatible types compile time error. How can i fix that. Thanks.

    jola wrote:
    int[] arr=new int[]{1,2,3};
         List list=Arrays.asList(arr);
    for(List li:list){
           System.out.println(li);
         }This returns incompatible types compile time error. How can i fix that. Thanks.Think about what these lines are doing...
      int[] arr=new int[]{1,2,3};
      List list=Arrays.asList(arr);and then...
    for(List li:list){If that isn't immediately obvious...
    http://java.sun.com/j2se/1.5.0/docs/guide/language/foreach.html

  • Having trouble with nested JSplitPanes and am on a deadline...

    My demo code is pasted below. I tried to make it as close to my app environment as possible without making it too huge, it's already long enough as it is. Anyway, this should run without any imports needed and as a standalone. The problem is this: start the program, click "Hide Middle Panel". Then move the remaining divider over to the left a ways. Now click on "Show Middle Panel". Then action listener resets the right divider that was moved back to it's original location (desired), but even though it is setting the left divider to .5 after the right divider has been moved, it still uses the old width to determine the placement, so the result is that the left divider is out of place.
    Is this a bug in JSplitPane? Or is it something I am doing wrong?
    In my application, I have also written a similar handling of a resize event, which basically just sets the left divider to .5 again. When the split panes are in their invalid state, if I do nothing but resize slightly, the split panes right themselves. However, calling the method that is handling the resize event after setting the divider locations does not make a difference, nor does calling revalidate or repaint.
    Thanks in advance,
    Tonya
    public class TestNestedSplitPane extends javax.swing.JFrame {
        /** Creates new form testNestedSplitPane */
        private TestNestedSplitPane() {
        public static TestNestedSplitPane instance() {
            if (null == instance) {
                instance = new TestNestedSplitPane();
                instance.initComponents();
            return instance;
        private void initComponents() {
            java.awt.GridBagConstraints gridBagConstraints;
            splitPaneContainerPanel = new javax.swing.JPanel();
            splitPaneContainerPanel.setPreferredSize(new java.awt.Dimension(500, 280));
            leftPanel = new javax.swing.JPanel();
            leftPanel.setBackground(java.awt.Color.BLUE);
            middlePanel = new javax.swing.JPanel();
            middlePanel.setBackground(java.awt.Color.GREEN);
            rightPanel = new javax.swing.JPanel();
            rightPanel.setBackground(java.awt.Color.RED);
            innerSplitPane = new javax.swing.JSplitPane(javax.swing.JSplitPane.HORIZONTAL_SPLIT, true, leftPanel, middlePanel);
            outerSplitPane = new javax.swing.JSplitPane(javax.swing.JSplitPane.HORIZONTAL_SPLIT, true, innerSplitPane, rightPanel);
            innerSplitPane.setDividerLocation(((int)splitPaneContainerPanel.getPreferredSize().getWidth()) * 1/3);
            outerSplitPane.setDividerLocation(((int)splitPaneContainerPanel.getPreferredSize().getWidth()) * 2/3);
            buttonContainerPanel = new javax.swing.JPanel();
            hideButton = new javax.swing.JButton();
            hideButton.addActionListener(OutsideListener.instance());
            getContentPane().setLayout(new java.awt.GridBagLayout());
            addWindowListener(new java.awt.event.WindowAdapter() {
                public void windowClosing(java.awt.event.WindowEvent evt) {
                    exitForm(evt);
            splitPaneContainerPanel.setLayout(new java.awt.BorderLayout());
            outerSplitPane.setContinuousLayout(true);
            outerSplitPane.setOneTouchExpandable(true);
            innerSplitPane.setContinuousLayout(true);
            innerSplitPane.setOneTouchExpandable(true);
            outerSplitPane.setLeftComponent(innerSplitPane);
            splitPaneContainerPanel.add(outerSplitPane, java.awt.BorderLayout.CENTER);
            gridBagConstraints = new java.awt.GridBagConstraints();
            gridBagConstraints.gridx = 0;
            gridBagConstraints.gridy = 0;
            gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
            gridBagConstraints.weightx = 1.0;
            gridBagConstraints.weighty = 1.0;
            getContentPane().add(splitPaneContainerPanel, gridBagConstraints);
            hideButton.setText("Hide Middle Panel");
            buttonContainerPanel.add(hideButton);
            java.awt.Toolkit tk = java.awt.Toolkit.getDefaultToolkit();
            java.awt.Dimension d = tk.getScreenSize();
            setSize(500, 300);
            int screenHeight = d.height;
            int screenWidth = d.width;
            setLocation((screenWidth-500)/2, (screenHeight-300)/2);
            gridBagConstraints = new java.awt.GridBagConstraints();
            gridBagConstraints.gridx = 0;
            gridBagConstraints.gridy = 1;
            gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
            gridBagConstraints.weightx = 1.0;
            getContentPane().add(buttonContainerPanel, gridBagConstraints);
            pack();
        /** Exit the Application */
        private void exitForm(java.awt.event.WindowEvent evt) {
            System.exit(0);
         * @param args the command line arguments
        public static void main(String args[]) {
            TestNestedSplitPane.instance().show();
        private static TestNestedSplitPane instance = null;
        public javax.swing.JButton hideButton = null;
        private javax.swing.JPanel splitPaneContainerPanel = null;
        private javax.swing.JPanel buttonContainerPanel = null;
        public javax.swing.JSplitPane outerSplitPane = null;
        public javax.swing.JSplitPane innerSplitPane = null;
        public javax.swing.JPanel leftPanel = null;
        public javax.swing.JPanel middlePanel = null;
        public javax.swing.JPanel rightPanel = null;
    class OutsideListener implements java.awt.event.ActionListener {
        private static OutsideListener instance = null;
        private OutsideListener() {
        public static OutsideListener instance() {
            if (null == instance) {
                instance = new OutsideListener();
            return instance;
        public void actionPerformed(java.awt.event.ActionEvent e) {
            if (TestNestedSplitPane.instance().hideButton.getText().equalsIgnoreCase("Hide Middle Panel")) {
                TestNestedSplitPane.instance().middlePanel.setVisible(false);
                TestNestedSplitPane.instance().outerSplitPane.setDividerLocation(.67);
                TestNestedSplitPane.instance().hideButton.setText("Show Middle Panel");
            } else if (TestNestedSplitPane.instance().hideButton.getText().equalsIgnoreCase("Show Middle Panel")) {
                TestNestedSplitPane.instance().middlePanel.setVisible(true);
                TestNestedSplitPane.instance().outerSplitPane.setDividerLocation(.67);
                TestNestedSplitPane.instance().outerSplitPane.revalidate();
                TestNestedSplitPane.instance().innerSplitPane.setDividerLocation(.5);
                TestNestedSplitPane.instance().hideButton.setText("Hide Middle Panel");
    }

    However, I still get totally confused about the difference between validate() and revalidate().Same here. There seems to be no consistency. One combination of components will
    respond to revalidate(), another combination will not.
    Did you come across this solution by trying various combinations of validate(), revalidate(), repaint()?I (generally) find either revalidate() (on its own), or validate() and repaint() (combined) work
    In this case, after spotting the revalidate(), validate()/repaint() was the first change I tried.
    http://forum.java.sun.com/thread.jspa?threadID=583383Interesting discussion - I'll have bit more of a look through my swing books/notes and if I
    find anything interesting I'll post back.

  • Nested For Loop Trouble?

    Ok I need to have a nested for loop that asks a user to enter in a int number from 1-50. Whatever the number is, lets say 4 I need the program to count up asterisk and count down asterisks, like this.
    This is my code:
    import java.io.*;
    public class Stars {
         static int n;
         static private InputStreamReader in = new InputStreamReader(System.in);
         static private BufferedReader br = new BufferedReader(in);
         public static void main(String[] Args)throws IOException
              System.out.println("Please enter in a number to see display: ");
              String num = br.readLine();
              n=Integer.parseInt(num);
              for(int i=1;i<=n;i++)
                   for(int j=1;j<=i;j++)
                        System.out.print("*");
                   for(int j=1;j<=i;j--)
                        System.out.print("*");
                   System.out.println();
    Can someone tell me what I am doing wrong so I can figure out my mistake(s).

    Ok, well I know that the loop relies on the number entered in by the user. So if i pick 3 the three enter in the loop and counts up in a for loop and for every number it counts up to the three it does a print("*"); Now what I am getting confused about is where the other for loop comes into play. I know that I need to start from the number I have which is 3, so I need to have one less than that and then count down. The thing is that i'm not sure where or how the second for loop gets implemented into the code. Does it get nested with the first loop like this:
    for(int i=1;i<=n;i++)
                   for(int j=1;j<=i;j++)
                            for(int j=n-1;j>=i;j--)
                        System.out.print("*");
                   System.out.println();
              }Or is the second for loop on its own like this:
    for(int i=1;i<=n;i++)
                   for(int j=1;j<=i;j++)
                        System.out.print("*");
                   for(int j=n-1;j>=i;j--)
                        System.out.print("*");
                   System.out.println();
              }If someone can help me understand, for this is my first time with nested for loops.

  • Setup ForEach Loop with 2D Array

    Hello All,
      Would like to know how (if possible) to configure the "ForEach Loop" step in TestStand for an empty 2D Array.  What I have is a 2D array of character strings that represent sets of configuration parameters (i.e. each row contains several columns of parameters, and there are an undetermined amount of rows).  With the ForEach Loop, I would want it to loop once for each parameter row (not for each column of each row).  Right now it looks like it runs once for every column.  Please advise.  Thanks much.
    Regards,
    GSinMN     

    Hi GSinMN    
    There’s a TestStand known issue of transposing an incoming array from LabVIEW, if you are importing and array from LabVIEW you can transpose that array prior to pass it to TestStand. Because seems that the behavior you are seeing is due to a transposed array.
    Here are some links with more information
    http://www.ni.com/white-paper/8681/en/#161523_by_Category
    http://forums.ni.com/t5/NI-TestStand/TestStand-Foreach-tutorial-or-example/td-p/1125230
    regards
    Chris S.

  • Error 0x800A0BCD in a foreach loop container

    Hi
    I ve two nested foreach loop containers, all tasks included inside run well but when i launch the package i meet a error :
    0x800A0BCD to the output of
    the internal foreach loop container
    How to see what happens wrong and how to solve this issue ?
    Thx

    This is an invalid set up.
    It is hard to see the image.
    Do not expect to have both successful completions to  spawn two absolutely parallel processes.
    To make it run in parallel just use two DFTs with each that are not connected together. Not connected is the catch, if max executables is not tweaked the package will spawn parallel exes to execute both DFTs more or less asynchronously.
    Arthur My Blog

Maybe you are looking for

  • Error message while copying a position in PPOME

    Hi, I get the following error message when trying to copy a position in PPOME Error during copying. The action has been interrupted. Message no. 5A505 Any ideas what might cause this? Regards, Francois

  • To download alv output to two excel sheets because of large data

    Hi all, I want to download alv output to excel sheet,I know how to do,but the no of record is very large and can not be accomodated in one sheet. can anyone please tell how to download it into two sheets or some other way. I want excel format only. R

  • Photo Merge not working

    The Hide and Reveal Brushes in my Photo Merge, Compose action is not working.  I have tried many different photos and it won't work on any of them.  The rest of the functions work just not the Hide and Reveal Brushes.  Help!

  • Parse

    Anyone could help me? After uploading a CSV file, parsing it with StringTokenizer and displaying it in a table, how can i catch a value of a cell so to compare it to another? Thanks PS: I heard something about comma separated list. What´s the diferen

  • ADF How to Set TimeZone in adf-faces-config.xml

    hi How to set timezone in adf-faces-config.xml .