How to check a particular string in address

hi,
I need to check if my address has "freemans" or "foodstuffs or 'db.co.nz, then give a defautl email address. hence i coded like this
zstmp_addr type ZCHAR60.
IF ( ts_filerefs-zsmtp_addr CA 'foodstuffs' ) AND
       ( ts_filerefs-zsmtp_addr CA 'freemans' ) AND
       ( ts_filerefs-zsmtp_addr CA 'fremans' )  AND
       ( ts_filerefs-zsmtp_addr CA 'db.co.nz' ) .
    ts_filerefs-zsmtp_addr = 'mail123  ed.com'
endif.
This code works fine say if zsmtp_addr = Ben.shield  itcom , comes out of IF condition.
But if I give zstmp_addr = jayasree.muthaiyan  it.com, goes in to IF condition ---> Error....
why it goes inside this IF condition...is there any better coding for this ///
thanks
kinldy help

Hi,
And operator will not work in your case. And instead of CA use 'CS' operator. Refer below code.
IF ( ts_filerefs-zsmtp_addr Cs 'foodstuffs' ) OR
( ts_filerefs-zsmtp_addr CS 'freemans' ) OR
( ts_filerefs-zsmtp_addr CS 'fremans' ) OR
( ts_filerefs-zsmtp_addr CS 'db.co.nz' ) .
ts_filerefs-zsmtp_addr = 'mail123 ed.com'
endif.
Thanks,
Archana

Similar Messages

  • How to search for particular string in array?

    I am struggling to figure out how to search array contents for a string and then delete the entry from the array if it is found.
    The code for a program that allows the user to enter up to 20 inventory items (tools) is posted below; I apologize in advance for it as I am also not having much success grasping the concept of OOP and I am certain it is does not conform although it all compiles.
    Anyway, if you can provide some assistance as to how to go about searching the array I would be most grateful. Many thanks in advance..
    // ==========================================================
    // Tool class
    // Reads user input from keyboard and writes to text file a list of entered
    // inventory items (tools)
    // ==========================================================
    import java.io.*;
    import java.text.DecimalFormat;
    public class Tool
    private String name;
    private double totalCost;
    int units;
      // int record;
       double price;
    // Constructor for Tool
    public Tool(String toolName, int unitQty, double costPrice)
          name  = toolName;
          units = unitQty;
          price = costPrice;
       public static void main( String args[] ) throws Exception
          String file = "test.txt";
          String input;
          String item;
          String addItem;
          int choice = 0;
          int recordNum = 1;
          int qty;
          double price;
          boolean valid;
          String toolName = "";
          String itemQty = "";
          String itemCost = "";
          DecimalFormat fmt = new DecimalFormat("##0.00");
          // Display menu options
          System.out.println();
          System.out.println(" 1. ENTER item(s) into inventory");
          System.out.println(" 2. DELETE item(s) from inventory");
          System.out.println(" 3. DISPLAY item(s) in inventory");
          System.out.println();
          System.out.println(" 9. QUIT program");
          System.out.println();
          System.out.println("==================================================");
          System.out.println();
          // Declare and initialize keyboard input stream
          BufferedReader stdin = new BufferedReader(new InputStreamReader(System.in));
          do
             valid = false;
             try
                System.out.print(" Enter an option > ");
                input = stdin.readLine();
                choice = Integer.parseInt(input);
                System.out.println();
                valid = true;
             catch(NumberFormatException exception)
                System.out.println();
                System.out.println(" Only numbers accepted. Try again.");
          while (!valid);
          while (choice != 1 && choice != 2 && choice != 9)
                System.out.println(" Not a valid option. Try again.");
                System.out.print(" Enter an option > ");
                input = stdin.readLine();
                choice = Integer.parseInt(input);
                System.out.println();
          if (choice == 1)
             // Declare and initialize input file
             FileWriter fileName = new FileWriter(file);
             BufferedWriter bufferedWriter = new BufferedWriter(fileName);
             PrintWriter dataFile = new PrintWriter(bufferedWriter);
             do
                addItem="Y";
                   System.out.print(" Enter item #" + recordNum + " name > ");
                   toolName = stdin.readLine();
                   if (toolName.length() > 15)
                      toolName = toolName.substring(0,15); // Convert to uppercase
                   toolName = toolName.toUpperCase();
                   dataFile.print (toolName + "\t");
                   do
                      valid = false;
                      try
                         // Prompt for item quantity
                         System.out.print(" Enter item #" + recordNum + " quantity > ");
                         itemQty = stdin.readLine();
                         // Parse integer as string
                         qty = Integer.parseInt (itemQty);
                         // Write item quantity to data file
                         dataFile.print(itemQty + "\t");
                         valid=true;
                      catch(NumberFormatException exception)
                         // Throw error for all non-integer input
                         System.out.println();
                         System.out.println(" Only whole numbers please. Try again.");
                   while (!valid);
                   do
                      valid = false;
                      try
                         // Prompt for item cost
                         System.out.print(" Enter item #" + recordNum + " cost (A$) > ");
                         itemCost = stdin.readLine();
                         // Parse float as string
                         price = Double.parseDouble(itemCost);
                         // Write item cost to data file
                         dataFile.println(fmt.format(price));
                         valid = true;
                      catch(NumberFormatException exception)
                         // Throw error for all non-number input (integers
                      // allowed)
                         System.out.println();
                         System.out.println(" Only numbers please. Try again.");
                   while (!valid);
                   // Prompt to add another item
                   System.out.println();
                   System.out.print(" Add another item? Y/N > ");
                   addItem = stdin.readLine();
                   while ((!addItem.equalsIgnoreCase("Y")) && (!addItem.equalsIgnoreCase("N")))
                      // Prompt for valid input if not Y or N
                      System.out.println();
                      System.out.println(" Not a valid option. Try again.");
                      System.out.print(" Add another item? Y/N > ");
                      addItem = stdin.readLine();
                      System.out.println();
                   // Increment record number by 1
                   recordNum++;
                   if (addItem.equalsIgnoreCase("N"))
                      System.out.println();
                      System.out.println(" The output file \"" + file + "\" has been saved.");
                      System.out.println();
                      System.out.println(" Quitting program.");
            while (addItem.equalsIgnoreCase("Y"));
    // Close input file
    dataFile.close();
       if (choice == 2)
       try {
          Read user input (array search string)
          Search array
          If match found, remove entry from array
          Confirm "deletion" and display new array contents
       catch block {
    } // class
    // ==========================================================
    // ListToolDetails class
    // Reads a text file into an array and displays contents as an inventory list
    // ==========================================================
    import java.io.*;
    import java.util.StringTokenizer;
    import java.text.DecimalFormat;
    public class ListToolDetails {
       // Declare variable
       private Tool[] toolArray; // Reference to an array of objects of type Tool
       private int toolCount;
       public static void main(String args[]) throws Exception {
          String line, name, file = "test.txt";
          int units, count = 0, record = 1;
          double price, total = 0;
          DecimalFormat fmt = new DecimalFormat("##0.00");
          final int MAX = 20;
          Tool[] items = new Tool[MAX];
          System.out.println("Inventory List");
          System.out.println();
          System.out.println("REC.#" + "\t" + "ITEM" + "\t" + "QTY" + "\t"
                + "PRICE" + "\t" + "TOTAL");
          System.out.println("\t" + "\t" + "\t" + "\t" + "PRICE");
          System.out.println();
          try {
             // Read a tab-delimited text file of inventory items
             FileReader fr = new FileReader(file);
             BufferedReader inFile = new BufferedReader(fr);
             StringTokenizer tokenizer;
             while ((line = inFile.readLine()) != null) {
                tokenizer = new StringTokenizer(line, "\t");
                name = tokenizer.nextToken();
                try {
                   units = Integer.parseInt(tokenizer.nextToken());
                   price = Double.parseDouble(tokenizer.nextToken());
                   items[count++] = new Tool(name, units, price);
                   total = units * price;
                } catch (NumberFormatException exception) {
                   System.out.println("Error in input. Line ignored:");
                   System.out.println(line);
                System.out.print(" " + count + "\t");
                System.out.print(line + "\t");
                System.out.print(fmt.format(total));
                System.out.println();
             inFile.close();
          } catch (FileNotFoundException exception) {
             System.out.println("The file " + file + " was not found.");
          } catch (IOException exception) {
             System.out.println(exception);
          System.out.println();
       //  Unfinished functionality for displaying "error" message if user tries to
       //  add more than 20 tools to inventory
       public void addTool(Tool maxtools) {
          if (toolCount < toolArray.length) {
             toolArray[toolCount] = maxtools;
             toolCount += 1;
          } else {
             System.out.print("Inventory is full. Cannot add new tools.");
       // This should search inventory by string and remove/overwrite matching
       // entry with null
       public Tool getTool(int index) {
          if (index < toolCount) {
             return toolArray[index];
          } else {
             System.out
                   .println("That tool does not exist at this index location.");
             return null;
    }  // classData file contents:
    TOOL 1     1     1.21
    TOOL 2     8     3.85
    TOOL 3     35     6.92

    Ok, so you have an array of Strings. And if the string you are searching for is in the array, you need to remove it from the array.
    Is that right?
    Can you use an ArrayList<String> instead of a String[ ]?
    To find it, you would just do:
    for (String item : myArray){
       if (item.equals(searchString){
          // remove the element. Not trivial for arrays, very easy for ArrayList
    }Heck, with an arraylist you might be able to do the following:
    arrayList.remove(arrayList.indexOf(searchString));[edit]
    the above assumes you are using 1.5
    uses generics and for each loop
    [edit2]
    and kinda won't work it you have to use an array since you will need the array index to be able to remove it. See the previous post for that, then set the value in that array index to null.
    Message was edited by:
    BaltimoreJohn

  • How to check wether a string is a number

    hi,
    I have a string variable like this.
    I want to check wether that variable contains a number or not.Pls tell wether there is a java command to check it.
    Thanks,
    chamal.

    try
    int x = Integer.parseInt(mystring);
    catch(NumberFormatExcpetion nfe)
    // not a valid integer
    }You need to declare x outside the try block, otherwise you won't be able to access it outside.

  • How to remove a particular email id address in outlook 2013.

    Dear Support,
    We are using outlook 2013 as a POP account.I want to remove/Delete a particular email id in outlook 2013.
    Your support is highly appreciated.
    Regards
    Pradeep.R

    Hi,
    According to your description, I am not quite sure about your requirement. What’s the exact meaning about “a particular email id” in your posting?
    If you want to remove a message which is send by a particular email address, we can create a Inbox Rule to delete it. For example:
    Please provide more information about your requirement, and we are glad to be of assistance for your issue.
    Regards,
    Winnie Liang
    TechNet Community Support

  • How to check length of string attribute(from viewobject) on jspx ?

    Hi,
    JDEV : 11.1.1.4
    I am using carousel component inside that i am using Descrip attribute to show the content on carousel item,
    Now i want to display a more link , whenever the length of Descrip is greater than 150 characters.
    Currently from backing bean i am setting the chklength property based on length to true or false but the problem is i need to set a partial target
    and because of that my carousel component i getting refreshed every time.. is there any way to check the length in jspx page itself inside the vissible property
    this is my code
    <af:outputText value="#{item.bindings.Descrip.inputValue}"
                                                             id="ot49"/>
                                               <af:commandImageLink text="more.." id="moreid" shortDesc="click to see more.."
                                                                     visible="#{pageFlowScope.chklength}">
                                                <af:showPopupBehavior popupId="::p1"/>
                                                </af:commandImageLink>              thanks
    Gopinath

    i have added taglib like this,
    xmlns:fn="http://java.sun.com/jsp/jstl/functions"
    but its showing error on below expression
    visible="${fn:length(item.bindings.Descrip.inputValue) > 150}"
    error : BooleanSimnpleTypeConvertor:"${fn:length(item.bindings.Descrip.inputValue) > 150}" cannot be converted to this type

  • How to search a particular string in whole schema?

    Hi Everyone,
    My DB version is
    Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - 64bi
    PL/SQL Release 10.2.0.1.0 - Production
    "CORE 10.2.0.1.0 Production"
    TNS for Linux: Version 10.2.0.1.0 - Production
    NLSRTL Version 10.2.0.1.0 - Production
    Suppose I have a column say "EMAIL_ID" in employee table. The employee name is "abcd" and his email_id is "[email protected]".
    The column name is changing from "EMAIL_ID" to "EMAIL_ADDRESS" due to poor naming convention standard.
    Now I've only one constant value i.e. "[email protected]"...So is there any way if I will write a query with this value and I'll get the list of
    tables and the exact column name where this mail_id exists?
    Regards,
    BS2012.

    create or replace
    PROCEDURE value_search_db(p_string VARCHAR2,p_datatype VARCHAR2)
    IS
    S SYS_REFCURSOR;
    CURSOR c_user_col IS
    SELECT TABLE_NAME,COLUMN_NAME,DATA_TYPE FROM USER_TAB_COLUMNS,TAB
    WHERE TABLE_NAME=TNAME AND TABTYPE='TABLE'
    ORDER BY TABLE_NAME;
    TYPE TAB_LIST
    IS
      RECORD
        TABLE_NAME VARCHAR2(1000),
        COLUMN_NAME     VARCHAR2(1000),
        DATA_TYPE    VARCHAR2(100));
    TYPE T_TAB_LIST
    IS
      TABLE OF TAB_LIST;
      L_TAB_LIST T_TAB_LIST := T_TAB_LIST();
      L_STMT CLOB;
      l_exists NUMBER;
    BEGIN
    FOR i IN c_user_col LOOP
      L_TAB_LIST.EXTEND;
      L_TAB_LIST(L_TAB_LIST.LAST).TABLE_NAME := I.TABLE_NAME;
      L_TAB_LIST(L_TAB_LIST.LAST).COLUMN_NAME     := i.COLUMN_NAME;
      L_TAB_LIST(L_TAB_LIST.LAST).DATA_TYPE     := i.DATA_TYPE; 
    END LOOP;
    FOR i in 1..L_TAB_LIST.COUNT LOOP
        l_exists := NULL;
        IF L_TAB_LIST(I).DATA_TYPE = p_datatype THEN
          L_STMT := 'SELECT 1 FROM '||L_TAB_LIST(I).TABLE_NAME||' WHERE '
                      ||L_TAB_LIST(I).COLUMN_NAME||' LIKE ''%'||p_string||'%''';
          OPEN S FOR L_STMT;
          FETCH S INTO l_exists;
          CLOSE S;
          IF l_exists IS NULL THEN
          NULL;
          ELSE
            DBMS_OUTPUT.PUT_LINE('Table name: '||L_TAB_LIST(I).TABLE_NAME||'--Column Name: '||L_TAB_LIST(I).COLUMN_NAME);
            DBMS_OUTPUT.PUT_LINE(L_STMT);
          END IF;
        END IF;
    END LOOP;
    END value_search_db;
    I t may help you.:-)

  • How to check particular error in alert log file

    Hi all,
    How to check particular error in alert log file,for supose if i get error in batabase yesterday 4 pm & today i want to check alert log file to get basic idea..it might be a big file so how to check that particular error..
    Thanks & regards,
    Eswar..

    What's your oracle version?
    If you are in 11g you can use adrci tool
    1- set homes diag/rdbms/orawiss/ORAWISS/ : the rdbms home
    2- show alert -P "MESSAGE_TEXT LIKE '%ORA-%'" -term : to find all the ORA-% errors in the alert file
    3- show alert -P "MESSAGE_TEXT LIKE '%ORA-%' and originating_timestamp > systimestamp-51 " -term : to find all the ORA-% errors in the alert file during the last 51 days,
    4- show alert -P "MESSAGE_TEXT LIKE '%ORA-%' and originating_timestamp > systimestamp-1/24 " -term : to find all the ORA-% errors in the alert file during the last hour,
    5- show alert -P "MESSAGE_TEXT LIKE '%ORA-12012%' and originating_timestamp > systimestamp-1/24 " -term : to find the particular ORA-12012 error in the alert file during the last hour,
    Example:
    [oracle@wissem wissem]$ adrci
    ADRCI: Release 11.2.0.1.0 - Production on Wed May 4 10:24:54 2011
    Copyright (c) 1982, 2009, Oracle and/or its affiliates.  All rights reserved.
    ADR base = "/home/oracle/app/oracle"
    adrci> set homes diag/rdbms/orawiss/ORAWISS/
    adrci> show alert -P "MESSAGE_TEXT LIKE '%ORA-'" -term
    ADR Home = /home/oracle/app/oracle/diag/rdbms/orawiss/ORAWISS:
    adrci> show alert -P "MESSAGE_TEXT LIKE '%ORA-%'" -term
    ADR Home = /home/oracle/app/oracle/diag/rdbms/orawiss/ORAWISS:
    2010-12-11 19:45:41.289000 +01:00
    ORA-1109 signalled during: ALTER DATABASE CLOSE NORMAL...
    ORA-01547: warning: RECOVER succeeded but OPEN RESETLOGS would get error below
    ORA-01152: file 1 was not restored from a sufficiently old backup
    ORA-01110: data file 1: '/home/oracle/app/oracle/oradata/ORAWISS/system01.dbf'
    ORA-1547 signalled during: ALTER DATABASE RECOVER  database until time '2011-01-21:10:48:00'  ...
    Errors in file /home/oracle/app/oracle/diag/rdbms/orawiss/ORAWISS/trace/ORAWISS_j000_5692.trc:
    ORA-12012: error on auto execute of job 29
    ORA-01435: user does not exist
    2011-03-15 11:39:37.571000 +01:00
    opiodr aborting process unknown ospid (31042) as a result of ORA-609
    2011-03-15 12:04:15.111000 +01:00
    opiodr aborting process unknown ospid (3509) as a result of ORA-609
    adrci>
    adrci> show alert -P "MESSAGE_TEXT LIKE '%ORA-%' and originating_timestamp > systimestamp-51 " -term
    ADR Home = /home/oracle/app/oracle/diag/rdbms/orawiss/ORAWISS:
    2011-03-15 10:19:45.316000 +01:00
    Errors in file /home/oracle/app/oracle/diag/rdbms/orawiss/ORAWISS/trace/ORAWISS_j006_5536.trc:
    ORA-12012: error on auto execute of job 26
    ORA-01435: user does not exist
    Errors in file /home/oracle/app/oracle/diag/rdbms/orawiss/ORAWISS/trace/ORAWISS_j000_5692.trc:
    ORA-12012: error on auto execute of job 29
    ORA-01435: user does not exist
    2011-03-15 11:39:37.571000 +01:00
    opiodr aborting process unknown ospid (31042) as a result of ORA-609
    2011-03-15 12:04:15.111000 +01:00
    opiodr aborting process unknown ospid (3509) as a result of ORA-609
    adrci>

  • How to edit xml file particular value. and how to send xml file over ip address 192.168.2.10 using ftp

    how to edit xml file particular value. and how to send xml file over ip address 192.168.2.10 device using ftp through Ethernet

    Hello
    For using FTP function in LabVIEW, I recommend you to check this document: FTP Basics
    Also, take a look at FTP Browser.vi, which is available at the Example Finder.
    To edit a XML file, try to use VIs in XML palette. Maybe Write to XML.vi helps you.
    Post your current VI if possible.
    Regards
    Mondoni

  • How to check empty string and null? Assign same value to multiple variables

    Hi,
    1.
    How do I check for empty string and null?
    in_value IN VARCHAR2
    2. Also how do I assign same value to multiple variables?
    var_one NUMBER := 0;
    var_two NUMBER := 0;
    var_one := var_two := 0; --- Gives an error
    Thanks

    MichaelS wrote:
    Not always: Beware of CHAR's:
    Bug 727361: ZERO-LENGTH STRING DOES NOT RETURN NULL WHEN USED WITH CHAR DATA TYPE IN PL/SQL:
    SQL> declare
      2    l_str1   char (10) := '';
      3    l_str2   char (10) := null;
      4  begin
      5  
      6    if l_str1 is null
      7    then
      8      dbms_output.put_line ('oh STR1 is null');
      9    elsif l_str1 is not null
    10    then
    11      dbms_output.put_line ('oh STR1 is NOT null');
    12    end if;
    13  
    14    if l_str2 is null
    15    then
    16      dbms_output.put_line ('oh STR2 is null');
    17    elsif l_str2 is not null
    18    then
    19      dbms_output.put_line ('oh STR2 is NOT null');
    20    end if;
    21  end;
    22  /
    oh STR1 is NOT null
    oh STR2 is null
    PL/SQL procedure successfully completed.
    SQL> alter session set events '10932 trace name context forever, level 16384';
    Session altered.
    SQL> declare
      2    l_str1   char (10) := '';
      3    l_str2   char (10) := null;
      4  begin
      5  
      6    if l_str1 is null
      7    then
      8      dbms_output.put_line ('oh STR1 is null');
      9    elsif l_str1 is not null
    10    then
    11      dbms_output.put_line ('oh STR1 is NOT null');
    12    end if;
    13  
    14    if l_str2 is null
    15    then
    16      dbms_output.put_line ('oh STR2 is null');
    17    elsif l_str2 is not null
    18    then
    19      dbms_output.put_line ('oh STR2 is NOT null');
    20    end if;
    21  end;
    22  /
    oh STR1 is null
    oh STR2 is null
    PL/SQL procedure successfully completed.
    SQL> SY.

  • To verify my iCloud account the phone tells me to check my email at an address that is not mine.  How do I fix this?

    iCloud on my pone states the account is not verified, but then directs me to check my email at an address that is not mine.  How do I correct this?

    Welcome to the Apple Support Communities
    That's a problem that all users of a second-hand Mac released after the OS X Lion launch have. OS X, iPhoto, iMovie and GarageBand are registered to the Apple ID the first owner used to register the computer, so you can't use them legally without repurchasing them. Furthermore, there's a bigger problem: you have to get iPhoto, iMovie and GarageBand on a DVD, because the App Store makes impossible to purchase these applications on a second-hand Mac.
    Nothing will happen if they are already installed, but you won't be able to reinstall and update them, so I recommend you to delete them and buy iLife '11 on a DVD to install the applications from there. Also, take note that you can't also reinstall OS X, so if OS X gets damaged, you will have to take your computer to an Apple Store.
    Open  > About this Mac, and tell us the OS X version you have. If you are using OS X Lion, you can upgrade to Mountain Lion with your Apple ID, so then you will be able to reinstall OS X

  • How to check the hardware vendor of a particular device

    Hi every one
    in the recent interview i have taken he asked me a question like
    how to check the hardware vendor of a particular device
    ex: hard disk ,nic card ,ram
    Thanks in Advance.......

    hi
    depends on OS version
    in RedHat like distros e.g.:
    lspci, lsusb, ls...
    dmidecode|grep -i manuf
    kudzu -p -s
    on Solaris you can use these :
    dladm show-dev
    dladm show-link
    prtconf -D
    kstat [-P]
    Edited by: g777 on 2011-03-11 07:24

  • Reg:How to check Vendor for particular Asset

    HI
    How to check Vendor for particular Asset?
    regards
    JK rao

    Hi,
    Good morning and greetings,
    It would be very difficult to go into each and every asset and display the asset...instead create a quick viewer query using SQVI and use the table ANLA and the field name is LIFNR for Vendor Code and for Asset Number it is ANLN1.
    Please reward points if found useful
    Thanking you
    With kindest regards
    Ramesh Padmanabhan

  • How to fill color in a cell having particular string when using convertto-html

    Hello Scripters,
    I have downloaded AD health check script but I am wondering if the cell color be changed for a particular string. Like all the cells having text "Failed"..should be in red color.
    Here is the script-
    Function Getservicestatus($service, $server)
    $st = Get-service -computername $server | where-object { $_.name -eq $service }
    if($st)
    {$servicestatus= $st.status}
    else
    {$servicestatus = "Not found"}
    Return $servicestatus
    $Forest = [system.directoryservices.activedirectory.Forest]::GetCurrentForest()
    [string[]]$computername = $Forest.domains | ForEach-Object {$_.DomainControllers} | ForEach-Object {$_.Name}
    #Section -1
    $report= @()
    foreach ($server in $computername){
    $temp = "" | select server, pingstatus
    if ( Test-Connection -ComputerName $server -Count 1 -ErrorAction SilentlyContinue ) {
    $temp.pingstatus = "Pinging"
    else {
    $temp.pingstatus = "Not pinging"
    $temp.server = $server
    $report+=$temp
    $b = $report | select server, pingstatus | ConvertTo-HTML -Fragment -As Table -PreContent "<h2>Server Availability</h2>" | Out-String
    #Section - 2
    $report = @()
    foreach ($server in $computername){
    $temp = "" | select server, KDC, NtFrs, DFSR, netlogon, w32Time
    $temp.server = $server
    $temp.KDC = Getservicestatus -service "KDC" -server $server
    $temp.NtFrs = Getservicestatus -service "NtFrs" -server $server
    $temp.DFSR = Getservicestatus -service "DFSR" -server $server
    $temp.netlogon = Getservicestatus -service "netlogon" -server $server
    $temp.w32Time = Getservicestatus -service "w32Time" -server $server
    $report+=$temp
    $b+= $REPORT | select server, KDC, NtFrs, DFSR, netlogon, w32Time | ConvertTo-HTML -Fragment -As Table -PreContent "<h2>Service Status</h2>" | Out-String
    #Section - 3
    add-type -AssemblyName microsoft.visualbasic
    $strings = "microsoft.visualbasic.strings" -as [type]
    $report = @()
    foreach ($server in $computername){
    $temp = "" | select server, Netlogon, Advertising, Connectivity, Replication
    $temp.server = $server
    $svt = dcdiag /test:netlogons /s:$server
    $svt1 = dcdiag /test:Advertising /s:$server
    $svt2 = dcdiag /test:connectivity /s:$server
    $svt3 = dcdiag /test:Replications /s:$server
    if($strings::instr($svt, "passed test NetLogons")){$temp.Netlogon = "Passed"}
    else
    {$temp.Netlogon = "Failed"}
    if($strings::instr($svt1, "passed test Advertising")){$temp.Advertising = "Passed"}
    else
    {$temp.Advertising = "Failed"}
    if($strings::instr($svt2, "passed test Connectivity")){$temp.Connectivity = "Passed"}
    else
    {$temp.Connectivity = "Failed"}
    if($strings::instr($svt3, "passed test Replications")){$temp.Replication = "Passed"}
    else
    {$temp.Replication = "Failed"}
    $report+=$temp
    $b+= $REPORT | select server, Netlogon, Advertising, Connectivity, Replication | ConvertTo-HTML -Fragment -As Table -PreContent "<h2>DCDIAG Test</h2>" | Out-String
    #Section - 4
    $workfile = repadmin.exe /showrepl * /csv
    $results = ConvertFrom-Csv -InputObject $workfile | where {$_.'Number of Failures' -ge 1}
    #$results = $results | where {$_.'Number of Failures' -gt 1 }
    if ($results -ne $null ) {
    $results = $results | select "Source DSA", "Naming Context", "Destination DSA" ,"Number of Failures", "Last Failure Time", "Last Success Time", "Last Failure Status"
    $b+= $results | select "Source DSA", "Naming Context", "Destination DSA" ,"Number of Failures", "Last Failure Time", "Last Success Time", "Last Failure Status" | ConvertTo-HTML -Fragment -As Table -PreContent "<h2>Replication Status</h2>" | Out-String
    } else {
    $results = "There were no Replication Errors"
    $b+= $results | ConvertTo-HTML -Fragment -PreContent "<h2>Replication Status</h2>" | Out-String
    $head = @'
    <style>
    body { background-color:#dddddd;
    font-family:Tahoma;
    font-size:12pt; }
    td, th { border:1px Solid Black;
    border-collapse:collapse; }
    th { color:white;
    background-color:DarkGoldenRod; }
    table, tr, td, th { padding: 2px; margin: 0px }
    table { margin-left:50px; }
    </style>
    $s = ConvertTo-HTML -head $head -PostContent $b -Body "<h1>Active Directory Checklist</h1>" | Out-string
    $emailFrom = ""
    $emailTo = ""
    $smtpserver= ""
    $smtp=new-object Net.Mail.SmtpClient($smtpServer)
    $msg = new-object Net.Mail.MailMessage
    $msg.From = $emailFrom
    $msg.To.Add($emailTo)
    $msg.IsBodyHTML = $true
    $msg.subject="Active Directory Health Check Report From Dlhdc02"
    $msg.Body = $s
    $smtp.Send($msg)
    Like in the Ping Status (section - 1), I'd like all the cell having text "Not Pinging" should be in RED color.
    Also I am facing an issue in the (Section - 4). When the value of $Results is not null I am getting the desired output but when the value is null the text ""There were no Replication Errors""  is not getting displayed in
    the HTML body. Instead it comes as "*32" (32 is the number of letters in the text).
    Please help me in fixing this ....
    BR
    Himanshu
    MCTS|MCSE|MCSA:Messaging|CCNA

    Here are instructions on  ways to color cells based on content.
    http://tech-comments.blogspot.com/2012/07/powershell-dynamically-color-posh.html
    \_(ツ)_/

  • How to check PSA data size for a particular datasource

    Hi All,
    Please let us know how to check the size of a PSA for a particular datasource in BI 7.0.
    But i am using DB02OLD transaction code to identify the size of the change log table or active table of a DSO.

    Hi,
    I'm not sure but i think that with the tablename you can find the size in the DB02.
    To know the PSA Tablename, double click on datasourse > go to > Tecnical attributes
    There you have the name of the PSA Table.
    Regards,
    Dani

  • How to replace a particular striing with another string in jtextpane

    how to get replace a particular string with another string of a jtextpane without taking the text in a variable using getText() method .

    Thanks for your answer,
    "relevant object" means for you datasources, transfer rules and transformations ?
    With the grouping option "Save for system copy" I can't take easily all datasources, and others objects
    Will I have to pick all object one by one ?
    What would be the adjustement in table RSLOGSYSMAP ? For the moment it's empty.
    Regards
    Guillaume P.

Maybe you are looking for