Trouble with script to break out csv variables

Using the following script to break down a csv file.
CREATE OR REPLACE PROCEDURE s1_prc is
cursor sa_cur is
with t as (
select sa_record str from sa_records
-- where rownum < 2
select regexp_substr(str,'[^' || CHR (9) || ']+',1,1) c1,
regexp_substr(str,'[^' || CHR (9) || ']+',1,2) c2,
regexp_substr(str,'[^' || CHR (9) || ']+',1,3) c3,
regexp_substr(str,'[^' || CHR (9) || ']+',1,4) c4,
regexp_substr(str,'[^' || CHR (9) || ']+',1,5) c5,
regexp_substr(str,'[^' || CHR (9) || ']+',1,6) c6,
regexp_substr(str,'[^' || CHR (9) || ']+',1,7) c7,
regexp_substr(str,'[^' || CHR (9) || ']+',1,8) c8,
regexp_substr(str,'[^' || CHR (9) || ']+',1,9) c9,
regexp_substr(str,'[^' || CHR (9) || ']+',1,10) c10,
regexp_substr(str,'[^' || CHR (9) || ']+',1,11) c11,
regexp_substr(str,'[^' || CHR (9) || ']+',1,12) c12,
regexp_substr(str,'[^' || CHR (9) || ']+',1,13) c13,
regexp_substr(str,'[^' || CHR (9) || ']+',1,14) c14,
regexp_substr(str,'[^' || CHR (9) || ']+',1,15) c15,
regexp_substr(str,'[^' || CHR (9) || ']+',1,16) c16,
regexp_substr(str,'[^' || CHR (9) || ']+',1,17) c17,
regexp_substr(str,'[^' || CHR (9) || ']+',1,18) c18,
regexp_substr(str,'[^' || CHR (9) || ']+',1,19) c19,
regexp_substr(str,'[^' || CHR (9) || ']+',1,20) c20,
regexp_substr(str,'[^' || CHR (9) || ']+',1,21) c21,
regexp_substr(str,'[^' || CHR (9) || ']+',1,22) c22,
regexp_substr(str,'[^' || CHR (9) || ']+',1,23) c23,
regexp_substr(str,'[^' || CHR (9) || ']+',1,24) c24,
regexp_substr(str,'[^' || CHR (9) || ']+',1,25) c25
from t;
BEGIN
delete from reciprocal_records;
commit;
for i in sa_cur loop
DBMS_OUTPUT.PUT_LINE ('1 '||i.c1);
DBMS_OUTPUT.PUT_LINE ('2 '||i.c2);
DBMS_OUTPUT.PUT_LINE ('3 '||i.c3);
DBMS_OUTPUT.PUT_LINE ('4 '||i.c4);
DBMS_OUTPUT.PUT_LINE ('5 '||i.c5);
DBMS_OUTPUT.PUT_LINE ('6 '||i.c6);
DBMS_OUTPUT.PUT_LINE ('7 '||i.c7);
DBMS_OUTPUT.PUT_LINE ('8 '||i.c8);
DBMS_OUTPUT.PUT_LINE ('9 '||i.c9);
DBMS_OUTPUT.PUT_LINE ('10 '||i.c10);
DBMS_OUTPUT.PUT_LINE ('11 '||i.c11);
DBMS_OUTPUT.PUT_LINE ('12 '||i.c12);
DBMS_OUTPUT.PUT_LINE ('13 '||i.c13);
DBMS_OUTPUT.PUT_LINE ('14 '||i.c14);
DBMS_OUTPUT.PUT_LINE ('15 '||i.c15);
DBMS_OUTPUT.PUT_LINE ('16 '||i.c16);
DBMS_OUTPUT.PUT_LINE ('17 '||i.c17);
DBMS_OUTPUT.PUT_LINE ('18 '||i.c18);
DBMS_OUTPUT.PUT_LINE ('19 '||i.c19);
DBMS_OUTPUT.PUT_LINE ('20 '||i.c20);
DBMS_OUTPUT.PUT_LINE ('21 '||i.c21);
DBMS_OUTPUT.PUT_LINE ('22 '||i.c22);
DBMS_OUTPUT.PUT_LINE ('23 '||i.c23);
DBMS_OUTPUT.PUT_LINE ('24 '||i.c24);
DBMS_OUTPUT.PUT_LINE ('25 '||i.c25);
insert into in_records (IN_SEQ_NO,
IN_TRANS_TYPE, -- 1
IN_SUBMIT_CLUB, -- 2
IN_PROC_ID, -- 3
IN_SERV_CLUB, -- 4
IN_SERVICE_DATE, -- 5
IN_CALL_ID, -- 6
IN_RAP_CALL_ID, -- 7
IN_FACILITY_CODE,-- 8
IN_TROUBLE_CODE, -- 9
IN_DUTY_FLAG, -- 10
IN_CLUB_CODE, -- 11
IN_MEMBER_NO, -- 12
IN_MEMBER_TYPE, -- 13
IN_EXPIRY_DATE, -- 14
IN_LAST_NAME, -- 15
IN_FIRST_NAME, -- 16
IN_EDS_VIN_NO, -- 17
IN_ODOMETER, -- 18
IN_TRAVEL, -- 19
IN_MILES_DEST, -- 20
IN_TAX_AMT, -- 21
IN_TOTAL_AMT, -- 22
IN_DISPUTE_CODE, -- 23
IN_ERR_CODE, -- 24
IN_COST) -- 25
values (1, i.c1, i.c2, i.c3, i.c4, i.c5, i.c6, i.c7, i.c8, i.c9, i.c10, i.c11, i.c12, i.c13, i.c14, i.c15, i.c16, i.c17, i.c18, i.c19, i.c20, i.c21, i.c22, i.c23, i.c24, i.c25);
commit;
end loop;
commit;
end;
The problem I'm having is if there are two null characters together, it seem that the script is ignoring the first null character.
Example:
ACP^     212^     HOC^     212^     08292012^     1069^     N^     1603^     T1^          097^     4290972957271019^     PLUS^     03312013^     GAGLIO^     MARC^ ^          N^     010^     000^     000149^     002746^     ^     ^     PLS/02567/:TEL/00030/TELECOMMUNICATIONS CHARGE
After the first name, Marc, there are two (CHR 9) characters, also after 002746 there are two (CHR 9) characters. So what happens is the last field 'PLS/02567...' ends up as the 23rd field, not as the 25th field.
Hope this clear. Any suggestions are welcome.
Thanks
Paul

Hi, Paul,
To find the item before the n-th CHR(9), even if that item is NULL:
RTRIM ( REGEXP_SUBSTR ( str
                , '[^' || CHR (9) || ']*(' || CHR  (9) || '|$)'
                , 1
                , n
      , CHR (9)
      )The expression above will work in Oracle 10.1 and higher.
Starting in Oracle 11.1, you can do this without RTRIM, because REGEXP_SUBSTR can now be told to return only part of the matching pattern.
Edited by: Frank Kulash on Oct 15, 2012 1:36 PM

Similar Messages

  • Indesign CS3 what script for Break Out Text Frame ??

    hi expert,
    Indesign CS3 can Break Out Text Frame or Have Script ??
    like this...
    http://img402.imageshack.us/img402/905/20080517085017hb3.jpg
    thank for tell

    you mean - convert/split multicolumn TextFrame to separated TextFrames ?
    for PC or MAC ?
    robin
    www.adobescripts.com

  • Having trouble with garageband loops are out of time with other loops

    having trouble with garageband have bought loops from primeloops and beat loops are not in time when i paste other loops down for example certain loops do not lock into measure region correctly .. so say for instance i lay down my beat then i try to add hi hat below and the beat is not in time with hi hat any awnsers may have pressed some setting accidently because this hasn t happened before as previously using these loops were all in time and locked at correct measures ..

    The GarageBand experts await you here:
    https://discussions.apple.com/community/ilife/garageband

  • Having trouble with adobe flash cs6 accepting a variable for the scene calling gotoandplay

    ive got a simple quiz going and i seem to have hit a bit of a brick wall, in order to avoid having a seperate wrong answer scene per question i decided to impliment a simple history system, with a string variable defined on the first scene as a global variable and set at every question, problem is whenever the function to go back is called flash spits out an error saying it cant accept a variable for this parameter, but surely that cant be right. i dont understand where im going wrong and as this is coursework i need to fix it quickly. any chance of help?

    The 1009 error indicates that one of the objects being targeted by your code is out of scope.  This could mean that the object....
    - is declared but not instantiated
    - doesn't have an instance name (or the instance name is mispelled)
    - does not exist in the frame where that code is trying to talk to it
    - is animated into place but is not assigned instance names in every keyframe for it
    - is one of two or more consecutive keyframes of the same objects with no name assigned in the preceding frame(s).
    If you go into your Publish Settings Flash section and select the option to Permit debugging, your error message should have a line number following the frame number which will help you isolate which object is involved.
    If you are going to continue pursuing this using AS3 please start a new posting in the AS3 forum...
    http://forums.adobe.com/community/flash/flash_actionscript3?view=discussions

  • Trouble with numerical pad blinking out

    I've recently started having trouble w/ the numerical key pad blinking out when trying to enter info such as bank acct, or even tech support today, brought up the keypad and tried to select #3 for technical support, it would blink out....worse than a computer game trying to tap the correct number at the right time.  A few nights ago, I needed Roadside Assistance (love this service) as I had locked myself out of the car while at a ball game......the more upset i got the worse getting the selection entered in time....
    Calling verizon tech support today, turning the numberical off and on again MIGHT BE A FIX, has anyone had this problem? 
    When I first got my Nexus, I couldn't call in to voicemail w/ speaker phone on....I kept getting wrong pasword message...learned later from Droid Forums, to turn off the speaker function to enter the numerical values, then turn the speaker back on.  I don't think Nexus is interested in fixing this issue (which apparently doesn't involve all Nexus) but it sure did all the ones at Best Buy. Cyn

        cynindesign,
    Hello! Sorry to read that the keypad is giving you trouble! We need to get this fixed ASAP, especially since it hindered you from calling roadside assistance. Were you able to get this resolved when you called tech support? If not, I recommend two steps. First, would be running the phone in safe mode to see if an app is causing the issue. Second, if that is not successful, doing a hard reset on the phone. I will provide the steps below. Let us know if you need anything else.
    Safe Mode:http://bit.ly/vW58PM
    Hard Reset: http://bit.ly/swCYZF
    Thank you!
    Katie H
    VZW Support
    Follow us on Twitter @VZWSupport

  • Trouble with MIDI, redirecting MIDI out to Line-out???

    Hello
    I have yet another question regarding Logic pro and MIDI. I've plugged my keyboard via MIDI to my TC konnekt 8 audio interface, which is then plugged via firewire to my laptop. I've succesfully been able to record a track and now i want to actually hear it. I know im able to hear it via the Midi connection from my interface to the keyboard, but is there a way to "redirect" the output from my MIDI track to the Line-outs on my interface, so that i can hear it on my studio monitors instead??

    I know MIDI has nothing to do with audio, but there might be a way to convert it to audio.
    I just wanna hear my MIDI recorded track without going through the MIDI out/the speakers in my keyboard.
    The keyboard is playing the audio, under instruction from the MIDI commands. To record the audio, or patch it through your interface, you must cable up it's audio output.
    Garageband is a hugely simplified version of Logic. Of course Logic can do anything GB can do.

  • Trouble with hitTestPoint and mouse out.

    I have the following setup:
    Stage
    FLVPlayback component
    Chapter Menu Button - Initial state hidden
    Invisible Trigger Movieclip - Recieves rollover / rollout events to make chapter menu button appear
    Carousel - Initial state hidden
    Everything bar the FLVPlayback component is hidden to begin with. When the mouse rolls over the trigger the chapter menu tweens in and upon mouse down the carousel is displayed.
    What I'm trying to do is create a trigger so that when the mouse leaves the stage the chapter menu button fades away. I can't get it to work though because when the mouse leaves the stage the mouse x and y values never get to a point where they make the hitTestPoint evaluate to false (never get to 0 especially when the mouse is moved quickly).
    I can't go down the ROLL_OUT route as each time the mouse hits the carousel the ROLL_OUT is triggered and I don't want that unless the mouse has left the stage.
    Does anyone have a solution for this?
    Thanks,
    eb_dev

    Hi Andrei1, thanks for your suggestion, I've ended up using the following solution:
    private function onTriggerEnterFrame(e:Event)
                // Check for hit
                if(trigger.hitTestPoint(mouseX, mouseY, true))
                    if(!openCloseButtonInTransition && !openCloseBtnDisplayed)
                        trace("Displaying open close button");
                        // Set showing value so we prevent the tween running over and over
                        openCloseButtonInTransition = true;
                        // Show carousel
                        openCloseButtonTransitionTwn = new Tween(openCloseBtn,"alpha",Regular.easeOut,openCloseBtn.alpha,1,1,true);
                        // Add tween finish event listener
                        openCloseButtonTransitionTwn.addEventListener(TweenEvent.MOTION_FINISH,onDisplayOpenClose ButtonTweenMotionStop);
                else
                    if(!openCloseButtonInTransition && openCloseBtnDisplayed)
                        trace("Hiding open close button");
                        // Set showing value so we prevent the tween running over and over
                        openCloseButtonInTransition = true;
                        // Show carousel
                        openCloseButtonTransitionTwn = new Tween(openCloseBtn,"alpha",Regular.easeOut,openCloseBtn.alpha,0,1,true);
                        // Add tween finish event listener
                        openCloseButtonTransitionTwn.addEventListener(TweenEvent.MOTION_FINISH,onHideOpenCloseBut tonTweenMotionStop);
            private function onDisplayOpenCloseButtonTweenMotionStop(e:TweenEvent)
                openCloseButtonInTransition = false;
                openCloseBtnDisplayed = true;
            private function onHideOpenCloseButtonTweenMotionStop(e:TweenEvent)
                openCloseButtonInTransition = false;
                openCloseBtnDisplayed = false;
            private function onTriggerMouseLeave(e:Event)
                trace("Leaving - Tweening");
                // In transition do not do anything else
                openCloseButtonInTransition = true;
                // Hide carousel
                openCloseButtonTransitionTwn = new Tween(openCloseBtn, "alpha", Regular.easeOut,openCloseBtn.alpha, 0, 1, true);
                openCloseButtonTransitionTwn.addEventListener(TweenEvent.MOTION_FINISH,onHideOpenCloseBut tonTweenMotionStop);
    The part I was missing was to use your suggestion and to set a boolean for whether the openCloseBtn was displayed or not.
    Thanks,
    eb_dev
    Message was edited by: eb_dev

  • Trouble with slideshow in TV Out

    Hey guys, for some reason I can't display pictures on my TV. I have a Apple AV cable. I can watch my videos but when I try to run a slide show. Nothing happens. Can anyone help?

    Did you press play on the photo library screen? If you press the center button instead of play, it won't play slideshow.

  • Trouble with session variables

    Hello, I am a user of cf for a number of years, but only
    lately as of last week have I had the opportunity to work with CF
    8.... wow the changes are quite intimidating. But none the less
    press on is my thought, so now my trouble. Thing I did was to start
    using application.cfc vs application.cfm, as it would appear that
    is how things have come to pass. So I looked around and found this
    code to set session management:
    <cfcomponent output="false" hint="Handles application
    level events.">
    <!--- Set up the application. --->
    <cfset THIS.Name = "AppCFC" />
    <cfset THIS.ApplicationTimeout = CreateTimeSpan( 0, 0, 60,
    0 ) />
    <cfset THIS.SessionManagement = true />
    <cfset THIS.SetClientCookies = false />
    <CFSET request.dsn = "wlaw" />
    </cfcomponent>
    My problem is that while I can define a session variable on a
    page that is not under the SSL cert, my session vars become
    undefined once I land on a page under SSL.
    Am I missing something? I dont recall this being a problem in
    the past. All help is appreciated.
    as to setting the var, it is done on an index page which
    calls another page in a different directory, but under the same
    server,.
    <cfset session.ref="foo">
    the only changes are that the result page or action page if
    you prefer is now under the ssl and the var becomes undefined.
    thank you in advance
    Mike Dooly

    is the object being put in session context serializable.. Also in
              other to avoid any generated classes issues delete all the classes
              whcih weblogic generates as part of deploying the application. That
              should atleast mitigate one explanation for your problem.
              Hope this helps
              ~a
              [email protected] (Gabriel Ornelas De Luna) wrote in message news:<[email protected]>...
              > Hello everyone,
              > I'm currently working with WL 6.1 and I'm having trouble with the
              > persistence of some session variables which are initially created
              > correctly on the server side, and they get lost (null) once the Web
              > clients need to access its value.
              > This is the error which is being written on a log file:
              >
              > <May 13, 2003 3:05:09 PM EDT> <Error> <HTTP Session> <Could not
              > deserialize session data
              > java.io.NotSerializableException:
              >
              > Things were woriking perfectly, but suddenly after bouncing the server
              > instance several times, in order to pick up the latest changes in my
              > classes, I started to get this error once the server tries to load the
              > jsp.
              >
              > JSP Code:
              > <%
              > Integer businessID = (Integer) session.getAttribute("business_id" );
              > Util.isCapitolBusiness(businessID.intValue())
              > %>
              >
              > I appreciate your help.
              > Regards.
              > g.
              

  • Loop with WMI Query taking too long, need to break out if time exceeds 5 min

    I've written a script that will loop through a list of computers and run a WMI query using the Win32_Product class. I am pinging the host first to ensure its online which eliminates wasting time but the issue I'm facing is that some of the machines
    are online but the WMI Query takes too long and holds up the script. I wanted to add a timeout to the WMI query so if a particular host will not respond to the query or gets stuck the loop will break out an go to the next computer object. I've added my code
    below:
    $Computers = @()
    $computers += "BES10-BH"
    $computers += "AUTSUP-VSUS"
    $computers += "AppClus06-BH"
    $computers += "Aut01-BH"
    $computers += "AutLH-VSUS"
    $computers += "AW-MGMT01-VSUS"
    $computers += "BAMBOOAGT-VSUS"
    ## Loop through all computer objects found in $Computes Array
    $JavaInfo = @()
    FOREACH($Client in $Computers)
    ## Gather WMI installed Software info from each client queried
    Clear-Host
    Write-Host "Querying: $Client" -foregroundcolor "yellow"
    $HostCount++
    $Online = (test-connection -ComputerName ADRAP-VSUS -Count 1 -Quiet)
    IF($Online -eq "True")
    $ColItem = Get-WmiObject -Class Win32_Product -ComputerName $Client -ErrorAction SilentlyContinue | `
    Where {(($_.name -match "Java") -and (!($_.name -match "Auto|Visual")))} | `
    Select-Object Name,Version
    FOREACH($Item in $ColItem)
    ## Write Host Name as variable
    $HostNm = ($Client).ToUpper()
    ## Query Named Version of Java, if Java is not installed fill variable as "No Java Installed
    $JavaVerName = $Item.name
    IF([string]::IsNullOrEmpty($JavaVerName))
    {$JavaVerName = "No Installed"}
    ## Query Version of Java, if Java is not installed fill variable as "No Java Installed
    $JavaVer = $Item.Version
    IF([string]::IsNullOrEmpty($JavaVer))
    {$JavaVer = "Not Installed"}
    ## Create new object to organize Host,JavaName & Version
    $JavaProp = New-Object -TypeName PSObject -Property @{
    "HostName" = $HostNm
    "JavaVerName" = $JavaVerName
    "JavaVer" = $JavaVer
    ## Add new object data "JavaProp" from loop into array "JavaInfo"
    $JavaInfo += $JavaProp
    Else
    {Write-Host "$Client didn't respond, Skipping..." -foregroundcolor "Red"}

    Let me give you a bigger picture of the script. I've included the emailed table the script produces and the actual script. While running the script certain hosts get hung up when running the WMI query which causes the script to never complete. From one of
    the posts I was able to use the Get-WmiCustom function to add a timeout 0f 15 seconds and then the script will continue if it is stuck. The problem is when a host is skipped I am not aware of it because my script is not reporting the server that timed out.
    If you look at ZLBH02-VSUS highlighted in the report you can see that its reporting not installed when it should say something to the effect query hung.
    How can I add a variable in the function that will be available outside the function that I can key off of to differentiate between a host that does not have the software installed and one that failed to query?
    Script Output:
    Script:
    ## Name: JavaReportWMI.ps1 ##
    ## Requires: Power Shell 2.0 ##
    ## Created: January 06, 2015 ##
    <##> $Version = "Script Version: 1.0" <##>
    <##> $LastUpdate = "Updated: January 06, 2015" <##>
    ## Configure Compliant Java Versions Below ##
    <##> $java6 = "6.0.430" <##>
    <##> $javaSEDEVKit6 = "1.6.0.430" <##>
    <##> $java7 = "7.0.710" <##>
    <##> $javaSEDEVKit7 = "1.7.0.710" <##>
    <##> $java8 = "8.0.250" <##>
    <##> $javaSEDDEVKit8 = "1.8.0.250" <##>
    ## Import Active Directory Module
    Import-Module ActiveDirectory
    $Timeout = "False"
    Function Get-WmiCustom([string]$computername,[string]$namespace,[string]$class,[int]$timeout=15)
    $ConnectionOptions = new-object System.Management.ConnectionOptions
    $EnumerationOptions = new-object System.Management.EnumerationOptions
    $timeoutseconds = new-timespan -seconds $timeout
    $EnumerationOptions.set_timeout($timeoutseconds)
    $assembledpath = "\\" + $computername + "\" + $namespace
    #write-host $assembledpath -foregroundcolor yellow
    $Scope = new-object System.Management.ManagementScope $assembledpath, $ConnectionOptions
    $Scope.Connect()
    $querystring = "SELECT * FROM " + $class
    #write-host $querystring
    $query = new-object System.Management.ObjectQuery $querystring
    $searcher = new-object System.Management.ManagementObjectSearcher
    $searcher.set_options($EnumerationOptions)
    $searcher.Query = $querystring
    $searcher.Scope = $Scope
    trap { $_ } $result = $searcher.get()
    return $result
    ## Log time for duration clock
    $Start = Get-Date
    $StartTime = "StartTime: " + $Start.ToShortTimeString()
    ## Environmental Variables
    $QueryMode = $Args #parameter for either "Desktops" / "Servers"
    $CsvPath = "C:\Scripts\JavaReport\JavaReport" + "$QueryMode" + ".csv"
    $Date = Get-Date
    $Domain = $env:UserDomain
    $HostName = ($env:ComputerName).ToLower()
    ## Regional Settings
    ## Used for testing
    IF ($Domain -eq "abc") {$Region = "US"; $SMTPDomain = "abc.com"; `
    $ToAddress = "[email protected]"; `
    $ReplyDomain = "abc.com"; $smtpServer = "relay.abc.com"}
    ## Control Variables
    $FromAddress = "JavaReport@$Hostname.na.$SMTPDomain"
    $EmailSubject = "Java Report - $Region"
    $computers = @()
    $computers += "ZLBH02-VSUS"
    $computers += "AUTSUP-VSUS"
    $computers += "AppClus06-BH"
    $computers += "Aut01-BH"
    $computers += "AutLH-VSUS"
    $computers += "AW-MGMT01-VSUS"
    $computers += "BAMBOOAGT-VSUS"
    #>
    ## Loop through all computer objects found in $Computes Array
    $JavaInfo = @()
    FOREACH($Client in $Computers)
    ## Gather WMI installed Software info from each client queried
    Clear-Host
    Write-Host "Querying: $Client" -foregroundcolor "yellow"
    $HostCount++
    $Online = (test-connection -ComputerName ADRAP-VSUS -Count 1 -Quiet)
    IF($Online -eq "True")
    $ColItem = Get-WmiCustom -Class Win32_Product -Namespace "root\cimv2" -ComputerName $Client -ErrorAction SilentlyContinue | `
    Where {(($_.name -match "Java") -and (!($_.name -match "Auto|Visual")))} | `
    Select-Object Name,Version
    FOREACH($Item in $ColItem)
    ## Write Host Name as variable
    $HostNm = ($Client).ToUpper()
    ## Query Named Version of Java, if Java is not installed fill variable as "No Java Installed
    $JavaVerName = $Item.name
    IF([string]::IsNullOrEmpty($JavaVerName))
    {$JavaVerName = "No Installed"}
    ## Query Version of Java, if Java is not installed fill variable as "No Java Installed
    $JavaVer = $Item.Version
    IF([string]::IsNullOrEmpty($JavaVer))
    {$JavaVer = "Not Installed"}
    ## Create new object to organize Host,JavaName & Version
    $JavaProp = New-Object -TypeName PSObject -Property @{
    "HostName" = $HostNm
    "JavaVerName" = $JavaVerName
    "JavaVer" = $JavaVer
    ## Add new object data "JavaProp" from loop into array "JavaInfo"
    $JavaInfo += $JavaProp
    Else
    {Write-Host "$Client didn't respond, Skipping..." -foregroundcolor "Red"}
    #Write-Host "Host Query Count: $LoopCount" -foregroundcolor "yellow"
    ## Sort Array
    Write-Host "Starting Array" -foregroundcolor "yellow"
    $JavaInfoSorted = $JavaInfo | Sort-object HostName
    Write-Host "Starting Export CSV" -foregroundcolor "yellow"
    ## Export CSV file
    $JavaInfoSorted | export-csv -NoType $CsvPath -Force
    $Att = new-object Net.Mail.Attachment($CsvPath)
    Write-Host "Building Table Header" -foregroundcolor "yellow"
    ## Table Header
    $list = "<table border=1><font size=1.5 face=verdana color=black>"
    $list += "<tr><th><b>Host Name</b></th><th><b>Java Ver Name</b></th><th><b>Ver Number</b></th></tr>"
    Write-Host "Building HTML Table" -foregroundcolor "yellow"
    FOREACH($Item in $JavaInfoSorted)
    Write-Host "$UniqueHost" -foregroundcolor "Yellow"
    ## Alternate Table Shading between Green and White
    IF($LoopCount++ % 2 -eq 0)
    {$BK = "bgcolor='E5F5D7'"}
    ELSE
    {$BK = "bgcolor='FFFFFF'"}
    ## Set Variables
    $JVer = $Item.JavaVer
    $Jname = $Item.JavaVerName
    ## Change Non-Compliant Java Versions to red in table
    IF((($jVer -like "6.0*") -and (!($jVer -match $java6))) -or `
    (($jName -like "*Java(TM) SE Development Kit 6*") -and (!($jName -match $javaSEDEVKit6))) -or `
    (($jVer -like "7.0*") -and (!($jVer -match $java7))) -or `
    (($jName -like "*Java SE Development Kit 7*") -and (!($jName -match $javaSEDEVKit7))))
    $list += "<tr $BK style='color: #ff0000'>"
    ## Compliant Java version are displayed in black
    ELSE
    $list += "<tr $BK style='color: #000000'>"
    ## Populate table with host name variable
    $list += "<td>" + $Item."HostName" + "</td>"
    ## Populate table with Java Version Name variable
    $list += "<td>" + $Item."JavaVerName" + "</td>"
    ## Populate table with Java Versionvariable
    $list += "<td>" + $Item."JavaVer" + "</td>"
    $list += "</tr>"
    $list += "</table></font>"
    $End = Get-Date
    $EndTime = "EndTime: " + $End.ToShortTimeString()
    #$TimeDiff = New-TimeSpan -Start $StartTime -End $EndTime
    $StartTime
    $EndTime
    $TimeDiff
    Write-Host "Total Hosts:$HostCount"
    ## Email Function
    Function SendEmail
    $msg = new-object Net.Mail.MailMessage
    $smtp = new-object Net.Mail.SmtpClient($smtpServer)
    $msg.From = ($FromAddress)
    $msg.ReplyTo =($ToAddress)
    $msg.To.Add($ToAddress)
    #$msg.BCC.Add($BCCAddress)
    $msg.Attachments.Add($Att)
    $msg.Subject = ($EmailSubject)
    $msg.Body = $Body
    $msg.IsBodyHTML = $true
    $smtp.Send($msg)
    $msg.Dispose()
    ## Email Body
    $Body = $Body + @"
    <html><body><font face="verdana" size="2.5" color="black">
    <p><b>Java Report - $Region</b></p>
    <p>$list</p>
    </html></body></font>
    <html><body><font face="verdana" size="1.0" color="red">
    <p><b> Note: Items in red do not have the latest version of Java installed. Please open a ticket to have an engineer address the issue.</b></p>
    </html></body></font>
    <html><body><font face="verdana" size="2.5" color="black">
    <p>
    $StartTime<br>
    $EndTime<br>
    $TimeDiff<br>
    $HostCount<br>
    </p>
    <p>
    Run date: $Date<br>
    $Version<br>
    $LastUpdate<br>
    </p>
    </html></body></font>
    ## Send Email
    SendEmail

  • The updated iPhoto program is cumbersome.  I am trying to create a Christmas card and can't figure out how to get the fold of the card on the left and not on the top of the card.  I had no trouble with this for the past two years.  Can someone help?

    The updated iPhoto program is cumbersome.  I am trying to create a Christmas card and can't figure out how to get the fold of the card on the left and not on the top of the card.  I had no trouble with this for the past two years.  Can someone help?

    Click on the Layout button lower right and choose a Vertical lyout from the dropdown

  • Trouble with reauthenticating NAC users after laptop is out of hibernation

    Hi,
    Have trouble with users logging back on to laptops that comes out of hibernate mode. NAC agent pops up saying " Client Access Server not available on the network"
    The current solution I have now is to run Kerbtray.exe too clear the kerberos tkts. which i believe is expired.User logs in fine after clearing.
    Is there any alternate permanent soln. in 4.7.2 ver
    Thanks in advance
    Satish

    One more point i forgot to mention
    Laptops have full disk encryption installed and encrypts the drive when it goes into hibernation .At the same time the sw port is set to move it to auth vlan after the link down trap is  received by the sw.
    thanks again
    Satish

  • Trouble with calculating fields. Can't select (check) fields. Also can't figure out what's wrong with a division field (percent) that I created. Keep getting the pop up that format of the field doesn't allow blah blah blah... Help!

    Trouble with calculating fields. Can't select (check) fields. Also can't figure out what's wrong with a division field (percent) that I created. Keep getting the pop up that format of the field doesn't allow blah blah blah... Help!

    1. Use the mouse to select the field and then press the space bar.
    2. A null string is the same as zero. What is the result for division by zero?

  • Script to merge multiple CSV files together with no duplicate records.

    I like a Script to merge multiple CSV files together with no duplicate records.
    None of the files have any headers and column A got a unique ID. What would be the best way to accomplish that?

    OK here is my answer :
    2 files in a directory with no headers.
    first column is the unique ID, second colomun you put whatever u want
    The headers are added when using the import-csv cmdlet
    first file contains :
    1;a
    2;SAMEID-FIRSTFILE
    3;c
    4;d
    5;e
    second file contains :
    6;a
    2;SAMEID-SECONDFILE
    7;c
    8;d
    9;e
    the second file contains the line : 2;b wich is the same in the first file
    the code :
    $i = 0
    Foreach($file in (get-childitem d:\yourpath)){
    if($i -eq 0){
    $ref = import-csv $file.fullname -Header id,value -Delimiter ";"
    }else{
    $temp = import-csv $file.fullname -Header id,value -Delimiter ";"
    foreach($line in $temp){
    if(!($ref.id.contains($line.id))){
    $objet = new-object Psobject
    Add-Member -InputObject $objet -MemberType NoteProperty -Name id -value $line.id
    Add-Member -InputObject $objet -MemberType NoteProperty -Name value -value $line.value
    $ref += $objet
    $i++
    $ref
    $ref should return:
    id                                                         
    value
    1                                                          
    a
    2                                                          
    SAMEID-FIRSTFILE
    3                                                          
    c
    4                                                          
    d
    5                                                          
    e
    6                                                          
    a
    7                                                          
    c
    8                                                          
    d
    9                                                          
    e
    (get-childitem d:\yourpath) -> yourpath containing the 2 csv file

  • How can I figure out what my password is and keep it unlocked?  Every time I do a system update, it requires the password and sends me into cyber trouble with the remember my keychain access, requiring it every time I log in.  A real hassle to be avoided

    How can I find out what my password on the computer is?  I had to change it due to my teenagers helping themselves, and now every time there is a system update, I have to have the password, which I cannot remember or find.  It then wants it every time I log in and pops up Key Chain Access as well.  Very annoying.  I do not have the disc to reload it and fear I would loose everything on my computer as there is also trouble with the back up system.  Too many issues and not enough solutions.  Many thanks in advance!

    I do not have the disc to reload
    Why not?  You need your system dvds to troubleshoot & to reset/change passwords in view of your current OS listed in your  profile. 
    You can get replacement System Install & Restore CD/DVDs from Apple's Customer Support - in the US, (800) 767-2775 - for a nominal S&H fee. You'll need to have the model and/or serial number of your Mac available.
    If you're not in the US, you may need to go through the regional Apple Store that serves your location to find the contact number. Here's a list of links to all of those - http://store.apple.com/Catalog/US/Images/intlstoreroutingpage.html Another resource:  International Support Phone #s.
    ===============
    I have to have the password, which I cannot remember or find.
    When selecting passwords, make sure it's one that you will NEVER forget AND no one else can figure out. 
    Old school--- > Print it out & keep in a safe place.  A place that ONLY you know about AND never forget.
    New school---> Get a password manager utility.  Highly recommend 1Password which is shareware.  Do a Google search for free password managers.

Maybe you are looking for