Urgent! Nested If- Else statements.Help me

Please help me, I gt a problem using a nested if else statements.I have 3 objects called bpdu objects. These 3 bpdu objects need to be compared with each other based on their Priority and Mac Address.The program below shows the program that have been done and I wish to know how do I compare the Mac address continuing from the Piority.
I also want to know if the Priority comparison is in the correct sequence
Here is the code.
import java.util.*;
import java.sql.*;
import java.io.*;
import java.net.*;
import java.lang.*;
public class RootBridgeApp
     RootBridge root= new RootBridge();
     ArrayList dataList=root.retrieveAll(compName);
     BPDU bpdu=dataList.get(0);
     BPDU bpdu2=dataList.get(1);
     BPDU bpdu3=dataList.get(2);
//COMPARE ON PRIORITY
     if(bpdu.getBridgeIDPriority()<bpdu2.getBridgeIDPriority())
     {   //comparing bpdu with bpdu3
          if(bpdu.getBridgeIDPriority()<bpdu3.getBridgeIDPriority())
               System.out.println(bpdu.getComputerName + "is Root Bridge!");
          //comparing bpdu3 with bpdu2
          else if(bpdu3.getBridgeIDPriority()<bpdu2.getBridgeIDPriority())
               System.out.println(bpdu3.getComputerName + "is Root Bridge!");
          else
               System.out.println(bpdu2.getComputerName + "is Root Bridge!");
     //comparing bpdu2 with bpdu3
     else if(bpdu2.getBridgeIDPriority()<bpdu3.getBridgeIDPriority())
          System.out.println(bpdu2.getComputerName + "is Root Bridge!");
     else
          System.out.println(bpdu3.getComputerName + "is Root Bridge!");
     //IF SAME THEN COMPARE BY MAC
// COMPARE BY MAC  ... how do i continue form here?
     if(bpdu.getBridgeIDMac()<bpdu2.getBridgeIDMac())
     {   //comparing bpdu with bpdu3
          if(bpdu.getBridgeIDMac()<bpdu3.getBridgeIDMac())
               System.out.println(bpdu.getComputerName + "is Root Bridge!");
          //comparing bpdu3 with bpdu2
          else if(bpdu3.getBridgeIDMac()<bpdu2.getBridgeIDMac())
               System.out.println(bpdu3.getComputerName + "is Root Bridge!");
          else
               System.out.println(bpdu2.getComputerName + "is Root Bridge!");
     //comparing bpdu2 with bpdu3
     else if(bpdu2.getBridgeIDMac()<bpdu3.getBridgeIDMac())
          System.out.println(bpdu2.getComputerName + "is Root Bridge!");
     else
          System.out.println(bpdu3.getComputerName + "is Root Bridge!");
     }

if (bdpu < bdpu2)
if (dbpu < bdpu3)
{ dbpu is min. }
else { bdpu3 is min. }
else if (bdpu2 < bdpu3)
{ bdpu2 is min. }
else if (bdpu3 < bdpu2)
{ bdpu3 is min. }
else [there are two the same]
{  compare by mac here..
}If bdpu = bdpu3, and both are less than bdpu2, this will erroneously say that bdpu3 is min (line 4) and never check the macs.
This type of logic checking could get hairy as the number of items to compare increases beyond 3. Could you store the values in the list as something Comparable (like Strings) and sort them by priority, then mac?

Similar Messages

  • Error msg in IF ELSE statement in jsp page, Need help

    Below is my code I am trying to execute, but keep getting an error:
    Compilation error occured:
    Found 1 errors in JSP file:
    D:\\http\\proFolder\\student.jsp:130: Syntax: "}" inserted to complete StatementNoShortIf
    <%if (assess.getNumberValue() > 0) {%>
         <%if ((assess.getTotalCost(appForm)) <= (assess.getNumberValue())) {%>
         <strong><%=assess.getTotalCost(appForm)%></strong>      
            <%}%>
    <%}%>
    <%else {%>
         <%=assess.getTotalCost(appForm)%>
    <%}%>Basically, What I am trying to do is follow this logic:
    IF method getNumberValue() is greater then 0, then execute the second IF statement that
    is, If method getTotalCost() is less then or equal to getNumberValue() then display value of method getTotalCost()
    End Second IF
    End First IF
    Now if the First IF fails ( that is getNumberValue() is not gether then 0)
    then execute the else statement
    Could someone please guide me what I am doing wrong, and what would be the correct way of write the IF else code
    Thanks,

    <%     if (assess.getNumberValue() > 0) {
              if ((assess.getTotalCost(appForm)) <= (assess.getNumberValue())) {
    %>
                   <strong><%=assess.getTotalCost(appForm)%></strong>      
    <%          
    %>
    <%
         else {
    %>
              <%=assess.getTotalCost(appForm)%>
    <%
    %>

  • Help using multiple if else statements & manual dynamic xml data input to trigger a goto and play.

    Below is code that has a timer countdown that reads off of the computer. Below in bold is code to read "if it reaches the date, go to and play frame (2).
    timer.removeEventListener(TimerEvent.TIMER, updateTime);
      timer.stop();
      gotoAndPlay(2);
    Below is code that is manual input-   I had set up a dynamic txt field in flash named it : raffle_tix_remain When loaded on to the host I can manulally update the xml code and the change will take effect.
    raffle_tix_remain.text = root.loaderInfo.parameters.raffle_tix_remain;
    My question:  Since the raffle_tix_remain is a manual input from a user to xml  Is there a way to tell flash once it refreshes and "raffle_ tix_ remain"  goes to (0) zero gotoAndPlay(2); and let it play like a "sold out" sign
    i guess that would be a  if else statement. 
    Code Below-----------------
    stop();
    var year:Number = 2011;
    var month:Number = 12;
    var day:Number = 30;
    var finalDate:Date = new Date(year,month-1,day);
    var timer:Timer = new Timer(100);
    timer.addEventListener(TimerEvent.TIMER, updateTime);
    timer.start();
    function updateTime(e:TimerEvent):void{
              var now:Date = new Date();
              var remainTime:Number = finalDate.getTime() - now.getTime();
              if (remainTime >0) {
                        var secs:Number = Math.floor(remainTime/1000);
                        var mins:Number = Math.floor(secs/60);
                        var hours:Number = Math.floor(mins/60);
                        var days:Number = Math.floor(hours/24);
                        var secsText:String = (secs%60).toString();
                        var minsText:String = (mins%60).toString();
                        var hoursText:String = (hours%24).toString();
                        var daysText:String = days.toString();
                        if (secsText.length < 2) {secsText = "0" + secsText;}
                        if (minsText.length < 2) {minsText = "0" + minsText;}
                        if (hoursText.length < 2) {hoursText = "0" + hoursText;}
                        if (daysText.length < 2) {daysText = "0" + daysText;}
                        day_txt.text = daysText;
                        hour_txt.text = hoursText;
                        min_txt.text = minsText;
                        sec_txt.text = secsText;
              else {
                        timer.removeEventListener(TimerEvent.TIMER, updateTime);
                        timer.stop();
                        gotoAndPlay(2);

    stop();
    var year:Number = 2011;
    var month:Number = 12;
    var day:Number = 30;
    var finalDate:Date = new Date(year,month-1,day);
      var now:Date = new Date();
    var timer:Timer = new Timer(1000);
    timer.addEventListener(TimerEvent.TIMER, updateTime);
    timer.start();
    function updateTime(e:TimerEvent):void{
             var remainTime:Number = finalDate.getTime() - now.getTime()-e.currentCount;
              if (remainTime >0 || raffle_tix_remain==0) {
                        var secs:Number = Math.floor(remainTime/1000);
                        var mins:Number = Math.floor(secs/60);
                        var hours:Number = Math.floor(mins/60);
                        var days:Number = Math.floor(hours/24);
                        var secsText:String = (secs%60).toString();
                        var minsText:String = (mins%60).toString();
                        var hoursText:String = (hours%24).toString();
                        var daysText:String = days.toString();
                        if (secsText.length < 2) {secsText = "0" + secsText;}
                        if (minsText.length < 2) {minsText = "0" + minsText;}
                        if (hoursText.length < 2) {hoursText = "0" + hoursText;}
                        if (daysText.length < 2) {daysText = "0" + daysText;}
                        day_txt.text = daysText;
                        hour_txt.text = hoursText;
                        min_txt.text = minsText;
                        sec_txt.text = secsText;
              else {
                        timer.removeEventListener(TimerEvent.TIMER, updateTime);
                        timer.stop();
                        gotoAndPlay(2);

  • If else statement

    hi everyone
    i need help
    I'm trying to make if else statement in the sqldeveloper query
    and my code us like ...
    IF CHARGE_PRICE BETWEEN 10000 AND 20000
    THEN
    charge_apartment(1,600);
    ELSIF CHARGE_PRICE BETWEEN 20000 AND 40000
    THEN
    charge_apartment(1,500);
    ELSIF CHARGE_PRICE > 40000
    THEN
    charge_apartment(1,900);
    ELSE
    charge_apartment(1,650);
    END IF;
    now the question is how do i cover that part of code so the sqldeveloper query will know that I'm talking about an Apartments table...?
    I dig around the net and so far all the info i got is relevant only for sql*Plus
    so...
    How can I do this at the query?
    thanks in advance
    Edited by: 885780 on Sep 16, 2011 4:04 PM
    Edited by: 885780 on Sep 16, 2011 4:05 PM

    I'll explain myself again more clearly
    if i', execute the command
    execute Charge_Apartment(1,600)
    so the right apartment is being charged with the right peice,
    But!
    if i'm execute
    CASE
    WHEN APARTMENT_SIZE < 10000 THEN Charge_Apartment(1,650);
    WHEN APARTMENT_SIZE < 20000 THEN Charge_Apartment(1,600);
    WHEN APARTMENT_SIZE < 40000 THEN Charge_Apartment(1,500);
    ELSE Charge_Apartment(1,900);
    END
    I'm crashing with
    Error starting at line 1 in command:
    CASE
    Error report:
    Unknown Command
    Error starting at line 2 in command:
    WHEN APARTMENT_SIZE < 10000 THEN Charge_Apartment(1,650)
    Error report:
    Unknown Command
    Error starting at line 3 in command:
    WHEN APARTMENT_SIZE < 20000 THEN Charge_Apartment(1,600)
    Error report:
    Unknown Command
    Error starting at line 4 in command:
    WHEN APARTMENT_SIZE < 40000 THEN Charge_Apartment(1,500)
    Error report:
    Unknown Command
    Error starting at line 5 in command:
    ELSE Charge_Apartment(1,900)
    Error report:
    Unknown Command
    Error starting at line 6 in command:
    END
    Error report:
    Unknown Command
    If someone can help me i'll be glad
    Thanks in advance 4 all of you who helped so far ...

  • Charactersitic values to be used in IFTHEN ELSE STATEMENT IN QUERY

    scenario: i need to use the characteristic values(not the attributes) to be used in an IF THEN ELSE STATEMENT in query. so i created a formula variable for the characteritic of processing type replacement path, replace with key.The values are not fetched in the result and is displayed as X.
    what should i replace with key,lable, constant or other options whereas  my requirement is the all the values present in the characteristc should be used.
    eg. if char name is xyz and has the values 1,2,3,4,5 till -
    20.
    then in a calculated key figure :(formulavariable =1)* kefig1keyfig2 +not(formulavariable =1)kef2keyfig3.
    this formula variable should have all the values of the characteristic values ie 1,2,3---20.
    2. how should i do get the values of characterstics values in the equation give me the steps in detail..
    3. i do not want to use the attributes, though i tried initally while creating the formual variable i replaced with attribute value, there is was an error and there were no reult.
    i tried to create char. variable  for the characteristic  of manual entr , not ready for input values and gave all the values 1,2,3 --20 as default values and then created formaul variable and repalce with the variable, however this characteristic variable is not at all displayed from the list of variables which will be displayed while creating the formula variable.
    help me out.
    Thanks

    hi srini,
    i have includedthe char in rows. i want you to explain in detail how to use these values in the if then else statement in query.
    i have created a calculated key figure 2= (formual variable =1 & keyfig a =0)* keyfig1kefig2 +not(formual variable =1 & keyfig a =0)keyfig2 *calculated keyfig1.
    so this formula variable of replacement path have ref. to then char. and with what value should it replace, key, name, external char or attribut etc so that i should get the values of the char from 1 to20.
    i donot to repalce with the attribute. i just want the char. values and not thier attributes (1. description 2. the second attribute has the values say abc1,efg2,ghi3 for respective charteristic values.
    ie
    char value               desc                 2nd attrib
    1                            hi                     abc1
    2                            bye                  defg2
    3                            ciao                  ghi3

  • Looking for a best query for multiple IF Else statement in a single select

    Hi
    I want to run multiple IF Else statements in a single select SQL, each statement is one SQL operating on the same table, what is the best way to write this select SQL query ?
    If it is PL/SQL, when i get the result from the first IF statement I will skip the remaining execution, and so on... Can any one help me on this.
    Thanks in advance !!

    965818 wrote:
    I Apologize, the information i have given might not be enough.
    This is my scenario,
    I am selecting set of rows from the table for the employee id. After selecting those records,
    i need to go through the result list and check the condition 1, if it is met, i will return that employee record.
    If that condition 1 is not met, then i need to go through the condition 2. If that is met, i will return that record.
    Like wise, i have four conditions.
    I am trying to achieve this in a single sql. If i am not clear, please let me know.Not fully clear yet, but the picture is better already. The thing with SQL is that you should stop thinking procedurally. Instead think in data sets.
    For example if the task is:
    Find all managers that work in sales.
    Procedural thinking would work like this:
    pseudo code
    Loop over all employees that work in sales
       for each row
           check if it is a manager
               if manager
                  then return record
               else
                  do nothing
               end
    end loopThinking in datasets will result in a different logic
    pseudo code
    select all employees
    where department = SALES
    and job = MANAGERThis advantage here is that all the "Do nothing" loops are not needed. Those are already eliminated by the database.
    So what is needed to help you? Give the full picture. What is your task that you try to solve. From a business perspective.

  • How to use IF ELSE statement in one QUERY to MS ACCESS

    System.out.println("Enter Final Exam: ");
    int f = Integer.parseInt(input.readLine());
    command.executeUpdate("UPDATE Students SET Final_Exam='"+f+"',Raw_score=(QT+MT+Final_Exam)/3 WHERE stud_name='"+stdID+"'");
    command.executeUpdate("UPDATE Students SET Raw_score=(QT+MT+Final_Exam)/3 WHERE stud_ID='"+stdID+"'");
    if (rsf==100)
    command.executeUpdate("UPDATE Students SET Final_Grade=1.0 WHERE stud_ID='"+stdID+"'");
    else if(rsf < 100 && rsf > 90)
    command.executeUpdate("UPDATE Students SET Final_Grade=2.0 WHERE stud_ID='"+stdID+"'");
    else
    command.executeUpdate("UPDATE Students SET Final_Grade=5.0 WHERE stud_ID='"+stdID+"'");How can I shorten my code using a IF ELSE statement inside a single query or two? Or is it possible?
    Edited by: ivatanako on Sep 28, 2007 11:55 PM

    Sun has tutorial trail for JDBC, you might want to browse through that; you'll get more details and samples there than here. Here's the link to the section on PreparedStatement: http://java.sun.com/docs/books/tutorial/jdbc/basics/prepared.html
    People on the forum help others voluntarily, it's not their job.
    Help them help you.
    Learn how to ask questions first: http://faq.javaranch.com/java/HowToAskQuestionsOnJavaRanch
    (Yes I know it's on JavaRanch but I think it applies everywhere)
    ----------------------------------------------------------------

  • IF-ELSE statement in BI  Query

    Hi guys i have a requirement where in i have condition as mention below...
    If  say X=0 then Y=0  and
        if    X>0  then y=1
      where X  is  key figure value...to be compared ..
    can any one suggest me the logic as to how i need to design this in the query..any option of using IF-ELSE statement...
    an in the result if  Y=0 then i should show as a * (star)..how can we do this in the query?
    can any one suggest me a solution for this please..
    Rgds
    Shilpa

    shipa,
    please check these links
    [Defining Exceptions|http://help.sap.com/SAPHELP_NW04S/helpdata/EN/43/21b4cd14cd06f4e10000000a422035/frameset.htm]
    [Defining and Changing Exceptions|http://help.sap.com/saphelp_nw04/helpdata/EN/c2/f6843b49f6a40de10000000a11402f/content.htm]

  • If Then Else Statement in SAP R/3 BW

    Hi,
    Does anyone know how to create an If Then Else statement in BEX?
    Thanks,
    Mounika.

    Hi mounika,
    do this way
    If 'material number' > 0.
    rslt = 'enter into table'.
    else.
    rslt = 15.
    endif.
    A True condition always evaluates to 1, a False condition evaluates to 0.
    for more quieries in bw ..pls go through  the link
    http://sap.ittoolbox.com/groups/technical-functional/sap-bw
    pls reward if helps,
    regards.

  • IF ELSE statement in BEX

    Hi all,
    I need to write a formula in a query using  IF ELSE statements. Here is my senario
    I need to write a IF ELSE statement to calculate a KF i.e., % variance of This year with last year sales (TY%LY) .Following are the conditions.
    IF LY<0 then TY % LY should be (TY-LY)/LY * (-100)
    IF LY>0 then TY% LY should be (TY-LY)/LY * (100)
    IF LY =0 then TY%LY should be 100
    IF LY=NULL (i.e., if store is closed last year we donu2019t pull record so LY will be empty) then TY%LY should be 100
    IF TY=0 or NULL then TY%LY should be -100
    So I tried writing as follow but getting errors
    (LY<0)(TY-LY)/LY(-100) + (NOT(LY<=0))((TY-LY)/LY)100  + (LY==0)100 + NODIM(LY)100 + (TY==0)(-100) + NODIM(TY)(-100)
    But it is giving errors. Can you please suggest me how to write that formula without effecting the current performance of the query.
    Thanks in Advance,
    Preethi

    Hi Preethi,
    I think that you can accomplish the desired results using the following formulas:
    KEY FIGURE = NOT(F1=0) * F5 + (F1=0) * -100
    F1 = NOERR(TY + 0)
    F2 = NOERR(LY + 0)
    F3 = NOERR( (F1-F2) / F2 ) * -100
    F4 = F3 * -1
    F5 = (F2<0) * F3 + (F2>0) * F4 + (F2=0) * 100
    I hope it helps you.
    Regards,
    Maximiliano

  • How to total 2 colums with an -If then else- statement each

    Hello,
    I have 2 colums A en B who generate data based on an “If then else” statement.
    Colum A
    <?xdofx:if (OMZET_YTD_VJ )!='' then ((OMZET_YTD_VJ) * (BM_YTD - BM_YTD_VJ)) div 100 else 0 end if?>
    Colum B
    <?xdofx:if (BM_YTD)!='' then ((BM_YTD) * (OMZET_YTD - OMZET_YTD_VJ)) div 100 else 0 end if?>
    Colum C needs to be the sum of both. Who can help me?
    Thanks a lot.

    Can you send me the RTF template and xml file to [email protected]? I can take a look and try to help.
    Thanks,
    Bipuser

  • How can I use an IF ELSE statement and the xdoxslt: get_variable together?

    First of all, I'm a big fan of this forum and I just want to thank the community for helping make the BI Publisher world a better place.
    I'm trying to populate a table with a years worth of data with the column=PRODUCT and row=month of DATE. Here's the catch, not all of the months will have data. So here's where my problem is, I'm not able to use an IF ELSE statement along with a XDOXSLT:GET_VARIABLE expression so that if there's no data for that month the default value will be 0.
    Can someone help me find a solution to either one of the attempts below or a completely new method? Thanks!
    BP4 = numeric month value using DATE (more code to pull only month from DATE not included here)
    JAN1 = PRICE if data exists, else 0
    1) I tried this and it didn't work:
    <?if: xdoxslt:get_variable($_XDOCTX,'BP4'),01 then xdoxslt:set_variable($_XDOCTX, 'JAN1',PRICE) else xdoxslt:set_variable($_XDOCTX, 'JAN1',0) end if?>
    <?xdoxslt:get_variable($_XDOCTX,'JAN1')?>
    <?end if?>
    2) I tried this and it didn't work:
    <?xdoxslt:ifelse(xdoxslt:get_variable($_XDOCTX,'BP4')='01',xdoxslt:set_variable($_XDOCTX, 'JAN1',PRICE),xdoxslt:set_variable($_XDOCTX, 'JAN1',0))?>
    <?xdoxslt:get_variable($_XDOCTX,'JAN1')?>
    <?end if?>
    3) I tried this and it didn't work:
    <?xdofx:if xdoxslt:get_variable($_XDOCTX,'BP4')='01' then xdoxslt:set_variable($_XDOCTX, 'JAN1',PRICE) else xdoxslt:set_variable($_XDOCTX, 'JAN1',0) end if?>
    <?xdoxslt:get_variable($_XDOCTX,'JAN1')?>
    <?end if?>
    sample XML:
    <ROW>
    <Name>Craig Hernandez</NAME>
    <DATE>2013-01-01T00:00:00.000+08:00</DATE>
    <PRICE>31</PRICE>
    <PRODUCT>BPD</PRODUCT>
    </ROW>
    -DrT
    Edited by: 990965 on Feb 28, 2013 8:27 AM

    let me clarify my logic, the template 1) searches for the relevant PRODUCT (in the case below, it searches for BPD which is the column in the table) 2) searches for the relevant month in DATE (which is the row in the table) 3) if data exists, get PRICE else default to 0
    Variable definitions:
    BP4 = numeric month value from DATE (more code to get this value not included here, but it works...)
    JAN1 = set to PRICE if data exists for that month, else 0
    the query is only pulling all of the existing data, so if there's no data for March then there wouldn't be a March entry in the xml. In the sample xml below, we only have data for the first two months (Jan, Feb) so that's the only data in the xml. I can't check if PRICE is null because the xml will not have any data for March.
    I've read through other threads and it seems that BI Publisher can't use an IF THEN ELSE with the XDOXSLT:GET_VARIABLE. I sent the template and xml to you.
    Sample XML:
    <ROW>
    <Name>Craig Hernandez</NAME>
    <DATE>2013-01-01T00:00:00.000+08:00</DATE>
    <PRICE>31</PRICE>
    <PRODUCT>BPD</PRODUCT>
    </ROW>
    <ROW>
    <Name>Craig Hernandez</NAME>
    <DATE>2013-02-01T00:00:00.000+08:00</DATE>
    <PRICE>30</PRICE>
    <PRODUCT>BPD</PRODUCT>
    </ROW>
    Edited by: 990965 on Feb 28, 2013 8:30 AM

  • How to create nested case when statement in OBIEE 11g?

    Hi All,
    I need to create a formula using nested case when statement. The formula to be created is below:
    =If([AWRV]<0; "<0";
    If([AWRV]=0; "0";
    If([AWRV]<=15; ">0 and <=15";
    If([AWRV]<=25; ">15 and <=25";
    If([AWRV]<=50; ">25 and <=50";
    If([AWRV]<=75; ">50 and <=75";
    If([AWRV]<=100; ">75 and <=100";
    If([AWRV]<=200; ">100 and <=200";
    If([AWRV]<=500; ">200 and <=500";
    If([AWRV]<=1000; ">500 and <=1000";
    If([AWRV]<=5000; ">1000 and <=5000";
    If([AWRV]<=10000; ">5000 and <=10000"; ">10000"))))))))))))
    How to recreate using Nested case when? I tried in many different ways but it is displaying syntax error in obiee11g. This is very critical. Can anybody shed light on this issue pls?
    Thanks in advance,
    Thenmozhi

    Honey26 wrote:
    Hi All,
    I need to create a formula using nested case when statement. The formula to be created is below:
    =If([AWRV]<0; "<0";
    If([AWRV]=0; "0";
    If([AWRV]<=15; ">0 and <=15";
    If([AWRV]<=25; ">15 and <=25";
    If([AWRV]<=50; ">25 and <=50";
    If([AWRV]<=75; ">50 and <=75";
    If([AWRV]<=100; ">75 and <=100";
    If([AWRV]<=200; ">100 and <=200";
    If([AWRV]<=500; ">200 and <=500";
    If([AWRV]<=1000; ">500 and <=1000";
    If([AWRV]<=5000; ">1000 and <=5000";
    If([AWRV]<=10000; ">5000 and <=10000"; ">10000"))))))))))))
    How to recreate using Nested case when? I tried in many different ways but it is displaying syntax error in obiee11g. This is very critical. Can anybody shed light on this issue pls?
    Thanks in advance,
    ThenmozhiTry the below:
    CASE WHEN "Fact - Open Chargeback"."Sub Chbk Amt" < 0 THEN ' <0'
    WHEN "Fact - Open Chargeback"."Sub Chbk Amt" = 0 THEN '0'
    WHEN "Fact - Open Chargeback"."Sub Chbk Amt" BETWEEN 0 AND 15 THEN '>0 AND <=15'
    END
    Hope this helps.

  • Having trouble with an else statement.........

    I am having trouble figuring out what to do with this else statement error.........I can't seem to see where I am going wrong...............can anyone help? I can compile it but I just keep getting this one error I can't fix.....................
    Program Name:     Transfer
    import java.io.*;
    import java.awt.*;
    import java.awt.event.*;
    public class Transfer extends Frame implements ActionListener
    DataOutputStream output;
    //Construct components
    Panel dataFields = new Panel();
    Panel firstRow = new Panel();
    Panel secondRow = new Panel();
    Panel thirdRow = new Panel();
    Panel fourthRow = new Panel();
    Panel buttonArea = new Panel();
    Button submit = new Button("Submit");
    Button exit = new Button("Exit");
    Label firstNameLabel = new Label("Name:");
    TextField firstName = new TextField(15);
    Label studentIdLabel = new Label("Student ID:");
    TextField studentId = new TextField(15);
    Label transferCourseLabel = new Label("Transfer Course Number:");
    TextField transferCourse = new TextField (15);
    Label localCourseLabel = new Label("Local Course Number:");
    TextField localCourses = new TextField (15);
    public static void main(String args[])
    Transfer window = new Transfer();
    window.setTitle("Transfer Course Substitutions");
    window.setSize(450, 250);
    window.setVisible(true);
    public Transfer()
    //set backgound and layout managers
    setBackground(Color.magenta);
    setLayout(new BorderLayout());
    dataFields.setLayout(new GridLayout(4,2));
    FlowLayout rowSetup = new FlowLayout(FlowLayout.LEFT,4,2);
    firstRow.setLayout(rowSetup);
    secondRow.setLayout(rowSetup);
    thirdRow.setLayout(rowSetup);
    fourthRow.setLayout(rowSetup);
    buttonArea.setLayout(new FlowLayout());
    //Add fields to rows
    firstRow.add(firstNameLabel);
    secondRow.add(studentIdLabel);
    thirdRow.add(transferCourseLabel);
    fourthRow.add(localCourseLabel);
    //Add rows to panel
    dataFields.add(firstRow);
    dataFields.add(secondRow);
    dataFields.add(thirdRow);
    dataFields.add(fourthRow);
    //Add buttons to panel
    buttonArea.add(submit);
    buttonArea.add(exit);
    //Add panels to frame
    add(dataFields, BorderLayout.NORTH);
    add(buttonArea, BorderLayout.SOUTH);
    //Add functionality to buttons
    submit.addActionListener(this);
    exit.addActionListener(this);
    // output states
    try
    output = new DataOuputStream(new FileOUtputStream("Transfer.dat"));
    catch(IOException ex)
    System.exit(1);
    //construct window listener
    addWindowListener(
    new WindowAdapter()
    public void windowClosing(WindowEvent e)
    System.exit(0);
    public void actionPerformed(ActionEvent e)
    String arg = e.getActionCommand();
    if (arg == "Submit")
    try
    output.writeUTF(code);
    output.writeUTF(firstName.getText());
    output.writeUTF(studentId.getText());
    output.writeUTF(transferCourse.getText());
    output.writeUTF(localCourse.getText());
    catch(IOException ex)
    System.exit(1);
    clearFields();
    else //code to execute if the user clicks Exit
    try
    output.close();
    catch(IOException c)
    System.exit(1);
    System.exit(0);
    public void clearFields()
    firstName.setText("");
    studentId.setText("");
    transferCourse.setText("");
    localCourse.setText("");
    firstName.requestFocus();

    The == method does work but it compares Object references and not the String contents. If the string you are comparing is actually the same object it will reply with 'true' also id both Strings are generated with quotes in the same methos and they contain the same string it will also work. This because the compiler will optimize your creating 2 identical Strings to 1 crete statement.
    String a = "Hello";
    String b = "Hello";
    String c = new String("Hello");
    String d = "He" + "llo";
    String e = "He";
    e +="llo";
    a == b ==> true : because of optimization
    a == c ==> false: because of different objects
    a.equals(c) ==> true
    a == d ==> true : because of optimization
    a == e ==> false : because of different objects

  • Very urgent!!! pls help to debug!!!

    Hi, friends:
    when I work on a data loading project, use the script like:
    INSERT INTO xhealthcall_script_data
    (xhc_call_ended, xhc_switch_port, xhc_script_id,
    xhc_fax_specified)
    SELECT TO_DATE (hh_end_date || ' ' || hh_end_time, 'MM/DD/YY HH24:MI:SS'),
    hh_switchport, hh_script, 'N'
    FROM tmp_healthhit_load
    WHERE hh_script != 'BROCHURE'
    UNION
    SELECT TO_DATE (hh_end_date || ' ' || hh_end_time, 'MM/DD/YY HH24:MI:SS'),
    hh_switchport, hh_script, 'N'
    FROM tmp_healthhit_load
    WHERE hh_script != 'BROCHURE';
    the problem is, when I execute this script, I always get the error:
    ERROR at line 1:
    ORA-03113: end-of-file on communication channel
    then I was disconnected with database server in sqlplus (kicked out).
    Background: all datatype for tmp_healthhit_load are VARCHAR2
    This project is really very urgent, is there anyone can help me to figure out this problem?
    thank you very much in advance, regards
    jerry

    From metalink:
    Note: 19790.1
    Error:  ORA 3113
    Text:   end-of-file on communication channel
    Cause:  An unexpected end-of-file was processed on the communication channel.
            The problem could not be handled by the SQL*Net, two task, software.
            This message could occur if the shadow two-task process associated with
            a SQL*Net connect has terminated abnormally, or if there is a physical
            failure of the interprocess communication vehicle, that is, the
            network or server machine went down.
    Action: If this message occurs during a connection attempt, check the setup
            files for the appropriate SQL*net driver and confirm SQL*Net software
            is correctly installed on the server. If the message occurs after a
            connection is well established, and the error is not due to a physical
            failure, check if a trace file was generated on the server at failure
            time. Existence of a trace file may suggest an Oracle internal error
            that requires the assistance of customer support.
    *** Important: The notes below are for experienced users - See Note 22080.1
    Explanation:
            There are numerous causes of this error. It is a 'catch all' type
            error which means 'I cannot communicate with the oracle shadow process'.
            This usually occurs when the Oracle server process has died for
            some reason.
    Diagnosis:
            Oracle support need more information to determine what caused the
            error. The most useful items are:
            1) Does this occur when trying to (a) make a connection to the
               database or (b) on an established connection ?
            2) There should be a trace file from the failed session in
               USER_DUMP_DEST
            3) Does a particular statement reproduce this problem or is it
               random ? Use SQL_TRACE on the session to find the problem
               statement.

Maybe you are looking for