Invoke VMScript not return expected results

Hello

I use VMScript-Invoke to call a script, then return to the State of the output of the script. Since it is Linux I'm back the $? variable.

To simplify the problem, I wrote a little script on my linux system which is as follows:

#! / bin/bash
Output 1

I have this saved in / tmp and called it exit1.sh. If I run this command line, I get this back:

(root@au-lab) / tmp$. / exit1.sh; ECHO $?

1

If I run VM script I get:

Invoke-VMScript - VM AU-GSCLAB-7 - ScriptText "/ tmp/exit1.sh;» echo "" $? "- GuestPassword root password - GuestUser |" Select ScriptOutput - ExpandProperty

0

PowerCLI Version

----------------

VMware vSphere PowerCLI 5.0.1 build 581491

---------------

Versions of the snap

---------------

VMware AutoDeploy PowerCLI component 5.0 build 544967

VMware ImageBuilder PowerCLI component 5.0 build 544967

License of VMware PowerCLI component 5.0 build 544881

VMware vSphere PowerCLI component 5.0 build 581435

Hello

It looks like we have some problems with the redirection of output and the "echo". I log a bug for this. I don't know if this will help, but you can get the exit code of the script of the VMScriptResult returned by Invoke-VMScript:

Invoke-VMScript - VM AU-GSCLAB-7 - ScriptText "/ tmp/exit1.sh ' GuestPassword - root password - GuestUser | Select ExitCode - ExpandProperty

1

Tags: VMware

Similar Questions

  • Simple find() return is not the expected results

    I'm new to ColdFusion, but have been programming for a while now.  I have (what seems) an easy problem that I thought would be a simple solution, but I'm currently stuck.  Any guidance would be appreciated!

    I have the following code:

    < cfset brand = Trim (products. BRAND name) / >
    < cfif Find (brand name, ",") >
    < cfset brand = ""' & brand & ' "" / >

    < / cfif >

    My goal is to surround the text with 'if the string contains a comma.  I tried the standard comma, as Chr (44), but neither returned the expected results.

    What I am doing wrong?  The CSV file, creating, is sprayed upward for the name of a company is like 'Test Company, Inc.'

    Please help us save my sanity!  TIA!

    I think the first thing we do is to read the docs.  And if you may have read 'em a little closer... ;-)

    http://livedocs.Adobe.com/ColdFusion/8/htmldocs/functions_e-g_21.html#5177400

    How around two parameters go?

    --

    Adam

  • ctxrule - match does not return a result

    v.11.1.07 - I created a ctxrule index as described below. However, although a query must match on the given document, it does not return. Any ideas?
    begin
    ctx_ddl.create_preference('ot_lexer', 'basic_lexer');
    ctx_ddl.set_attribute('ot_lexer', 'index_stems', 'ENGLOSH');
    end;
     
    begin
    ctx_ddl.create_section_group('ot_sec_group', 'auto_section_group');
    end;
     
    create table ot_profile_test
    (profile_id number,
    query clob);
     
    create index ot_profile_rule_ndx on ot_profile_test(query)
    indextype is ctxsys.ctxrule parameters
    ('stoplist ctxsys.empty_stoplist
    section group ot_sec_group
    lexer ot_lexer');
     
    insert into ot_profile_test values(1, '($apple and $pear) and (1 within food)');
    commit;
     
    exec ctxsys.ctx_adm.set_parameter('log_directory', '/yourdir');
    exec ctx_output.start_log('ot');
    exec ctx_output.add_event(ctx_output.event_index_print_rowid);
    exec ctx_output.add_event(ctx_output.event_index_print_token);
    exec ctx_ddl.sync_index('ot_profile_rule_ndx', '2040M', null, 1, null, ctx_ddl.lock_nowait_error);
    exec ctx_output.end_log;
    Then, run a query:
    declare
    a clob := 'apple orange pears banana
    <metadata>
     <indicators>
       <food>1</food>
     </indicators>
    </metadata>
    ';
    vn_profile_id number;
     
    begin
     
    select profile_id into vn_profile_id
    from ot_profile_test
    where matches(query, a) > 0;
     
    dbms_output.put_line(vn_profile_id);
     
    end;
     
    ERROR at line 1:
    ORA-01403: no data found
    ORA-06512: at line 8
    Profile_id = 1 should not be returned?


    In addition, the log file should not have 2 lines written in $I?
    WRITING APPLE: ((PEAR) TOKEN = (PEARS)) * ((1) IN FOOD), 0
    WRITING APPLES: ((PEAR) TOKEN = (PEARS)) * ((1) IN FOOD), 0

    As noted earlier, you must use a list of words, not a lexer to control, like the two conflicts between them. All what you need to do is remove the following line from your code:

    ctx_ddl.set_attribute ('ot_lexer', 'index_stems', 'ENGLISH');

    You can still have a lexer with other attributes; Just do not set the attribute index_stems to the lexer. Set the attribute generator of forms derived from the list of words only.

  • Strange case. =' and 'AND' do not return a result expected

    Hello

    I need to select rows in a table, excluding rows with col2 = 'o' AND 'EA' in the column BOXCODE.

    Lines with col2 = "O" where BOXCODE is equal to any other value except "EA" must be included in the result.

    I created a test table, inserted a few lines:

    create the test56 table (col1 varchar2 (1), col2 varchar2 (1), boxcode varchar2 (2))

    insert into test56 values ('1', 'o', 'EA')

    insert into test56 values ('2', 'o', 'BB')

    insert into test56 values ('3 ', ' 1', 'EA')

    I need to return these rows:

    ('2', ' O ', « BB »)

    ('3 ', ' 1', 'EA')

    Here is my SQL:

    Select * from test56

    where col2! = "O" AND BOXCODE! = "EA."

    /

    No row is returned:

    COL1 COL2 BOXCODE

    -------  -------  ----------

    0 response (s) selected

    Why? Oh why? No explanation?

    Thanks for your comments

    I need to select rows in a table, excluding rows with col2 = 'o' AND 'EA' in the column BOXCODE.

    Lines with col2 = "O" where BOXCODE is equal to any other value except "EA" must be included in the result.

    ALWAYS, ALWAYS, ALWAYS use parentheses when writing the conditions made.

    Did I mention that you should ALWAYS do that?

    You have written the requirement correctly. If you have added in brackets in your English needs you'd have this:

    excluding the ranks with (col2 = 'o' AND 'EA' in BOXCODE)

    And then rewrite that you would have the following code:

    to the exclusion of the ranks with ((col2 = 'O') AND BOXCODE = "EA"))

    Then the "outside" becomes the NOT operator

    NO ((col2 = 'O') AND BOXCODE = "EA"))

    "To the exclusion of the lines with" applies to ALL of these conditions so NOT a to apply to EACH of them. So just put ALL brackets.

    where col2! = "O" AND BOXCODE! = "EA."

    That! Applies ONLY to the FIRST condition

  • REGEXP_LIKE return is not the expected results

    My first attempt at REGEXP_LIKE and I am obviously missing something. I tried several suggestions I found on the forum but can not get the correct results. I need the following query to return only rows with only alphabetic characters (no numbers). What I get are lines containing letters and numbers.

    Any help will be greatly appreciated!

    Randy

    SELECT order_number
    Of order_table
    where REGEXP_LIKE (order_number, "[a - z A - Z]")
    select order_number
    from order_table
    where regexp_like(order_number,'^[[:alpha:]]+$')
    

    Published by: michaels2 on 10 Sep 2009 15:51

    No need to 'i '.

  • Dynamic action - SQL - not returning the result as expected

    Hello

    I have a dynamic Action that runs some SQL codes and must return a string to a text box...

    the sql code that the action runs when a button is reached is:

    Select REPLACE ("|: P292_QPRODUCTS |) '''', ':', ' ' || : P292_QAOPRODUCTS | ""ProductsID"(="') from DUAL "

    P292_QAOPRODUCTS = DATABASE: JAVA

    P292_QAOPRODUCTS = AND (user can also choose OR)

    In the command SQL is what I see:

    "DATABASE" AND "ProductsID" = "JAVA".

    In the text box apex that action must set the value of the use of SQL I see only:

    ''

    any ideas?

    see you soon

    t

    Hello

    Could you share the 'Settings' and 'Affected Elements' sections of the property page of DA?

    You can also try a PLSQL and Code PL/SQL type as:

    Start

    Select REPLACE ("|: P292_QPRODUCTS |) '''', ':', ' ' || : P292_QAOPRODUCTS | ""ProductsID"(="') "

    in: DOUBLE P292_TEXT_BOX;

    end;

    Don't forget to fill in the field "Page elements to return" with the name of P292_TEXT_BOX.

    Concerning

  • the coil does not return the result of the query

    Hi people, I just my adventure begins with oracle sql basics course and I encountered the first problem.

    as I wrote in the topic, after you run the statement I get only query itself in the output file with no query results.

    exsample:

    coil C:\Users\Tomasz\Desktop\cw1.txt

    SELECT STARTDATE AS hire_date, employe_id, last_name, job_id

    Employees;

    spool off;

    all advice?

    Thanks in advance,

    Tomasz.

    Hi people, I just my adventure begins with oracle sql basics course and I encountered the first problem.

    as I wrote in the topic, after you run the statement I get only query itself in the output file with no query results.

    exsample:

    coil C:\Users\Tomasz\Desktop\cw1.txt

    SELECT STARTDATE AS hire_date, employe_id, last_name, job_id

    Employees;

    spool off;

    You said "after the execution of the statement.

    What you posted is NOT a statement; It is a script.

    I select Run Script (F5) and the file contains the query and the result set.

    If you use "Run the statement", you will get a file.

  • Export-Csv not generating expected results


    I'm trying to generate a report from the script of grouping of NETWORK cards, but given the following code I will have to create Excel object and define its elements?

    The Export-Csv option does not work as I expect in this case. Thank you for your help.  The following code:

    ($VMHost in Get-VMHost){

    Foreach ($vSwitch in ($VMHost | Get-VirtualSwitch )){

    $NicTeaming = Get NicTeamingPolicy -VirtualSwitch $vSwitch

    $obj = new-object psobject

    $obj | Add Member -membertype NoteProperty -name home -value $VMHost

    $obj | Add Member -membertype NoteProperty -name vSwitch -value $vSwitch

    $obj | Add Member -membertype NoteProperty -name NumPorts -value $vSwitch. NumPorts

    $obj | Add Member -membertype NoteProperty -name NumPortsAvailable -value $vSwitch. NumPortsAvailable

    $PG = $vSwitch | Get-VirtualPortGroup

    If ($PG. Count-gt 1){

    $obj | Add Member - membertype NoteProperty -nom échanges -valeur ([string] ::join()«, », ($PG)))

    }

    Else {}

    $obj | Add-Member - membertype NoteProperty-trade name-value $PG

    }

    $obj | Add-Member - membertype NoteProperty - name BeaconInterval-$NicTeaming.BeaconInterval value

    $obj | Add-Member - membertype NoteProperty - name LoadBalancingPolicy-$NicTeaming.LoadBalancingPolicy value

    $obj | Add-Member - membertype NoteProperty - name NetworkFailoverDetectionPolicy-$NicTeaming.NetworkFailoverDetectionPolicy value

    $obj | Add-Member - membertype NoteProperty - name NotifySwitches-$NicTeaming.NotifySwitches value

    $obj | Add-Member - membertype NoteProperty - name FailbackEnabled-$NicTeaming.FailbackEnabled value


    If ($NicTeaming.ActiveNic - gt 1) {}

    $obj | Add-Member - membertype NoteProperty-ActiveNic name-value ([string]: join (",", ($NicTeaming.ActiveNic)))

    }

    Else {}

    $obj | Add-Member - membertype NoteProperty - name ActiveNic-$NicTeaming.ActiveNic value

    }

    If ($NicTeaming.StandbyNic - gt 1) {}

    $obj | Add-Member - membertype NoteProperty-StandbyNic name-value ([string]: join (",", ($NicTeaming.StandbyNic)))

    }

    Else {}

    $obj | Add-Member - membertype NoteProperty - name StandbyNic-$NicTeaming.StandbyNic value

    }

    If ($NicTeaming.UnusedNic - gt 1) {}

    $obj | Add-Member - membertype NoteProperty-UnusedNic name-value ([string]: join (",", ($NicTeaming.UnusedNic)))

    }

    Else {}

    $obj | Add-Member - membertype NoteProperty - name UnusedNic-$NicTeaming.UnusedNic value

    }

    $obj | Add-Member - membertype NoteProperty - name CheckBeacon-$NicTeaming.CheckBeacon value

    $obj

    $Report += $obj

    }

    $Report = $Report | Sort-Object VMName

    IF ($Report - don't ' ")

    {$Report |} {Export-Csv NIC - Teaming.csv}

    }

    You declare $report in a table?

    On the first line

    $report = @)

  • not displaying recordset is not the expected results

    Hello

    I try to get the recordset to display only users with an access level of 1 and the person that is connected only to assign the task to.

    $paramUser_rsTaskUsers = "-1";
    If (isset($_SESSION['kt_login_id'])) {}
    $paramUser_rsTaskUsers = (get_magic_quotes_gpc())? $_SESSION ['kt_login_id']: addslashes($_SESSION['kt_login_id']);
    }
    @mysql_select_db ($database_cbank, $cbank);
    $query_rsTaskUsers = sprintf ("" SELECT * FROM users WHERE AccessLevel = 1 AND UserID = %s ", GetSQLValueString ($paramUser_rsTaskUsers,"int")");
    $rsTaskUsers = mysql_query ($query_rsTaskUsers, $cbank) or die (mysql_error ());
    $row_rsTaskUsers = mysql_fetch_assoc ($rsTaskUsers);
    $totalRows_rsTaskUsers = mysql_num_rows ($rsTaskUsers);

    y at - it something wrong with my request as it is only showing to the user who is logged in the drop-down list to the bottom of the list and not the accesslevel = 1 users too.

    Thank you very much

    Your application uses AND, which means that both conditions must be met: 1 user access level and specific ID. As a result, you will get a single result.

    If you want all the people with the 1 and the specific user access level (regardless of the level of access), to modify AND where.

  • Why windows search does not return a result when the file is of course in the folder my documents?

    Hello

    file search: KeyScrambler_Setup.exe
    search string: key - would find the above file
    search string: scrambler - cannot find the file!

    now I'm very confused. can someone pls tell me why? then I could correctly search and find my next record!

    Thank you! any help is appreciated!

    BTW I use win vista Home premium 32.

    and I tried the advanced search and selecting search loc: informed everywhere and all the other search criteria.

    Hello

    Windows Search does not work or research are slower
    http://support.Microsoft.com/GP/windows_search

    Troubleshooting Windows Vista search & indexing errors
    http://www.WinVistaClub.com/T24.html

    I hope this helps.
    Rob - bicycle - Mark Twain said it is good.

  • % ROWCOUNT SQL does not return the expected result

    I have the following function within a package:

    --Update APPERY_JTI_deleted_USERS table:
    FUNCTION fn_updt_app_jti_dlt_usr(
        p_update_co      IN VARCHAR2,
        p_appery_user_id IN APPERY_JTI_deleted_USERS.appery_user_id%TYPE,
        p_outlet_code    IN APPERY_JTI_deleted_USERS.outlet_code%TYPE)
      RETURN NUMBER
    AS
    lv_sql       VARCHAR2(4000);
    lv_rowcount  NUMBER := 0;
    BEGIN
    
    lv_sql := 'UPDATE APPERY_JTI_deleted_USERS SET '||p_update_co||' = 1 WHERE '||p_update_co||' = 0 AND OUTLET_CODE = '''||p_outlet_code||''' AND APPERY_USER_ID = '''||p_appery_user_id||'''';
    
    --EXECUTE IMMEDIATE lv_sql;
    EXECUTE IMMEDIATE 'BEGIN ' || lv_sql || '; :z := sql%rowcount; END; ' USING OUT lv_rowcount ;
    
    RETURN lv_rowcount;
      
    EXCEPTION
    WHEN OTHERS THEN
      RETURN -1;  
    END fn_updt_app_jti_dlt_usr;
    
    

    The function called several times as part of a job. Basically, the main function (Say M), call a few functions (for example A1... A9). Each of these functions is to do something and updated the application using the above function. Therefore, each of the nine functions will call the above function with different parameters.

    The problem that I am facing is:

    First run, invoke only first of all for the above function will return the positive result ($sql rowcount > 0). When I run M the second time, only first and second calls for the above function will be to return positive results and so on.

    How odd, it's that if I change the values again and run a function M, it will start from the beginning. And what strange more, the dynamic update statement is executed correctly and data are updated successfully. It's just sql rowcount % do not return is not the expected results.

    I tried to run execute immediately without (begin, end). I also tried to run it without HELP ON. It's always the same. I'm really confused, what Miss me here.

    I don't know if this is relevant. But for what it's worth, invoking the function above updates the SAME lines in the table appery_jti_deleted_users that the columns are different. So for all the work, the same lines need to be updated. Each function (A1... A9) will call the above function to update a different column of these lines.

    If you REALLY want to help you having US SHOW, not tell us:

    1. WHAT you do

    2. HOW to

    3. WHAT results you get

    4. WHAT results you expect to get

    First run, invoke only first of all for the above function will return the positive result ($sql rowcount > 0). When I run M the second time, only first and second calls for the above function will be to return positive results and so on.

    How odd, it's that if I change the values again and run a function M, it will start from the beginning. And what strange more, the dynamic update statement is executed correctly and data are updated successfully. It's just sql rowcount % do not return is not the expected results.

    Perhaps that the foregoing is true and maybe he's not. We have NO WAY of knowing because you don't SHOW US anything.

    I tried to run execute immediately without (begin, end). I also tried to run it without HELP ON. It's always the same.

    Yet once you showed us NOTHING >

    You do NOT FOLLOW best practices when you use dynamic sql statements: the sql statement real so that you can print:

    1 SEE what's running - make sure there are no syntax errors, and it seems to be what you wanted

    2 EXECUTE/TEST manually - to see if he really runs without error and see what results it really give.

    3. FIX any syntax or other problems and retest it

    Instrument properly your code and you won't have the problems you are having.

    You should know by now what are the parameters are transmitted when you run the function. So, there are at least three sets of these parameters.

    So you should be able to:

    1 run the instrumented manually function three times

    2. see that all three SQL statements are

    3 manually run these instructions

    4. see that the number of lines is after each execution

    We have no idea of what the output of the function is every time you call it. Apparently, you have, if you save the results of the function somewhere, but you didn't post any of this info.

    We need real details to help you - just listen to your story is not enough.

  • Invoke VMScript write-progress not released

    Hi all

    For the last few weeks, I'm building a deployment based on Excel-entry script.

    Basiclly to process goes like this;

    -you fill an excel file with all kinds of CPU, MEM, space drive, but also if you want to install IIS or SQL.

    -When you start the script, the system reads all this excel sheet cells and fills in the variable using PowerCLI.

    -PowerCLi then creates the computer virtual, based on your input.

    -Once the VM is created, there is only 1 file that will gets execution by invoke-vmscript.

    This line looks like.

    Invoke-VMScript - vm $VMName - ScriptText "Powershell.exe - ExecutionPolicy bypass - c:\PSScripts\StartConfiguration.ps1 of the file" GuestUser - administrator - GuestPassword *.

    It's a powershell script that will make a loop through a folder containing all sorts of PS-scripts. I do this so I have a modular deployment script.

    PS-scripts on the local computer virtual have writing and writing-exit courses, but I don't see them in my hand-console. The one where I started this...

    When I run the on my virtual machine itself, I see the progress bar and the out.

    How can I get what I see progress in my main screen to work?

    Moreover, I also tried running a file (with the progress-bar,...) with vmscript invoke, but does not

    Looks like my call vmscript;

    Invoke-VMScript - vm $VMName - ScriptText "Powershell.exe - ExecutionPolicy bypass - c:\PSScripts\001-WAN-LAN_networkconfig.ps1 of the file" GuestUser - administrator - GuestPassword *.

    Hope someone knows.

    Best regards

    Dave

    The Invoke-VMScript cmdlet uses the methods GuestOperationsManager to run a command on or copy files to/from the guest OS.

    For this, he uses the VMware Tools interface.

    In short, when you use Invoke-VMscript to run a PowerShell script inside a guest, what happens in the background is this:

    • Copy the script / command in OS invited
    • Run the script/command of the copied file
    • capture the result in a file
    • Copy the file with the output to the caller of Invoke-VMScript

    The Write-Progress output is in a stream that is not captured by the above process, so you do not get this output on the side of the appellant.

    On a sidenote, the Invoke-VMScript isn't a kind interactive session.

    If you want to see progress on the calling station, you will have to go to Remote PowerShell Sessions.

  • XQuery does not return results in 10.2.0.4, works on 10.2.0.5

    I have a statement Xquery which works as expected on Oracle 10.2.0.5 but returns no results on Oracle 10.2.0.4.

    What is the result of a query that is poorly written? A bug in 10.2.0.4?
    Is it possible to rewrite the query so that is done the work on 10.2.0.4?

    TestCode:
    declare
    
       l_xml xmltype;
    
       -- Select layers with TileMatrixSet EPSG:28992
       cursor c_layer(p_xml xmltype) is
          select t.*
            from xmltable(xmlnamespaces(default 'http://www.opengis.net/wmts/1.0'
                                       ,'http://www.opengis.net/ows/1.1' as "ows"
                                        ,'http://schemas.opengis.net/gml' as "gml"
                                        ,'http://www.w3.org/1999/xlink' as "xlink"
                                        ,'http://www.w3.org/2001/XMLSchema-instance' as "xsi")
                          ,'for $d in //Layer[TileMatrixSetLink/TileMatrixSet="EPSG:28992"] return $d' passing
                          p_xml columns title varchar2(100) path 'ows:Title'
                          ,format varchar2(100) path 'Format'
                          ,style xmltype path 'Style') as t;
    
    begin
    
       l_xml := xmltype.createxml('<?xml version="1.0" encoding="UTF-8"?>
    <Capabilities xmlns="http://www.opengis.net/wmts/1.0"
    xmlns:ows="http://www.opengis.net/ows/1.1"
    xmlns:xlink="http://www.w3.org/1999/xlink"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:gml="http://www.opengis.net/gml" xsi:schemaLocation="http://www.opengis.net/wmts/1.0 http://schemas.opengis.net/wmts/1.0/wmtsGetCapabilities_response.xsd"
    version="1.0.0">
    <Contents>
      <Layer>
        <ows:Title>brtachtergrondkaart</ows:Title>
        <ows:Identifier>brtachtergrondkaart</ows:Identifier>
        <Style isDefault="true">
          <ows:Identifier>_null</ows:Identifier>
        </Style>
        <Format>image/png8</Format>
        <TileMatrixSetLink>      <TileMatrixSet>EPSG:28992</TileMatrixSet>
        </TileMatrixSetLink>  </Layer>
      <Layer>
        <ows:Title>top10nl</ows:Title>
        <ows:Identifier>top10nl</ows:Identifier>
        <Style isDefault="true">
          <ows:Identifier>_null</ows:Identifier>
        </Style>
        <Format>image/png8</Format>
        <TileMatrixSetLink>      <TileMatrixSet>EPSG:28992</TileMatrixSet>
        </TileMatrixSetLink>  </Layer>
      <Layer>
        <ows:Title>bgt</ows:Title>
        <ows:Identifier>bgt</ows:Identifier>
        <Style isDefault="true">
          <ows:Identifier>_null</ows:Identifier>
        </Style>
        <Format>image/png8</Format>
        <TileMatrixSetLink>      <TileMatrixSet>EPSG:28992</TileMatrixSet>
        </TileMatrixSetLink>  </Layer>
    </Contents>
    </Capabilities>');
    
       for r_layer in c_layer(l_xml)
       loop
          dbms_output.put_line(r_layer.title);
       end loop;
    end;
    10.2.0.5 strategic outcome:
    brtachtergrondkaart
    top10nl
    BGT

    It is indeed strange.

    I can reproduce on 10.2.0.4 and follows seems to remedy:

    (1) containing the list of columns in the SELECTION, instead of t.*:

       -- Select layers with TileMatrixSet EPSG:28992
       cursor c_layer(p_xml xmltype) is
          select t.title, t.format, t.style
            from xmltable(
    

    or,

    (2) with the help of a FLWOR expression extended:

    for $d in //Layer
    where $d/TileMatrixSetLink/TileMatrixSet = "EPSG:28992"
    return $d
    

    You may have already noticed, but the problem only occurs in a context of PL/SQL.
    The same query to run from SQL is OK.

  • Validator do not return is not the results.

    Hi all

    I extended the StringValidator class in order to create a user name validator. When a new user is registered, the user name is validated on the server to check if it exists.

    The code is not thrown error and I know the remoteobject calls to work. The push sets the message, but the problem is that the result is not returned.

    The flow is correct?

    public class PosUsernameValidator extends StringValidator {
              
              private var userServiceRO:RemoteObject = new RemoteObject();
              private var validatorResults:Array = new Array();
              
              public function PosUsernameValidator(){
                   super();
                   userServiceRO.destination = "UserService";
                   userServiceRO.getUserByUserName.addEventListener("result", getUserByUserNameRH);
                   userServiceRO.getUserByUserName.addEventListener("fault", getUserByUserNameFH)
              }
              
              override protected function doValidation(value:Object):Array {
                   validatorResults = super.doValidation(value); 
                   return doForUserName(value);
              }
              
              private function doForUserName(value:Object):Array{
                   userServiceRO.getUserByUserName(String(value));
                   return validatorResults;
              }
              
              private function getUserByUserNameRH(r:ResultEvent, t:Object = null):void{
                   var user:User = r.result as User;
                   if(user!=null){
                        validatorResults.push(new ValidationResult(true, null, "Username error","Username already taken!"));
                   }
              }
              
              private function getUserByUserNameFH(f:FaultEvent, t:Object = null):void{
                   Alert.show(ObjectUtil.toString(f));
              }
              
         }
    

    Once the error message string from the server side, link it to property 'errorString' of any component of entry, you want to display the error on. This will give you the red border and a ScreenTip as if you used a validator. Don't forget to set the error return string to "" to clear the message once validation passes.

  • My event.result may or may not return a node in the xml file. How can I avoid that TypeError: Error #1009:

    My event.result may or may not return a node in the xml file. How can I avoid that TypeError: Error #1009: cannot access a property or method of a null object reference.

    I have a very simple question. I want to take the value of

    Event.Result.Item.nodeindex1.nodeindex2.Row.MyValue;

    and assign it to a text field

    mytextTi.text = event.result.item.nodeindex1.nodeindex2.row.myvalue;

    But if a part of the tree is missing, which is also valid, so I get TypeError: Error #1009: cannot access a property or method of a null object reference.

    I tried various solutions such as the following. Is there any simple way to do this?

    If (event.result.item.nodeindex1.nodeindex2.row.myvalue! = undefined)-does not work

    Unfortunately, one must test all levels to ensure that it is not null before the reference to it. You can take advantage of the short-circuit evaluation in tying together, for example

    if (event.result.item
        && event.result.item.nodeindex1
        && event.result.item.nodeindex1.nodeindex2
        && event.result.item.nodeindex1.nodeindex2.row
        && event.result.item.nodeindex1.nodeindex2.row.myvalue)
    {
        // access the variable
    }
    else
    {
        // one of the XML nodes in the path is null
    }
    

    Or you could stay away from her a little hacky and wrap the reference in a try/catch block.

    -Tom

    Flex SDK engineer

Maybe you are looking for

  • Bluetooth audio compression with W1 chip?

    Hello I recently ordered the new iPhone 7 more and was wondering about different options for headphones, now that I can not connect the iPhone to power at the same time, I plug my headphones. I know that there are already third-party links, which sho

  • Toshiba 48 T 544 * series DG - compatible 3D glasses

    Hello Could someone please help 3D glasses should I buy for 48T 544 series 3D tv, I bought glasses FPT-AG03 but I couldn't pair with the TV.Although, it seems, the same lenses that is indicated on the box to the TV. Could someone send me the manual f

  • How to make more reliable impression on a hybrid system of ten computers?

    I am working on a task force with a dozen computers.  It is a hybrid system in a Pavilion, 3 news from Dell, an older Dell and still more old Dell, gateway 3 and machine Compaq.  There is a Vista machince and the rest XP.  The printer is connected lo

  • I'm unable to re - install my HP Photosmart C4400 all-in-one printer.

    A number of programs including the printer has failed due to a problem with my office. All have now been re-installed, but am not able to reload the printer. Have tried to ensure that all the original software has been removed, but still the CD opens

  • internal error 2753 regutils.dll

    I was advised to uninstall older versions of JAVA, I did, then install the latest version (version 6 update 30).  I get the internal code error 2753 regutils.dll and I can't fix it.  Any advice? Please note that I am of the generation of ballpoint pe