IF elseif else usage

So, now I've been trying to learn If, elseif and else statements properly.  And I'm doing something wrong. 
A guy told me his website would email specific people based on what zipcode they put in the contact form on his site.  I was wondering how he did it, so I tried to recreate something similar.
Here is what I've done:
1. I created a file called zipcodes.php
2. In this file it has set every zipcode to a variable.  For instance:
<?php
$Nashville=("37010" or "37027" or "37040" or "37055" or "37152");
?>
3.  I created a form with a field called 'zip'.
4. I created a php file called phpmail.php to send this form.
5. Right now, the top of this file looks like this:
<?php
include("zipcodes.php");
$zip=$_POST["zip"];
//NASHVILLE//
if ($zip==$Nashville)
$my_email = "[email protected]";
//Knoxville//
if ($zip==$Knoxville)
$my_email = "[email protected]";
//Huntsville//
if ($zip==$Huntsville)
$my_email = "[email protected]";
...etc.
This doesn't work.  It sends them all to the last option which is texas or [email protected]
Before I had the first if set to if and all the others set to elseif
But that didn't work.  It sent all the emails to Nashville email I made.
If statements must work though in this way.  Because if I have this:
if ($zip==$Nashville)
$my_email = "[email protected]";
     //Anything Else//
  else $my_email = "[email protected]";
It works.  Meaning if a zipcode is in Nashville it goes to one email - and if it isn't in Nashville - it goes to hippityhoppity.
Am I not getting something about all of this?  Thanks!

Yeah I know.  I also wish it'd let me use PHP syntax instead of plain.  I think it'd make things easier to read.
Here is the entire script.  It is made to work with any form with little regard for what the form has in it.  So long as there is an email field and a zip field.
<?php
include("zipcodes.php");
$zip=$_POST["zip"];
          if (in_array($zip, $Nashville)) {
$my_email = ".....";
          }elseif (in_array($zip, $Knoxville)) {
$my_email = ".....";
          }elseif (in_array($zip, $Huntsville)) {
$my_email = ".....";
          }elseif (in_array($zip, $Florida)) {
$my_email = ".....";
          }elseif (in_array($zip, $Georgia)) {
$my_email = ".....";
          }elseif (in_array($zip, $SouthCarolina)) {
$my_email = ".....";
          }elseif (in_array($zip, $NorthCarolina)) {
$my_email = ".....";
          }elseif (in_array($zip, $Pennsylvania)) {
$my_email = ".....";
          }elseif (in_array($zip, $Maryland)) {
$my_email = ".....";
           }elseif (in_array($zip, $Virginia)) {
$my_email = ".....";
           }elseif (in_array($zip, $Texas)) {
$my_email = ".....";
} else { $my_email = ".....";
$continue = "/";
$errors = array();
if(count($_COOKIE)){foreach(array_keys($_COOKIE) as $value){unset($_REQUEST[$value]);}}
function recursive_array_check_header($element_value)
global $set;
if(!is_array($element_value)){if(preg_match("/(%0A|%0D|\n+|\r+)(content-type:|to:|cc:|bcc: )/i",$element_value)){$set = 1;}}
else
foreach($element_value as $value){if($set){break;} recursive_array_check_header($value);}
recursive_array_check_header($_REQUEST);
if($set){$errors[] = "You cannot send an email header";}
unset($set);
if(isset($_REQUEST['email']) && !empty($_REQUEST['email']))
if(preg_match("/(%0A|%0D|\n+|\r+|:)/i",$_REQUEST['email'])){$errors[] = "Email address may not contain a new line or a colon";}
$_REQUEST['email'] = trim($_REQUEST['email']);
if(substr_count($_REQUEST['email'],"@") != 1 || stristr($_REQUEST['email']," ")){$errors[] = "Email address is invalid";}else{$exploded_email = explode("@",$_REQUEST['email']);if(empty($exploded_email[0]) || strlen($exploded_email[0]) > 64 || empty($exploded_email[1])){$errors[] = "Email address is invalid";}else{if(substr_count($exploded_email[1],".") == 0){$errors[] = "Email address is invalid";}else{$exploded_domain = explode(".",$exploded_email[1]);if(in_array("",$exploded_domain)){$errors[] = "Email address is invalid";}else{foreach($exploded_domain as $value){if(strlen($value) > 63 || !preg_match('/^[a-z0-9-]+$/i',$value)){$errors[] = "Email address is invalid"; break;}}}}}}
if(!(isset($_SERVER['HTTP_REFERER']) && !empty($_SERVER['HTTP_REFERER']) && stristr($_SERVER['HTTP_REFERER'],$_SERVER['HTTP_HOST']))){$errors[] = "You must enable referrer logging to use the form";}
function recursive_array_check_blank($element_value)
global $set;
if(!is_array($element_value)){if(!empty($element_value)){$set = 1;}}
else
foreach($element_value as $value){if($set){break;} recursive_array_check_blank($value);}
recursive_array_check_blank($_REQUEST);
if(!$set){$errors[] = "You cannot send a blank form";}
unset($set);
if(count($errors)){foreach($errors as $value){print "$value<br>";} exit;}
if(!defined("PHP_EOL")){define("PHP_EOL", strtoupper(substr(PHP_OS,0,3) == "WIN") ? "\r\n" : "\n");}
function build_message($request_input){if(!isset($message_output)){$message_output ="";}if(!is_array($request_input)){$message_output = $request_input;}else{foreach($request_input as $key => $value){if(!empty($value)){if(!is_numeric($key)){$message_output .= str_replace("_"," ",ucfirst($key)).": ".build_message($value).PHP_EOL.PHP_EOL;}else{$message_output .= build_message($value).", ";}}}}return rtrim($message_output,", ");}
$message = build_message($_REQUEST);
$message = $message . PHP_EOL.PHP_EOL."-- ".PHP_EOL."";
$message = stripslashes($message);
$subject = "FormToEmail Comments";
$headers = "From: " . $_REQUEST['email'];
mail($my_email,$subject,$message,$headers);
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Dreamweaver Tutorial - Contact Form</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body bgcolor="#ffffff" text="#000000">
<div>
<center>
<b>Thank you <?php print stripslashes($_REQUEST['name']); ?></b>
<br>Your message has been sent
<p><a href="<?php print $continue; ?>">Click here to continue</a></p>
</center>
</div>
</body>
</html>

Similar Messages

  • If elseif else echo statement with radio buttons

    Hi everyone  Please help me out here.  I have a standard php file with 4 groups of questions (radio groups). The user must answer "yes" to ALL 4 questions where after "You Qualify" will echo on the same page.  If any of the questions are answered "No" to, then "you do not qualify" must echo on the same page. If no answer is selected - then no echo  This sounds like a simple if elseif else  statement, but for some reason I just cant get it right.  Could anyone please help me out with this?  Herewith code that I have tried:
    Do you like apples?        Yes           No 
    Do you like oranges?
            Yes           No 
    Do you like pears?
         Yes      No
    Do you like lemons?
         Yes      No

    <?php
    if ($a > $b) {
        echo "a is bigger than b";
    } elseif ($a == $b) {
        echo "a is equal to b";
    } else {
        echo "a is smaller than b";
    ?>

  • If-elseif-else

    Hi
    I have a trigger which had just if-else in it. Due to change in business requirement I had to re develop it and I decided to use if-elseif-else statement. I am getting the following error
    47/9    PLS-00103: Encountered the symbol "C_OPSHE" when expecting one of the following:
              . ( * @ % & = - + < / > at in is mod remainder not rem then
              <an exponent (**)> <> or != or ~= >= <= <> and or like LIKE2_
              LIKE4_ LIKEC_ between || multiset member SUBMULTISET_
              The symbol "then" was substituted for "C_OPSHE" to continue.
    78/1    PLS-00103: Encountered the symbol "ELSE" when expecting one of the following:
              begin case declare end exit for goto if loop mod null pragma
              raise return select update while with <an identifier>
              <a double-quoted delimited-identifier> <a bind variable> <<
              close current delete fetch lock insert open rollback
              savepoint set sql execute commit forall merge pipe
    83/1    PLS-00103: Encountered the symbol "EXCEPTION"
    85/4    PLS-00103: Encountered the symbol "end-of-file" when expecting one of the following:
              end not pragma final instantiable order overriding static
              member constructor map Can some one help me please where I am getting it wrong:
    My trigger is as follows
    DECLARE
    crt_keyholder CLOB;
    addto varchar2(100);
    crt_key varchar2(75);
    issue varchar2(75);
    del_key varchar2(75);
    CURSOR c_opsHE IS
    SELECT pu.person_code FROM people_units pu        
    INNER JOIN unit_instances ui       
    ON pu.unit_instance_code = ui.fes_unit_instance_code       
    WHERE pu.unit_type = 'R'       
    AND pu.progress_status ='A'        
    AND pu.calocc_code LIKE '%12/13%'       
    AND (pu.unit_instance_code LIKE 'Z%' OR pu.unit_instance_code LIKE 'V%')       
    AND pu.unit_instance_code  NOT LIKE 'ZX%'     
    AND ui.fes_source_finance = 'HEFCE';      
    CURSOR c_opsFE IS
    SELECT pu.person_code FROM people_units pu
    INNER JOIN unit_instances ui
    ON pu.unit_instance_code = ui.fes_unit_instance_code
    WHERE pu.unit_type = 'R'
    AND pu.progress_status ='A'
    AND pu.calocc_code LIKE '%12/13%'
    AND (pu.unit_instance_code LIKE 'Z%' OR pu.unit_instance_code LIKE 'V%')
    AND pu.unit_instance_code  NOT LIKE 'ZX%'
    AND ui.fes_source_finance <> 'HEFCE';
    v_recOpsFE PEOPLE.PERSON_CODE%TYPE;
    v_recOpsHE PEOPLE.PERSON_CODE%TYPE;
    BEGIN
    if :new.fes_user_29 is not null then
        if :new.fes_staff_code is not null and :new.staff_user_4 = 'Y' then   
    crt_keyholder:= 'create keyholder'||' ' ||'"'|| :new.person_code||'"'||' '|| 'longname = "' ||:new.forename ||' '||:new.surname||'"'||' '||'comment = ""'||' '||'info1 = ""'||' '|| 'info2 ='||' '||'"'||:new.fes_staff_code||'"'||' '||'info3 = "" info4 = "" info5 = "" info6 = "" info7 = "" info8 = "" info9 = "" info10 = "" info11 = "" info12 = "" info13 = "" info14 = "" info15 = "" info16 = "";';
    addto:= 'addtocommunity keyholder'||' '||'"'|| :new.person_code ||'"'||' community = "Staff" defaultgroups = "Yes";';
    crt_key:= 'create key'||' '||:new.fes_user_29||' box = '||'"General Use"'||' '||'technology = "Magnetic";';
    issue:= 'issue key '||:new.fes_user_29||' '||'technology = "Magnetic" keyholder ='||' '||'"'||:new.person_code||'";';
        insert into ug_command values (UG_SEQUENCE.nextval,'ORACLE',crt_keyholder,0,'');
        insert into ug_command values (UG_SEQUENCE.nextval,'ORACLE',addto,0,'');
        insert into ug_command values (UG_SEQUENCE.nextval,'ORACLE',crt_key,0,'');
        insert into ug_command values (UG_SEQUENCE.nextval,'ORACLE',issue,0,'');
      else if
      OPEN  c_opsHE;
      FETCH c_opsHE INTO v_recOpsHE;
      IF c_opsHE%FOUND THEN
      crt_keyholder:= 'create keyholder'||' ' ||'"'|| :new.person_code||'"'||' '|| 'longname = "' ||:new.forename ||' '||:new.surname||'"'||' '||'comment = ""' ||' ' ||'info1 = "" info2 = "" info3 = "" info4 = "" info5 = "" info6 = "" info7 = "" info8 = "" info9 = "" info10 = "" info11 = "" info12 = "" info13 = "" info14 = "" info15 = "" info16 = "";';
    addto:= 'addtocommunity keyholder'||' '||'"'|| :new.person_code ||'"'||' community = "HEStudents" defaultgroups = "Yes";';
      crt_key:= 'create key'||' '||:new.fes_user_29||' box = '||'"General Use"'||' '||'technology = "Magnetic";';
      issue:= 'issue key '||:new.fes_user_29||' '||'technology = "Magnetic" keyholder ='||' '||'"'||:new.person_code||'";';
        insert into ug_command values (UG_SEQUENCE.nextval,'ORACLE',crt_keyholder,0,'');
        insert into ug_command values (UG_SEQUENCE.nextval,'ORACLE',addto,0,'');
        insert into ug_command values (UG_SEQUENCE.nextval,'ORACLE',crt_key,0,'');
        insert into ug_command values (UG_SEQUENCE.nextval,'ORACLE',issue,0,'');
         end if;
         CLOSE c_opsHE;
      else 
      OPEN  c_opsFE;
      FETCH c_opsFE INTO v_recOpsFE;
      IF c_opsFE%FOUND THEN
      crt_keyholder:= 'create keyholder'||' ' ||'"'|| :new.person_code||'"'||' '|| 'longname = "' ||:new.forename ||' '||:new.surname||'"'||' '||'comment = ""' ||' ' ||'info1 = "" info2 = "" info3 = "" info4 = "" info5 = "" info6 = "" info7 = "" info8 = "" info9 = "" info10 = "" info11 = "" info12 = "" info13 = "" info14 = "" info15 = "" info16 = "";';
    addto:= 'addtocommunity keyholder'||' '||'"'|| :new.person_code ||'"'||' community = "FEStudents" defaultgroups  = "Yes";';
    crt_key:= 'create key'||' '||:new.fes_user_29||' box = '||'"General Use"'||' '||'technology = "Magnetic";';
    issue:= 'issue key '||:new.fes_user_29||' '||'technology = "Magnetic" keyholder ='||' '||'"'||:new.person_code||'";';
        insert into ug_command values (UG_SEQUENCE.nextval,'ORACLE',crt_keyholder,0,'');
        insert into ug_command values (UG_SEQUENCE.nextval,'ORACLE',addto,0,'');
        insert into ug_command values (UG_SEQUENCE.nextval,'ORACLE',crt_key,0,'');
        insert into ug_command values (UG_SEQUENCE.nextval,'ORACLE',issue,0,'');
        end if;
         CLOSE c_opsFE; 
      end if;
    else
    del_key:= 'delete key'||' '||:old.fes_user_29||' '||'technology = "Magnetic"'||';';
    insert into ug_command values (UG_SEQUENCE.nextval,'ORACLE',del_key,0,'');
    end if;
    EXCEPTION
        WHEN others THEN Raise;
    END;

    For better readability, I formatted your code.. please check what should be there in place of (0=0)..
    DECLARE
       crt_keyholder   CLOB;
       addto           VARCHAR2 (100);
       crt_key         VARCHAR2 (75);
       issue           VARCHAR2 (75);
       del_key         VARCHAR2 (75);
       CURSOR c_opsHE IS
          SELECT pu.person_code
            FROM    people_units pu
                 INNER JOIN
                    unit_instances ui
                 ON pu.unit_instance_code = ui.fes_unit_instance_code
           WHERE     pu.unit_type = 'R'
                 AND pu.progress_status = 'A'
                 AND pu.calocc_code LIKE '%12/13%'
                 AND (pu.unit_instance_code LIKE 'Z%'
                      OR pu.unit_instance_code LIKE 'V%')
                 AND pu.unit_instance_code NOT LIKE 'ZX%'
                 AND ui.fes_source_finance = 'HEFCE';
       CURSOR c_opsFE IS
          SELECT pu.person_code
            FROM    people_units pu
                 INNER JOIN
                    unit_instances ui
                 ON pu.unit_instance_code = ui.fes_unit_instance_code
           WHERE     pu.unit_type = 'R'
                 AND pu.progress_status = 'A'
                 AND pu.calocc_code LIKE '%12/13%'
                 AND (pu.unit_instance_code LIKE 'Z%'
                      OR pu.unit_instance_code LIKE 'V%')
                 AND pu.unit_instance_code NOT LIKE 'ZX%'
                 AND ui.fes_source_finance != 'HEFCE';
       v_recOpsFE      PEOPLE.PERSON_CODE%TYPE;
       v_recOpsHE      PEOPLE.PERSON_CODE%TYPE;
    BEGIN
       IF :new.fes_user_29 IS NOT NULL THEN
          IF :new.fes_staff_code IS NOT NULL AND :new.staff_user_4 = 'Y' THEN
             crt_keyholder :=
                   'create keyholder'
                || ' '
                || '"'
                || :new.person_code
                || '"'
                || ' '
                || 'longname = "'
                || :new.forename
                || ' '
                || :new.surname
                || '"'
                || ' '
                || 'comment = ""'
                || ' '
                || 'info1 = ""'
                || ' '
                || 'info2 ='
                || ' '
                || '"'
                || :new.fes_staff_code
                || '"'
                || ' '
                || 'info3 = "" info4 = "" info5 = "" info6 = "" info7 = "" info8 = "" info9 = "" info10 = "" info11 = "" info12 = "" info13 = "" info14 = "" info15 = "" info16 = "";';
             addto :=
                   'addtocommunity keyholder'
                || ' '
                || '"'
                || :new.person_code
                || '"'
                || ' community = "Staff" defaultgroups = "Yes";';
             crt_key :=
                   'create key'
                || ' '
                || :new.fes_user_29
                || ' box = '
                || '"General Use"'
                || ' '
                || 'technology = "Magnetic";';
             issue :=
                   'issue key '
                || :new.fes_user_29
                || ' '
                || 'technology = "Magnetic" keyholder ='
                || ' '
                || '"'
                || :new.person_code
                || '";';
             INSERT INTO ug_command
                  VALUES (UG_SEQUENCE.NEXTVAL,
                          'ORACLE',
                          crt_keyholder,
                          0,
             INSERT INTO ug_command
                  VALUES (UG_SEQUENCE.NEXTVAL,
                          'ORACLE',
                          addto,
                          0,
             INSERT INTO ug_command
                  VALUES (UG_SEQUENCE.NEXTVAL,
                          'ORACLE',
                          crt_key,
                          0,
             INSERT INTO ug_command
                  VALUES (UG_SEQUENCE.NEXTVAL,
                          'ORACLE',
                          issue,
                          0,
          ELSIF (0 = 0) THEN
             OPEN c_opsHE;
             FETCH c_opsHE INTO v_recOpsHE;
             IF c_opsHE%FOUND THEN
                crt_keyholder :=
                      'create keyholder'
                   || ' '
                   || '"'
                   || :new.person_code
                   || '"'
                   || ' '
                   || 'longname = "'
                   || :new.forename
                   || ' '
                   || :new.surname
                   || '"'
                   || ' '
                   || 'comment = ""'
                   || ' '
                   || 'info1 = "" info2 = "" info3 = "" info4 = "" info5 = "" info6 = "" info7 = "" info8 = "" info9 = "" info10 = "" info11 = "" info12 = "" info13 = "" info14 = "" info15 = "" info16 = "";';
                addto :=
                      'addtocommunity keyholder'
                   || ' '
                   || '"'
                   || :new.person_code
                   || '"'
                   || ' community = "HEStudents" defaultgroups = "Yes";';
                crt_key :=
                      'create key'
                   || ' '
                   || :new.fes_user_29
                   || ' box = '
                   || '"General Use"'
                   || ' '
                   || 'technology = "Magnetic";';
                issue :=
                      'issue key '
                   || :new.fes_user_29
                   || ' '
                   || 'technology = "Magnetic" keyholder ='
                   || ' '
                   || '"'
                   || :new.person_code
                   || '";';
                INSERT INTO ug_command
                     VALUES (UG_SEQUENCE.NEXTVAL,
                             'ORACLE',
                             crt_keyholder,
                             0,
                INSERT INTO ug_command
                     VALUES (UG_SEQUENCE.NEXTVAL,
                             'ORACLE',
                             addto,
                             0,
                INSERT INTO ug_command
                     VALUES (UG_SEQUENCE.NEXTVAL,
                             'ORACLE',
                             crt_key,
                             0,
                INSERT INTO ug_command
                     VALUES (UG_SEQUENCE.NEXTVAL,
                             'ORACLE',
                             issue,
                             0,
             END IF;
             CLOSE c_opsHE;
          ELSE
             OPEN c_opsFE;
             FETCH c_opsFE INTO v_recOpsFE;
             IF c_opsFE%FOUND THEN
                crt_keyholder :=
                      'create keyholder'
                   || ' '
                   || '"'
                   || :new.person_code
                   || '"'
                   || ' '
                   || 'longname = "'
                   || :new.forename
                   || ' '
                   || :new.surname
                   || '"'
                   || ' '
                   || 'comment = ""'
                   || ' '
                   || 'info1 = "" info2 = "" info3 = "" info4 = "" info5 = "" info6 = "" info7 = "" info8 = "" info9 = "" info10 = "" info11 = "" info12 = "" info13 = "" info14 = "" info15 = "" info16 = "";';
                addto :=
                      'addtocommunity keyholder'
                   || ' '
                   || '"'
                   || :new.person_code
                   || '"'
                   || ' community = "FEStudents" defaultgroups  = "Yes";';
                crt_key :=
                      'create key'
                   || ' '
                   || :new.fes_user_29
                   || ' box = '
                   || '"General Use"'
                   || ' '
                   || 'technology = "Magnetic";';
                issue :=
                      'issue key '
                   || :new.fes_user_29
                   || ' '
                   || 'technology = "Magnetic" keyholder ='
                   || ' '
                   || '"'
                   || :new.person_code
                   || '";';
                INSERT INTO ug_command
                     VALUES (UG_SEQUENCE.NEXTVAL,
                             'ORACLE',
                             crt_keyholder,
                             0,
                INSERT INTO ug_command
                     VALUES (UG_SEQUENCE.NEXTVAL,
                             'ORACLE',
                             addto,
                             0,
                INSERT INTO ug_command
                     VALUES (UG_SEQUENCE.NEXTVAL,
                             'ORACLE',
                             crt_key,
                             0,
                INSERT INTO ug_command
                     VALUES (UG_SEQUENCE.NEXTVAL,
                             'ORACLE',
                             issue,
                             0,
             END IF;
             CLOSE c_opsFE;
          END IF;
       ELSE
          del_key :=
                'delete key'
             || ' '
             || :old.fes_user_29
             || ' '
             || 'technology = "Magnetic"'
             || ';';
          INSERT INTO ug_command
               VALUES (UG_SEQUENCE.NEXTVAL,
                       'ORACLE',
                       del_key,
                       0,
       END IF;
    EXCEPTION
       WHEN OTHERS THEN
          RAISE;
    END;Cheers,
    Manik

  • IF ELSEIF ELSE  error

    Good Morning
    This code compiles fine:
    IF v_status_code = '3' THEN
    INSERT INTO CRAM_STG
    (ID, ITEM_NO, CHGNBR, UI, SUPPLYACTIONCODE, QTY, ACCT, RECEIPTDATE, REQUISITIONDATE, PROCESSDATE)
    VALUES
    ( to_char(sysdate,'YYMMDDHH24MISS') || test_seq.nextval, no_stock_rec.item_no, v_change_no, v_unit_of_issue, 'UR', no_stock_rec.order_qty,
    no_stock_rec.acct, sysdate, sysdate, sysdate);
    ELSE
    dbms_output.put_line ('Else ' );
    END IF;
    However when I add an elseif I get the following error. Thanks for your help. :
    END;
    Error report:
    ORA-06550: line 96, column 20:
    PLS-00103: Encountered the symbol "V_STATUS_CODE" when expecting one of the following:
    := . ( @ % ;
    Here is the ELSEIF code
    IF v_status_code = '3' THEN
    INSERT INTO CRAM_STG
    (ID, ITEM_NO, CHGNBR, UI, SUPPLYACTIONCODE, QTY, ACCT, RECEIPTDATE, REQUISITIONDATE, PROCESSDATE)
    VALUES
    ( to_char(sysdate,'YYMMDDHH24MISS') || test_seq.nextval, no_stock_rec.item_no, v_change_no, v_unit_of_issue, 'UR', no_stock_rec.order_qty,
    no_stock_rec.acct, sysdate, sysdate, sysdate);
    ELSEIF v_status_code = '4' THEN
    INSERT INTO CRAM_STG
    (ID, ITEM_NO, CHGNBR, UI, SUPPLYACTIONCODE, QTY, ACCT, RECEIPTDATE, REQUISITIONDATE, PROCESSDATE)
    VALUES
    ( to_char(sysdate,'YYMMDDHH24MISS') || test_seq.nextval, no_stock_rec.item_no, v_change_no, v_unit_of_issue, 'NR', no_stock_rec.order_qty,
    no_stock_rec.acct, sysdate, sysdate, sysdate);
    ELSE
    dbms_output.put_line ('Else ' );
    END IF;

    Use ELSIF instead...
    http://download.oracle.com/docs/cd/B19306_01/appdev.102/b14261/controlstructures.htm#sthref910

  • How to acheive IF elseif elseif else  condition using std mapping functions

    How to perform the following mapping using standard graphical functions:
    if (a = 1)
    result.addValue("3");
    else if (a = 2)
    result.addValue("6");
    else if (a = 5)
    result.addvalue("7");
    else if (a = 10)
    result.addValue("11");
    else
    result.addValue(a);
    can this requirement be acheived without using a UDF?
    Regards
    bhasker

    UDF is better way to get this done.
    you try like this using Standard function:
                                               Const 3    /THEN     
                                      (A equals 1)   IF              (output of ifThenElse) ->TragetFiled
                                                            \ELSE
                                                  /THEN     /(output of IfThenElse input to else of first If)
                                              IF               /
                                                 \ELSE
    Like wise for other conditions....
    In else part of ifThenElse, give the output of second ifThenElse. here in ths case you need four ifThenElse.
    CodeGenerated:
    /ns0:MT_/targetFIELD = iF(const([value=3]), stringEquals(/ns0:MT_XML_OB/A=, const([value=1])),
    iF(const([value=6]), stringEquals(/ns0:MT_XML_OB/A=, const([value=2])),
    iF(const([value=7]), stringEquals(/ns0:MT_XML_OB/A=, const([value=5])),
    iF(const([value=11]), stringEquals(/ns0:MT_XML_OB/A=, const[value=10])), /ns0:MT_XML_OB/A=))))
    Ritu
    Edited by: Ritu Sinha on Apr 13, 2009 2:48 PM

  • If, elseIf, else statement block.

    How would you test whether a radiobutton is selected or not?
    if ( lineButton.Selected == true ){ 
    s[ 0 ].move( move, move );;
    else {
    System.out.println("wasn't selected");
    Keeps saying cannot find symbol - variable lineButton.
    My best guess. If anyone could point out how to access the state of the button for using in this if, I would appreciate it.

    i think i understand what is meant by the code you posted. It asks if the radiobutton is selected, and if so, then performs the statements.
    I tried to use it, hopefully properly but still get the same error.
    Here is the code:
    import java.awt.*;
    import java.applet.*;
    import java.awt.event.*;
    import javax.swing.*;
    public class Ch09Sample extends Applet implements ActionListener
        // Members
        private Button moveButton = new Button( "Move" );
        private TextField moveText = new TextField( "5" );
        private TextField moveText2 = new TextField( "5" );
        private int move = 0;
        private Shape [] s = new Shape[ 4 ];;
        private MyCanvas canvas = new MyCanvas();
        static String lineString = "Line";
        static String rectangleString = "Rectangle";
        static String circleString = "Circle";
        static String ovalString = "Oval";
        // An inner class
        class MyCanvas extends Canvas
            public void paint(Graphics g)
                for( int k = 0; k < s.length; k++ )
                    s[ k ].draw( g );
        public void init()
            // Construct the shapes
            s[0] = new Line( 50, 80, 100, 110, Color.red ); 
            s[1] = new Circle( new Point( 30, 180 ), 20, Color.green );
            s[2] = new Oval( new Point( 150, 50 ), Color.blue );
            //s[3] = new Rectangle( );
            // Set the background color
            this.setBackground( Color.white );
            // Create the user interface
            Panel p1 = new Panel();
            p1.setLayout( new FlowLayout() );
            p1.setBackground( Color.white );
            Label label1 = new Label( "Moves in X:" );
            p1.add( label1 );
            p1.add( moveText );
            Label label2 = new Label( "Moves in Y:" );
            p1.add( label2 );
            p1.add( moveText2 );
            p1.add( moveButton );
            JRadioButton lineButton = new JRadioButton(lineString);
            lineButton.setMnemonic(KeyEvent.VK_B);
            lineButton.setActionCommand(lineString);
            lineButton.setSelected(true);
            JRadioButton rectangleButton = new JRadioButton(rectangleString);
            rectangleButton.setMnemonic(KeyEvent.VK_C);
            rectangleButton.setActionCommand(rectangleString);
            JRadioButton circleButton = new JRadioButton(circleString);
            circleButton.setMnemonic(KeyEvent.VK_D);
            circleButton.setActionCommand(circleString);
            JRadioButton ovalButton = new JRadioButton(ovalString);
            ovalButton.setMnemonic(KeyEvent.VK_R);
            ovalButton.setActionCommand(ovalString);
            ButtonGroup group = new ButtonGroup();
            group.add(lineButton);
            group.add(rectangleButton);
            group.add(circleButton);
            group.add(ovalButton);
            moveButton.addActionListener( this );
            lineButton.addActionListener(this);
            rectangleButton.addActionListener(this);
            circleButton.addActionListener(this);
            ovalButton.addActionListener(this);
            p1.add( lineButton );
            p1.add( rectangleButton );
            p1.add( circleButton );
            p1.add( ovalButton );
            setLayout( new BorderLayout() );
            add( "North", p1 );
            add( "Center", canvas );
            // An instance method
        public void moveDraw()
            // Get the user's input
            move = Integer.parseInt( moveText.getText() ); 
            // Move the shapes polymorphically
            for ( int k= 0; k < s.length; k++ ) 
                s[ k ].move( move, move );  
           if(lineButton.isSelected()) {
              s[ 0 ].move( move, move );;
              } else {
                System.out.println("wasn't selected");
            // Repaint the canvas
            canvas.repaint();
        public void actionPerformed( ActionEvent e )
            // Move the shapes and repaint the canvas
            moveDraw();
    }

  • If-elseif-else statement

    Hi,
    I am trying to write a if statement within a JSP page. I have some images stored in the database. Some of the entries does not have images. What I want to do is, if the entry did not match the string images then I want it to do nothing and if it is null then I want it to do nothing, else I would like to show the image. How would I write this code? The following is that I have gotten right now...
    <% if (rs.getString("image")==("images/untitled.gif") %>
    here I want it to do nothing...
    <% else if (rs.getString("image")=null)%>
    don't show anything again..
    <% else %> now is the change to show the image
    <IMG SRC="(rs.getString("image"))" >
    <% } %>
    How do I say to do nothing. I don't want it to do a out println.. but if I leave it blank the error message is 'else' without 'if'
    Any suggestions as to show nothing is the image does not exist? Thanks for all the commnents!

    I came up with a solution similar to yoda's:
    <% String imagePath = rs.getString("image");
       if ( imagePath != null && imagePath.equals("images/untitled.gif") )
       { %>
           <img src="<%= imagePath %>"> 
    <% } %>However, I don't quite understand your reply:
    I am still showing the boxes that are null without an imageAre you saying that if the image path is null you want an image displayed or not?
    --Nicole                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • Using multy-conditional filters (if/then/ELSEIF/else)

    Hello,
    I need to create multiple policies for adding disclaimers.
    We have a default disclaimer and now two unique ones for domains that need to maintain their own.
    I created text recourses for all disclaimers and like to make a content filter that does the following:
    if the senderdomain = UniqueDomain1 then
    add disclaimerDomain1
    Else if the senderdomain = UniqueDomain2 then
    add disclaimerDomain2
    Else
    Add default Disclaimer
    I created the following filter syntax:
    add_disclaimer: if (recv-listener == "relay") AND (mail-from == "^.*@domain1\\.com$")
    {add-footer("domain1Disclaimer");}
    elif (recv-listener == "relay") AND (mail-from == "^.*@domain2\\.com$")
    {add-footer("domain2Disclaimer");}
    elif (recv-listener == "relay")
    {add-footer("defaultDisclaimer");}
    When I submit the filter I get the error "An error occurred during processing: Syntax error at the end of filter".
    Does anyone know if Ironport filters support the Python "elif" routine? if so, what am I doing wrong, if not..... does anyone have any suggestions what way I can deliver this functionality?
    Thank you!
    Steven

    You can probably get the IF/ELSE IF/ELSE logic to work on the Ironport message filters, but I would suggest that you use a combination of Outgoing mail policies and outgoing content filters.
    1. Create all your different disclaimers in the [Mail Policies > Text Resources] section.
    2. Create a corresponding outgoing content that pertains to each sender domain and assign the outgoing content filter.
    i.e.
    Let's say you have two domains and then the default domain:
    domain1, domain2, default domain
    if "mail-from" ends with "@domain1"
    then
    apply domain1-disclaimer-footer
    deliver();
    if "mail-from" ends with "@domain2"
    then
    apply domain2-disclaimer-footer
    deliver();
    if "mail-from" ends with "default-domain"
    then
    apply default-disclaimer-footer
    deliver();
    3. Then go to your outgoing mail policies > default policies > content filters and enable all three filters.
    Similarily, you can create two additional customized outgoing mail policies and each policy can have it's own outgoing content filters.
    Bottom line, you can definitely do it with message filters, but the outgoing mail policies/outgoing content filters may be easier to maintain.
    Let me know if you have any questions or concerns.
    apply domain2-
    Hello,
    I need to create multiple policies for adding disclaimers.
    We have a default disclaimer and now two unique ones for domains that need to maintain their own.
    I created text recourses for all disclaimers and like to make a content filter that does the following:
    if the senderdomain = UniqueDomain1 then
    add disclaimerDomain1
    Else if the senderdomain = UniqueDomain2 then
    add disclaimerDomain2
    Else
    Add default Disclaimer
    I created the following filter syntax:
    add_disclaimer: if (recv-listener == "relay") AND (mail-from == "^.*@domain1\\.com$")
    {add-footer("domain1Disclaimer");}
    elif (recv-listener == "relay") AND (mail-from == "^.*@domain2\\.com$")
    {add-footer("domain2Disclaimer");}
    elif (recv-listener == "relay")
    {add-footer("defaultDisclaimer");}
    When I submit the filter I get the error "An error occurred during processing: Syntax error at the end of filter".
    Does anyone know if Ironport filters support the Python "elif" routine? if so, what am I doing wrong, if not..... does anyone have any suggestions what way I can deliver this functionality?
    Thank you!
    Steven

  • Best way to test each if else statement

    Hey everyone I have a few scripts that have many different if ,elseif, else blocks. The problem is that they are hard to test and some are rarely triggered. However I need to check to make sure the contents triggered by one of the statements works. I know
    there is a whatif switch but from my understanding it is only used for specific commands and doesn't actually trigger them. 
    So is there some way to debug them or force the script to meet a condition of an if statement?
    Thanks for any help!!

    Hi,
    I generally put a Write-Output in each branch that will tell me where I am. Here's an example:
    $trigger = 1
    If ($trigger -eq 1) {
    Write-Output 'Found #1'
    } ElseIf ($trigger -eq 2) {
    Write-Output 'Found #2'
    } ElseIf ($trigger -eq 3) {
    Write-Output 'Found #3'
    } Else {
    Write-Output 'Found something else'
    Don't retire TechNet! -
    (Don't give up yet - 13,085+ strong and growing)

  • How to change object background color on  java run time

    Hi,
    I create object loading program. my problem is run time i change object background color using color picker. i select any one color of color picker than submit. The selecting color not assign object background.
    pls help me? How to run time change object background color?
    here follwing code
    import com.sun.j3d.loaders.objectfile.ObjectFile;
    import com.sun.j3d.loaders.ParsingErrorException;
    import com.sun.j3d.loaders.IncorrectFormatException;
    import com.sun.j3d.loaders.Scene;
    import java.applet.Applet;
    import java.awt.*;
    import java.awt.event.*;
    import com.sun.j3d.utils.applet.MainFrame;
    import com.sun.j3d.utils.universe.*;
    import javax.media.j3d.*;
    import javax.vecmath.*;
    import java.io.*;
    import com.sun.j3d.utils.behaviors.vp.*;
    import java.net.URL;
    import java.net.MalformedURLException;
    import java.awt.Graphics ;
    import javax.swing.*;
    public class ObjLoad1 extends Applet implements ActionListener
    private boolean spin = false;
    private boolean noTriangulate = false;
    private boolean noStripify = false;
    private double creaseAngle = 60.0;
    private URL filename = null;
    private SimpleUniverse u;
    private BoundingSphere bounds;
    private Panel cardPanel;
    private Button Tit,sub;
    private CardLayout ourLayout;
    private BorderLayout bl;
    Background bgNode;
    BranchGroup objRoot;
    List thelist;
    Label l1;
    public BranchGroup createSceneGraph()
    BranchGroup objRoot = new BranchGroup();
    TransformGroup objScale = new TransformGroup();
    Transform3D t3d = new Transform3D();
    t3d.setScale(0.7);
    objScale.setTransform(t3d);
    objRoot.addChild(objScale);
    TransformGroup objTrans = new TransformGroup();
    objTrans.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);
    objTrans.setCapability(TransformGroup.ALLOW_TRANSFORM_READ);
    objScale.addChild(objTrans);
    int flags = ObjectFile.RESIZE;
    if (!noTriangulate) flags |= ObjectFile.TRIANGULATE;
    if (!noStripify) flags |= ObjectFile.STRIPIFY;
    ObjectFile f = new ObjectFile(flags,(float)(creaseAngle * Math.PI / 180.0));
    Scene s = null;
         try {
              s = f.load(filename);
         catch (FileNotFoundException e) {
         System.err.println(e);
         System.exit(1);
         catch (ParsingErrorException e) {
         System.err.println(e);
         System.exit(1);
         catch (IncorrectFormatException e) {
         System.err.println(e);
         System.exit(1);
         objTrans.addChild(s.getSceneGroup());
         bounds = new BoundingSphere(new Point3d(0.0,0.0,0.0), 100.0);
    if (spin) {
         Transform3D yAxis = new Transform3D();
         Alpha rotationAlpha = new Alpha(-1, Alpha.INCREASING_ENABLE,0,0,4000,0,0,0,0,0);
         RotationInterpolator rotator = new RotationInterpolator(rotationAlpha,objTrans,yAxis,0.0f,(float) Math.PI*2.0f);
         rotator.setSchedulingBounds(bounds);
         objTrans.addChild(rotator);
    //Background color setting
    Color3f bgColor = new Color3f(100,200,230);
    bgNode = new Background(bgColor);
    bgNode.setApplicationBounds(bounds);
    objRoot.addChild(bgNode);
    return objRoot;
    private void usage()
    System.out.println("Usage: java ObjLoad1 [-s] [-n] [-t] [-c degrees] <.obj file>");
    System.out.println("-s Spin (no user interaction)");
    System.out.println("-n No triangulation");
    System.out.println("-t No stripification");
    System.out.println("-c Set crease angle for normal generation (default is 60 without");
    System.out.println("smoothing group info, otherwise 180 within smoothing groups)");
    System.exit(0);
    } // End of usage
    public void init() {
    if (filename == null) {
    try {
    URL path = getCodeBase();
    filename = new URL(path.toString() + "./galleon.obj");
    catch (MalformedURLException e) {
         System.err.println(e);
         System.exit(1);
         //setLayout(new BorderLayout());
         //setLayout(new GridLayout(5,0));
         //setLayout(new CardLayout());
         //setLayout(new FlowLayout(FlowLayout.LEFT, 5, 5));
    GraphicsConfiguration config = SimpleUniverse.getPreferredConfiguration();
    Canvas3D c = new Canvas3D(config);
    add(c);
    BranchGroup scene = createSceneGraph();
    u = new SimpleUniverse(c);
    ViewingPlatform viewingPlatform = u.getViewingPlatform();
    PlatformGeometry pg = new PlatformGeometry();
    Color3f ambientColor = new Color3f(45,27,15);
    AmbientLight ambientLightNode = new AmbientLight(ambientColor);
    ambientLightNode.setInfluencingBounds(bounds);
    pg.addChild(ambientLightNode);
    Color3f light1Color = new Color3f(111,222,222);
    Vector3f light1Direction = new Vector3f(1.0f, 1.0f, 1.0f);
    Color3f light2Color = new Color3f(1.0f, 1.0f, 1.0f);
    Vector3f light2Direction = new Vector3f(-1.0f, -1.0f, -1.0f);
    DirectionalLight light1 = new DirectionalLight(light1Color, light1Direction);
    light1.setInfluencingBounds(bounds);
    pg.addChild(light1);
    DirectionalLight light2 = new DirectionalLight(light2Color, light2Direction);
    light2.setInfluencingBounds(bounds);
    pg.addChild(light2);
    viewingPlatform.setPlatformGeometry(pg);
    viewingPlatform.setNominalViewingTransform();
    if (!spin) {
    OrbitBehavior orbit = new OrbitBehavior(c,OrbitBehavior.REVERSE_ALL);
    BoundingSphere bounds = new BoundingSphere(new Point3d(0.0, 0.0, 0.0), 100.0);
    orbit.setSchedulingBounds(bounds);
    viewingPlatform.setViewPlatformBehavior(orbit);     
    u.addBranchGraph(scene);
         public ObjLoad1(String[] args) {
              if (args.length != 0) {
                   for (int i = 0 ; i < args.length ; i++) {
                        if (args.startsWith("-")) {
                             if (args[i].equals("-s")) {
                                  spin = true;
                             } else if (args[i].equals("-n")) {
                                  noTriangulate = true;
                             } else if (args[i].equals("-t")) {
                                  noStripify = true;
                             } else if (args[i].equals("-c")) {
                                  if (i < args.length - 1) {
                                       creaseAngle = (new Double(args[++i])).doubleValue();
                                  } else usage();
                             } else {
                                  usage();
                        } else {
                             try {
                                  if ((args[i].indexOf("file:") == 0) ||
                                            (args[i].indexOf("http") == 0)) {
                                       filename = new URL(args[i]);
                                  else if (args[i].charAt(0) != '/') {
                                       filename = new URL("file:./" + args[i]);
                                  else {
                                       filename = new URL("file:" + args[i]);
                             catch (MalformedURLException e) {
                                  System.err.println(e);
                                  System.exit(1);
    public void actionPerformed(ActionEvent e)
         if (e.getSource() == Tit)
    //Color Picker tool
              Color c1 = JColorChooser.showDialog(((Component)e.getSource()).getParent(),"Zaxis Color Picker", Color.blue);
              cardPanel.setBackground(c1);
              objRoot.removeChild(bgNode);
              int a = c1.getRed();
              int b = c1.getBlue();
              int c = c1.getBlue();
              System.out.println(a);
              System.out.println(b);
              System.out.println(c);
              Color3f ccc = new Color3f(a,b,c);
              bgNode.setApplicationBounds(bounds);
         objRoot.addChild(bgNode);
         else
              System.out.println("mathi");
    public ObjLoad1()
    Tit = new Button("BG Color");
    sub = new Button("Object Color");
    cardPanel = new Panel();
    cardPanel.add(Tit);
    cardPanel.add(sub);
    //cardPanel.add(l1);
    //cardPanel.add(thelist);
    sub.addActionListener(this);
    Tit.addActionListener(this);
    // thelist.addActionListener(this);
    //setLayout for applet to be BorderLayout
    this.setLayout(new BorderLayout());
    //button Panel goes South, card panels go Center
    this.add(cardPanel, BorderLayout.SOUTH);
    //this.add(cardPanel, BorderLayout.CENTER);     
    this.setVisible(true);
    public void destroy() {
    public static void main(String[] args) {
         new MainFrame(new ObjLoad1(args),400, 400);

    hi,
    i am using setColor(Color3f color) method
    like
    if (e.getSource() == Tit)
              Color c1 = JColorChooser.showDialog(((Component)e.getSource()).getParent(),"Zaxis Color Picker", Color.blue);
              bgColor = new Color3f(c1);
              System.out.println(bgColor.get());
         bgNode.setColor(bgColor);
         bgNode.setApplicationBounds(bounds);
         objRoot.addChild(bgNode);
    but error will be displayed
    like
    javax.media.j3d.CapabilityNotSetException: Background: no capability to set color
         at javax.media.j3d.Background.setColor(Background.java:307)
         at ObjLoad1.actionPerformed(ObjLoad1.java:230)
         at java.awt.Button.processActionEvent(Unknown Source)
         at java.awt.Button.processEvent(Unknown Source)
         at java.awt.Component.dispatchEventImpl(Unknown Source)
         at java.awt.Component.dispatchEvent(Unknown Source)
         at java.awt.EventQueue.dispatchEvent(Unknown Source)
         at java.awt.EventDispatchThread.pumpOneEventForHierarchy(Unknown Source)
         at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
         at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
         at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
         at java.awt.EventDispatchThread.run(Unknown Source)
    pls help me

  • How do I compare two csv files and not disable the user if the username is found in the 2nd file using powershell?

    Hi Guys
    I have two csv files with the following headers and I need to import both files into the script to check whether the StaffCode is present in the Creation/Renewal of Contract csv in a DisableAccount Script so I can stop any action to disable the account as
    the staff has renewed the contract with the company so the account should not be disabled.
    However my accounts are still being disabled. I am not sure now to construct the query so that it detects that the account is to be left alone if the staffcode is present in both files
    I does recognize that the $staffcodeN in the renewal file matches the $staffcode in the termination file
    but still proceeds to disable or set an expiry date to the account anyway based on the termination file. 
    How do I stop it from doing that?
    1)In the Creation/Renewal of contract file the following headers are present
         -  TranCode,StaffCode,LastName,FirstName,SocialSecurityNo,DateJoin,Grade,Dept,LastUpdateDate,EffectiveDate
    2)In the Disable of contract file the following headers are present
        - TranCode,StaffCode,LastName,FirstName,SocialSecurityno,LastDateWorked,Grade,Dept,LastUpdateDate,
    My data is not very clean , I have a-lot of special characters such as = , ' ,/ and \ characters to remove first before i can compare the data
    Thanks for the help in advance.
    Yours Sincrely
    Vicki
    The following is a short snippet of the code 
    $opencsv = import-csv "D:\scripts\Termination.csv"
    $opencsv2 = import-csv "D:\scripts\RenewContractandNewStaff.csv"
    foreach ($usertoaction in $opencsv) 
    $Trancode = $usertoactionTranCode
    $StaffCode = $usertoaction.StaffCode.replace("=","").replace('"','')
    $LastName = [string]$usertoaction.LastName.Replace("/","\/").Replace(",","\,")
    $FirstName = [string]$usertoaction.FirstName.Replace("/","\/").Replace(",","\,")
    $socialsecurityno = $usertoaction.SocialSecurityNo.replace("=","").replace('"','')
    $DateJoin = $usertoaction.DateJoin.replace("=","").replace('"','')
    $LastDateWorked = $usertoaction.LastDateWorked.replace("=","").replace('"','')
    $Grade = [string]$usertoaction.Grade
    $Dept = [string]$usertoaction.Dept
    $LastUpdateDate = $usertoaction.LastUpdateDate.replace("=","").replace('"','')
    $AccountExpiry = [datetime]::Now.ToString($LastDateWorked)
    foreach ($usertoaction2 in $opencsv2) 
    $TrancodeN = $usertoaction2.TranCode
    $StaffCodeN = $usertoaction2.StaffCode.replace("=","").replace('"','')
    $socialsecurityNoN= $usertoaction2.SocialSecurityNo.replace("=","").replace('"','')
    $DateJoinN = $usertoaction2.DateJoin.replace("=","").replace('"','')
    $GradeN = [string]$usertoaction2.Grade
    $DeptN = $usertoaction2.Dept
    $LastUpdateDate = $usertoaction.LastUpdateDate.replace("=","").replace('"','')
    $EffectiveDate = $usertoaction.EffectiveDate.replace("=","").replace('"','')
    $LastName2 = [string]$usertoaction2.LastName.Replace(",", "").Replace("/","").trim()
    $FirstName2 = [string]$usertoaction2.FirstName.Replace("/","").trim()
    # Use DirectorySearcher to find the DN of the user from the sAMAccountName.
    $Domain = [System.DirectoryServices.ActiveDirectory.Domain]::GetCurrentDomain()
    $Root = $Domain.GetDirectoryEntry()
    $Searcher = [System.DirectoryServices.DirectorySearcher]$Root
    $Searcher.Filter = "(sAMAccountName=$samaccountname)"
    $doesuserexist1 = $Searcher.Findall()
    if ($doesuserexist1 -eq $Null)
    {Write-Host $samaccountname "account does not exist"}
    elseif ($StaffCodeN -match $staffcode)
    write-host "user has renewed the contract, no action taken"
    else
    if(($lastupdatedate -ne $null)-or($LastDateWorked -ne $null))
                        write-host "Setting Account Expiry to"$accountexpirydate
    #$ChangeUser.AccountExpires = $accountexpirydate
               #$Changeuser.setinfo()
    if ($UserMailforwarding -ne $null)
    #Set Account expiry date to Last Date Worked
    # $ChangeUser.AccountExpires = $accountexpirydate
    # $Changeuser.setinfo()
     write-host "staff" $displayname "with staff employee no" $samaccountname "has                          
    mailforwarding" 
    Write-host "Please disable the account manually via Active Directory Users & Computers and 
    Elseif ($accountexpirydate -lt $todaysdate)
    #disable the account

    Hi Vicki,
    This Forum has an insert-codeblock function. Using it will make your script far more readable
    Your script is missing some parts, it is impossible to follow the problem.
    You are performing the same string cleaning action on $opencsv2 for each element in $opencsv, when doing it once should suffice. Why not start it all by cleaning the values and storing the cleaned values in new arrays?
    The Compare-Object function is great, why not take it out for a stroll on these lists, it might just safe you lots of unnecessarily complicated code ...
    You are creating a new $Domain, $Root and $Searcher object each iteration, when doing it once should suffice. Probably not much of a time-saver, but every little thing contributes.
    Try pinpointing the problem by doing extensive logging, not only by writing which action was taken, but writing the inidividual information (variables, mostly) before evaluation occurs. Your if/elseif/else looks sound, so if it's still not doing what you
    want, the ingoing data must be different from what you think should be there.
    Cheers,
    Fred
    There's no place like 127.0.0.1

  • Running in invisible mode

    Hi,
    I have a Java Frame that i want to run in invisible mode. The problem is that i have to set it to visible first, then invisible otherwise it doesn't seem to execute. Also if i set it to ICONIFIED, the program doesn't run until it is maximized.
    How can i make it so i never have to make it visible and have it still run?
    Thanks for any help.

    First explain what you mean by "executing a frame". Hi, this is the first time i have done anything in Java. I am trying to run this java program from a C program, but don't want to see the window pop up at all. But if i don't have the f.setVisible(true) where it is, the viewer modules, which are capturing streaming data and writing to bmp's to not work. The same is true if i set to ICONIFIED.
    Thanks, hope this helps...
    public static void main(String args[])
    ms_standalone = true;
    Frame f = new Frame(AppID.getAppID().getAppName());
    f.addWindowListener(new WindowAdapter() {
    public void windowClosing(WindowEvent we)
    System.exit(0);
    f.setSize(352, 320);
    f.setLayout(new BorderLayout());
    int numCams = 0;
    StringBuffer concatURL = new StringBuffer();
    for (int i=0;i< args.length;i++)
    String arg = args;
    if (arg.startsWith("-")) {
    int eqidx = arg.indexOf("=")+1;
    if (arg.startsWith("-num=")) {
    numCams = Character.getNumericValue(arg.charAt(eqidx));
    } else {
    usage();
    System.exit(0);
    } else {
    if (concatURL.length() != 0)
    concatURL.append("|");
    concatURL.append(arg.trim());
    // create multiple viewers
    Viewer cv[] = new Viewer[numCams];
    for (int i = 0;i < numCams; i++) {
    cv[i] = new Viewer();
    cv[i].m_parameters.put(PAR_ACCESSORIES, "none");
    String tmpStr = concatURL.toString() + i + ".a";
    cv[i].m_parameters.put("url", tmpStr);
    cv[i].m_camNum = i;
    f.add(BorderLayout.CENTER, cv[i]);
    cv[i].init();
    f.setVisible(true);
    cv[i].start();
    f.setVisible(false);

  • Login with conditions problems

    What is wrong with this function? I am trying to create a
    user login that
    checks to make sure the user is in the database first, then
    check the active
    level. If the level is 1 then set sessions and redirect, if 2
    then redirect
    to the login page and send a URL variable of
    account=suspended, if 0 then
    redirect to the login page sending a URL variable of
    account=inactive, etc.
    I want to query the db first to see if the user is in the
    datasbase. If yes,
    then check the active number. I am getting this error in the
    conditional
    statement to check the 'active' column.
    'You have attempted to dereference a scalar variable of type
    class
    java.lang.String as a structure with members'
    What am I missing?
    <cffunction name="UserLogin" access="remote"
    returntype="void">
    <cfargument name="username" type="string"
    required="yes">
    <cfargument name="password" type="string"
    required="yes">
    <cfquery name="login" datasource="***">
    Select username, password, priv FROM users_database
    WHERE username='#arguments.username#' AND
    password='#arguments.password#'
    </cfquery>
    <cfif login.recordcount NEQ 0>
    <cfif login.active EQ 1>
    <cflock scope="session" timeout="30" type="exclusive">
    <cfset Session.MM_Username = #arguments.username#>
    <cfset Session.SitePriv = #login.priv#>
    </cflock>
    <cflocation url="/clinic/contribute/main/index.cfm"
    addtoken="no">
    <cfelseif login.active EQ 0>
    <cflocation
    url="/clinic/contribute/index.cfm?account=inactive"
    addtoken="no">
    <cfelseif login.active EQ 2>
    <cflocation
    url="/clinic/contribute/index.cfm?account=suspended"
    addtoken="no">
    <cfelseif login.active EQ 3>
    <cflocation
    url="/clinic/contribute/index.cfm?account=banned"
    addtoken="no">
    </cfif>
    <cfelse>
    <cflocation
    url="/clinic/contribute/index.cfm?login=failed" addtoken="no">
    </cfif>
    </cffunction>

    Sabaidee as covered why your code didn't work. here's some
    more pointers
    where your code could be improved...
    > <cffunction name="UserLogin" access="remote"
    returntype="void">
    Set output="false" on all methods unless you actually are
    outputting stuff
    from them (which generally you should not).
    I doubt this method would be appropriate for calling as a
    webservice (given
    it ends with a <cflocation>), so don't expose it as
    one. access="public".
    Add hints to all your <cffunction> and
    <cfargument> tags. It assists
    sanity checking and code documentation.
    > <cfquery name="login" datasource="***">
    You have not VARed the login variable. This is poor practice
    unless you
    explicitly mean to not VAR it.
    > WHERE username='#arguments.username#' AND
    password='#arguments.password#'
    Always use <cfqueryparam> tags. It improves performance
    and reduces memory
    consumption on your DB server.
    > <cflock scope="session" timeout="30"
    type="exclusive">
    > <cfset Session.MM_Username = #arguments.username#>
    > <cfset Session.SitePriv = #login.priv#>
    > </cflock>
    There's no need to lock this sort of variable assignment.
    > <cflocation url="/clinic/contribute/main/index.cfm"
    addtoken="no">
    It's pretty poor practice to use <cflocation> within a
    function. You CFM
    page should call a method, and get a response back from it.
    And then the
    CFM page should decide whether to <cflocation> or not.
    Possibly your
    function should set the URL for the <cflocation> and
    return the value.
    Then the calling code should use than in a <cflocation>
    call.
    > <cfelseif login.active EQ 0>
    This if/elseif/else construct would be better done as a
    switch. Rule of
    thumb: evaluating the same variable for many conditions:
    switch.
    evaluating different variables for many conditions:
    if/elseif/else.
    Adam

  • How to create a decision tree in ABAP (in SAP or not, and how????)

    Hello,
    I have to create a decision tree which has to be called within a BAPI.
    This tree finally has to return 1 single value.
    Can you tell me what's the best solution for this ?
    Should I do this with abap, or should I call a webapplication which provides this tree for me ?
    It would be great if you could provide some example-code for me.
    Kind regards,
    Gert-Jan

    I am not sure I understood what you meant by decision tree. If you are simply talking about arriving at an answer based on one or more inputs, then it is a simple IF ELSEIF ELSE statements or CASE statements.
    Can you please elaborate/give example of what you mean by decision tree?

  • Process InfoPackage based on a condition in Process Chain

    Hi,
    I would like to include a Function Module in my Process Chain.Based on the output of the Function Module (example Flag - 'A','B','C') I would like to load data from Infopackage.
    Could you please suggest the best possible solution.
    Thanks,
    Nimai

    then you need a decision step...
    as you want to use a FM to get the outcome, you can't use the standard decision step as you can only use a formula...
    so you need to implement a new decision step...look on sdn for the how to paper 'Enhanced Decision Process Type for BW Process Chains'...
    this how to paper will lead you to create a process step of the type decision but you can use abap forms (take a look at it and it will become clear)...once you have done this, drag/drop the step in your chain. within the variant, you can define the result of the if, elseif, else...you can add as much elseif as you want (a lot in any case)...you need to create for every 'if' the form using the FM... back in the process chain you can link this step to all the infopackages, and indicate the result of the decision step leading to the infopackage execution...
    that's the nice way...
    the easy way :
    create for every infopackage a single process chain (you can easily copy them)...they should start after event EV_A, EV_B, and so on...every chain after another event...now create an abap program and call the function module...now depending on the outcome of your FM you can trigger one of the events and the corresponding chain will start, leading to the correct infopackage being loaded.
    look on abap forum on more info about event triggering, how to create event,...

Maybe you are looking for

  • Why is ISDN so much down lately?

    Hi, I encounter lately difficulties accessing SDN. Last week I got stuff like Internal Server Error 500! java.lang.NullPointerException when simply posting a forum message. Yesterday and this morning I got messages that it was down for approx an hour

  • Query on Mail Receiver Adapter

    Hello Experts, I am using Asyn Proxy to Mail Scenario. Mail receiver adapter generating the Mail with Excel file attachment by using the following details. R3 coding (Proxy calling code):-       G_ALERT_INPUT-MT_R3REQUEST_MAIL_SEND-MAIL-FROM = From M

  • Discrepancies between following error readings in NI-MAX

    We are currently investigating the source of following errors in our systems. Maybe there is something wrong with our setup. We are using stepper motors with third party drivers and incremental encoders. We are using our own test program which perfor

  • Message inbox shortcuts stopped working..!

    I have a Blackberry Curve 8900 through t-mobile and when I woke up this morning my inbox shortcuts stopped working. T-top, B-bottom, U-unread, etc... did they get turned off by mistake? Any help? Thank you!

  • Safari always freezes

    Safari constantly freezes up & I get the pinwheel.. the only way to reduce the pinwheel frequency is to open Chrome & minimize the page, then continue using Safari.. (Chrome is completely NON-usable for any other purpose since this started also)... t