Checking For An Empty Value

Here's my script:
on run
set AdiumStatus to ""
set AdiumStatusType to ""
tell application "System Events"
count (every process whose name is "Adium")
if result = 1 then
tell application "Adium"
if my status type is available then
set AdiumStatusType to "Available. "
else if my status type is away then
set AdiumStatusType to "Away. "
else if my status type is offline then
set AdiumStatusType to "Offline. "
else if my status type is invisible then
set AdiumStatusType to "Invisible. "
end if
set AdiumStatus to (get my status message)
end tell
end if
end tell
return AdiumStatusType & AdiumStatus
end run
If the user hasn't set a custom message status, the script fails when trying to return "AdiumStatus." How can set the script to where if "my message status" is empty, an empty space is added so it doesn't fail? I tried the following to no avail:
If my status message is not "" then
set AdiumStatus to (get my status message)
end if
But this fails, saying "No result was returned from some part of this expression," and the quotes are highlighted.
Any ideas? And how do I format code I post here, BTW?
Thanks!
Dual 2.0GHz G5   Mac OS X (10.4)  

Nothing at all? Wow, that's pretty impressive. You would appear to be dealing with a broken AppleScript implementation, there; when you request something that doesn't exist, most programs tend to treat that as, you know, an error or something, or at least return the "missing value" value. Returning something that undefines an existing variable isn't reasonable behavior. (Time to file a bug report, methinks.)
One way or another, you're going to have to work around this. Given your result, there, it looks like kel's workaround is the way to go. To put it in the terms of your variables:
tell application "Adium"
set AdiumStatus to my status message
end tell
try
AdiumStatus
on error
set AdiumStatus to missing value
end try
That will give you the status message if it exists, and give you the missing value otherwise. (Which, as I have said, is useful -- when it is time to do something with the result, you can test for it and tell whether the value was set. If you just use an empty string, or some other specific value, then you can't be sure that someone didn't actually set the value to that specific value...) That would look something like this:
if AdiumStatus is missing value then
display dialog "No status message was set."
else
display dialog "The status message was: " & AdiumStatus
end if
The only other workaround which occurs to me would be to rely on the "exists" keyword, as in
if exists my status message then
set AdiumStatus to my status message
else
set AdiumStatus to missing value
end if
but if the application's implementation is already broken enough to return a complete blank without comment, there's no reason to believe it will handle "exists" properly, either.

Similar Messages

  • Advanced search for a price range while checking for an empty values using php in DW

    I am creating an advanced search with DW php. I would like to submit a search where some entrys can be left black. So checking for empty values (which I have managed, thank you David Powel), however when searching between multiple price ranges does not seem to work.
    please see attached forms:
    The search page:
    <form action="Detailed-Search-Result.php" method="get" target="_self"><table width="90%" border="0" cellspacing="0" cellpadding="2">
      <tr>
        <td colspan="2"><label for="Detailed Search">Advanced Search</label></td>
        </tr><tr>
        <td><label for="Product">Product:</label>
          </td>
        <td><select name="Category" id="Category">
          <option value=></option>
            <option value="Keyboard">Keyboard</option>
            <option value="Piano">Piano</option>
          </select></td>
      </tr>
      <tr>
        <td><label for="Make">Make:</label>
        </td>
        <td><select name="Manufacturer">
          <option value=></option>
          <option value="Boss">Boss</option>
          <option value="Casio">Casio</option>
          <option value="Kawai">Kawai</option>
          <option value="Ketron">Ketron</option>
          <option value="Korg">Korg</option>
          <option value="Roland">Roland</option>
          <option value="Samson">Samson</option>
          <option value="Yamaha">Yamaha</option>
        </select></td>
      </tr>
      <tr>
        <td><label for="Color">Color:</label></td>
        <td><select name="Color">
          <option value=></option>
          <option value="Black">Black</option>
          <option value="Cherry">Cherry</option>
          <option value="Mahogany">Mahogany</option>
          <option value="Polished Eboney">Polished Eboney</option>
          <option value="Rosewood">Rosewood</option>
          <option value="White">White</option>
          <option value="Red">Red</option>
        </select></td>
      </tr>
      <tr>
        <td><label for="Price">Price:</label></td>
        <td><select name="Price">
          <option value=></option>
          <option value="0-500">£0-500</option>
          <option value="500-1000">£500-1000</option>
          <option value="1000-2000">£1000-2000</option>
          <option value="2000">£2000&gt;</option>
        </select></td>
      </tr>
      <tr>
        <td colspan="2">
          <input name="Search2" type="submit" id="Search2"></td>
        </tr>
        </table>
    </form>
    The results page
    $varCategory_rsgetsearch2 = "%";
    if (isset($_GET['Category'])) {
      $varCategory_rsgetsearch2 = $_GET['Category'];
    $varMake_rsgetsearch2 = "%";
    if (isset($_GET['Manufacturer'])) {
      $varMake_rsgetsearch2 = $_GET['Manufacturer'];
    $varColor_rsgetsearch2 = "%";
    if (isset($_GET['Color'])) {
      $varColor_rsgetsearch2 = $_GET['Color'];
    $varPrice_rsgetsearch2 = "%";
    if (isset($_GET['Price'])) {
      $varPrice_rsgetsearch2 = $_GET['Price'];
    mysql_select_db($database_dBconn, $dBconn);
    $query_rsgetsearch2 = 'SELECT * FROM products';
    $where = false;
    if (isset($_GET['Category']) && !empty($_GET['Category'])) {
    $query_rsgetsearch2 .= ' WHERE Category LIKE varCategory '. GetSQLValueString($_GET['Category'], 'text');
      $where = true;
    if (isset($_GET['Manufacturer']) && !empty($_GET['Manufacturer'])) {
      if ($where) {
       $query_rsgetsearch2 .= ' AND ';
      } else {
       $query_rsgetsearch2 .= ' WHERE ';
        $where = true;
    $query_rsgetsearch2 .= 'Manufacturer LIKE varManufacturer ' . GetSQLValueString($_GET['Manufacturer'], 'text');
    if (isset($_GET['Color']) && !empty($_GET['Color'])) {
        if ($where) {
       $query_rsgetsearch2 .= ' AND ';
      } else {
       $query_rsgetsearch2 .= ' WHERE ';
        $where = true;
      $query_rsgetsearch2 .= 'Color LIKE varColor ' . GetSQLValueString($_GET['Color'], 'text');
    if (isset($_GET['Price']) && !empty($_GET['Price'])) {
        if ($where) {
       $query_rsgetsearch2 .= ' AND ';
      } else {
       $query_rsgetsearch2 .= ' WHERE ';
        $where = true;
    switch( $_GET['Price'] ){
            case '0-500':
            $query_rsgetsearch2 .= '  RRP BETWEEN 0 AND 500 ORDER BY price ASC'. GetSQLValueString($_GET['Price'], 'text');
            break;
              case '500-1000':
            $query_rsgetsearch2 .= ' RRP BETWEEN 500 AND 1000 ORDER BY price ASC'. GetSQLValueString($_GET['Price'], 'text');
            break;
                        case '1000-2000':
            $query_rsgetsearch2 .= ' RRP BETWEEN 1000 AND 2000 ORDER BY price ASC'. GetSQLValueString($_GET['Price'], 'text');
            break;
              case '2000':
           $query_rsgetsearch2 .= ' RRP BETWEEN 2000 AND 10000 ORDER BY price ASC'. GetSQLValueString($_GET['Price'], 'text');
            break;
    $query_rsgetsearch2 = sprintf("SELECT * FROM products WHERE Category LIKE %s AND products.Manufacturer LIKE %s AND products.Color LIKE %s", GetSQLValueString("%" . $varCategory_rsgetsearch2 . "%", "text"),GetSQLValueString("%" . $varMake_rsgetsearch2 . "%", "text"),GetSQLValueString("%" . $varColor_rsgetsearch2 . "%", "text"));
    $query_limit_rsgetsearch2 = sprintf("%s LIMIT %d, %d", $query_rsgetsearch2, $startRow_rsgetsearch2, $maxRows_rsgetsearch2);
    $rsgetsearch2 = mysql_query($query_limit_rsgetsearch2, $dBconn) or die(mysql_error());
    $row_rsgetsearch2 = mysql_fetch_assoc($rsgetsearch2);
    I would be greatfull for any help

    I have managed to solve the problem.
    In the end I didn't check if the values were empty, as it worked fine without. However the switch of the price didn't work in combination with the rest of the query.
    I've solved the problem as follows:
    $varCategory_rsgetsearch2 = "%";
    if (isset($_GET['Category'])) {
      $varCategory_rsgetsearch2 = $_GET['Category'];
    $varMake_rsgetsearch2 = "%";
    if (isset($_GET['Manufacturer'])) {
      $varMake_rsgetsearch2 = $_GET['Manufacturer'];
    $varColor_rsgetsearch2 = "%";
    if (isset($_GET['Color'])) {
      $varColor_rsgetsearch2 = $_GET['Color'];
    $varPrice_rsgetsearch2 = "%";
    if (isset($_GET['Keysound_price'])) {
      $varPrice_rsgetsearch2 = $_GET['price'];
    mysql_select_db($database_dBconn, $dBconn);
    $query_rsgetsearch2 = sprintf("SELECT * FROM products WHERE Category LIKE %s AND products.Manufacturer LIKE %s AND products.Color LIKE %s", GetSQLValueString("%" . $varCategory_rsgetsearch2 . "%", "text"),GetSQLValueString("%" . $varMake_rsgetsearch2 . "%", "text"),GetSQLValueString("%" . $varColor_rsgetsearch2 . "%", "text") );
    switch( $_GET['price'] ){
            case '0-500':
            $query_rsgetsearch2 .= ' AND price BETWEEN 0 AND 500 ORDER BY price ASC';
            break;
              case '500-1000':
            $query_rsgetsearch2 .= ' AND price BETWEEN 500 AND 1000 ORDER BYprice ASC';
            break;
                        case '1000-2000':
            $query_rsgetsearch2 .= ' AND price BETWEEN 1000 AND 2000 ORDER BY price ASC';
            break;
              case '2000':
            $query_rsgetsearch2 .= ' AND price BETWEEN 2000 AND 10000 ORDER BY price ASC';
            break;
    $query_limit_rsgetsearch2 = sprintf("%s LIMIT %d, %d", $query_rsgetsearch2, $startRow_rsgetsearch2, $maxRows_rsgetsearch2);
    $rsgetsearch2 = mysql_query($query_limit_rsgetsearch2, $dBconn) or die(mysql_error());
    $row_rsgetsearch2 = mysql_fetch_assoc($rsgetsearch2);
    I'm sure that you can keep the checking for values in, however for me the was no need for it anymore.
    Thanks for all your help

  • Check for the multiple values of the order type in if cond. in user exit

    Hi all,
    I have the exisitng code like this.
    IF AUFK-AUART = C_STAT_1000.
        RETAIL = C_RETAIL_X.
      ELSE.
        SEARCH W_SYST_STAT FOR 'SETC'.
        IF SY-SUBRC <> 0.
          ERR_MSG-MSGID = 'ZP'.
          ERR_MSG-MSGTY = 'E'.
          ERR_MSG-MSGNO = '017'.
          ERR_MSG-MSGV1 = DETAILS-RAUFNR.
          APPEND ERR_MSG.
          EXIT.
        ENDIF.
      ENDIF.
    In the above code, the order type aufk-auart is checked for a single value '1000'.
    How do i include the logic tocheck if aufk auart for multple values in tha if condition.
    It can be multiple values of whihc i do not have the detail.
    Regs,
    SuryaD.

    Hi all,
    I have the sample code with me.
    Hope this helps someone who is looking for the usage of this Function module.'K_HIERARCHY_TABLES_READ'
    DATA:
        l_set_node_tab  LIKE grpobjects OCCURS 0 WITH HEADER LINE,
        l_set_val_tab   LIKE grpvalues  OCCURS 0 WITH HEADER LINE,
        l_info          LIKE grphinfo,
        l_overrite      LIKE sy-datar,
        l_set_class(4) TYPE c,
        l_set_id(34) TYPE c,
        l_set_kokrs LIKE  sethier-kokrs,
        lr_auart TYPE RANGE OF auart,
        lr_auart-line LIKE LINE OF lr_auart.
      CONSTANTS:lc_set(3) TYPE c VALUE 'SET',
                  lc_id(22) TYPE c VALUE '0000Z-GPMRCMI-EXC-CUST',
                  lc_i      TYPE c VALUE 'I',
                  lc_bt(2)  TYPE c VALUE 'BT'.
      CLEAR:
          l_set_node_tab,
          l_set_node_tab[],
          l_set_val_tab,
          l_set_val_tab[].
      l_set_class = lc_set.
      l_set_id    = lc_id.
      CALL FUNCTION 'K_HIERARCHY_TABLES_READ'
           EXPORTING
                e_class                     = l_set_class
                e_setid                     = l_set_id
                e_kokrs                     = l_set_kokrs
                e_mandt                     = sy-mandt
           TABLES
                t_nodes                     = l_set_node_tab
                t_values                    = l_set_val_tab
           CHANGING
                c_info                      = l_info
                c_overwrite                 = l_overrite
           EXCEPTIONS
                no_controlling_area         = 1
                no_chart_of_account         = 2
                different_controlling_areas = 3
                different_chart_of_accounts = 4
                set_not_found               = 5
                illegal_field_replacement   = 6
                illegal_table_replacement   = 7
                fm_raise                    = 8
                convert_error               = 9
                no_overwrite_standard_hier  = 10
                no_bukrs_for_kokrs          = 11
                OTHERS                      = 12.
      IF sy-subrc = 0.
        CLEAR : lr_auart.
        REFRESH lr_auart.
    create internal set table
        LOOP AT l_set_val_tab.
          lr_auart-line-low      = l_set_val_tab-vfrom.
          lr_auart-line-high     = l_set_val_tab-vto.
          lr_auart-line-sign     = lc_i.
          lr_auart-line-option   = lc_bt.
          APPEND lr_auart-line to lr_auart.
          CLEAR lr_auart-line.
        ENDLOOP.
      ENDIF.

  • Using '=' to check for NULL column value

    We are currently encountering an issue where 10.1.0.5 is happily accepting a check on a column for a null value with what I have always known to be an invalid syntax.
    For instance:
    select col1 from my table where col1=null
    Although this is wrong and we are working on locating the queries formatted as such, what I am wondering is why is it working on the 10.1.0.5 version but we cannot get the same query to execute on 8i, 9i, 10.2.0...? Is there a flag that can be enabled to allow this compare?

    I am familiar with the correct syntax to be using. What I am looking for is a possible explanation as to why the query below returns the correct results on 10.1.0.5 and returns nothing in all other versions. I would expect the same behavior across all instances. See the two lines in bold "AREA=NULL" and "SUBAREA=NULL"
    SELECT DISTINCT
    UNIQID,
    MGRCOMMENT,
    REQ.CREATED_BY CREATED,
    C2.CNAME DEVELOPER,
    C5.CNAME PRODMGR,
    C3.CNAME ASSIGNED,
    C4.CONTACTID CURRENTUSER,
    ID,
    STATUSNAME,
    REQ.STATUS STATUSID,
    PRIORITYNAME,
    TITLE,
    MAS1.MODULENAME,
    MAS1.AREANAME,
    MAS1.SUBAREANAME,
    MIN1.MODULE,
    MIN2.AREA,
    MIN3.SUBAREA
    FROM REQ,
    PRIORITY,
    STATUS,
    (SELECT FIRST_VALUE(M1.MODULENAME)
    OVER (PARTITION BY REQUNIQID ORDER BY MODULENAME ROWS UNBOUNDED PRECEDING) MODULENAME, FIRST_VALUE(A1.AREANAME)
    OVER (PARTITION BY REQUNIQID ORDER BY AREA ROWS UNBOUNDED PRECEDING) AREANAME, FIRST_VALUE(SA1.SUBAREANAME)
    OVER (PARTITION BY REQUNIQID ORDER BY SUBAREANAME ROWS UNBOUNDED PRECEDING) SUBAREANAME, REQUNIQID
    FROM REQMOD, MOD M1, ARA A1, SBARA SA1
    WHERE M1.MODULEID = REQMOD.MODULE
    AND A1.AREAID = REQMOD.AREA
    AND SA1.SUBAREAID = REQMOD.SUBAREA) MAS1,
    (SELECT FIRST_VALUE(C2.CNAME) OVER (PARTITION BY REQUNIQID ORDER BY CNAME ROWS UNBOUNDED PRECEDING) CNAME, REQUNIQID
    FROM REQ_ASSIGN, CONTACT C2
    WHERE C2.CONTACTID = REQ_ASSIGN.CONTACTID
    AND ASSIGNMENT_TYPE=2) C2,
    (SELECT FIRST_VALUE(C5.CNAME) OVER (PARTITION BY REQUNIQID ORDER BY CNAME ROWS UNBOUNDED PRECEDING) CNAME, REQUNIQID
    FROM REQ_ASSIGN, CONTACT C5
    WHERE C5.CONTACTID = REQ_ASSIGN.CONTACTID
    AND ASSIGNMENT_TYPE=1) C5,
    (SELECT FIRST_VALUE(C3.CNAME)
    OVER (PARTITION BY REQUNIQID ORDER BY CNAME ROWS UNBOUNDED PRECEDING) CNAME, REQUNIQID
    FROM REQ_ASSIGN, CONTACT C3
    WHERE C3.CONTACTID = REQ_ASSIGN.CONTACTID
    AND ASSIGNMENT_TYPE<>2
    AND ASSIGNMENT_TYPE<>1) C3,
    (SELECT DISTINCT REQUNIQID, CONTACTID FROM REQ_ASSIGN WHERE CONTACTID=5) C4,
    (SELECT DISTINCT REQUNIQID, MODULE FROM REQMOD WHERE MODULE=1) MIN1,
    *(SELECT DISTINCT REQUNIQID, AREA FROM REQMOD WHERE AREA=NULL) MIN2,*
    *(SELECT DISTINCT REQUNIQID, SUBAREA FROM REQMOD WHERE SUBAREA=NULL) MIN3,*
    REQCOMMENTS
    WHERE PRIORITY.PRIORITYID = REQ.PRIORITY
    AND STATUS.STATUSID = REQ.STATUS
    AND MAS1.REQUNIQID = REQ.UNIQID
    AND C2.REQUNIQID = REQ.UNIQID
    AND C5.REQUNIQID = REQ.UNIQID
    AND C3.REQUNIQID = REQ.UNIQID
    AND C4.REQUNIQID = REQ.UNIQID
    AND MIN1.REQUNIQID = REQ.UNIQID
    AND MIN2.REQUNIQID = REQ.UNIQID
    AND MIN3.REQUNIQID = REQ.UNIQID
    AND REQCOMMENTS.REQUNIQID = REQ.UNIQID
    AND REQ.PROJECTID = 3;

  • Check for the Numeric Values

    Hi All,
    I am new to java . Please help me the this problem .
    I have a string variable and which store the values like "ABC" or "123" but i need to check if the variable values are like "123" then process ..other wise ..exclude that( like "ABC" ....).
    Thanks in Advance ..
    prakash

    JosAH wrote:
    BIJ001 wrote:
    While a good and straightforward solution, it might incur some run-time penalty (exception-object-creation, exception handling overhead).Indeed, but what would be the runtime overhead for a RE that exactly matches the range of valid ints (or longs)?Assuming a reasonably well-written regex, matching only valid {color:000080}int{color}s shouldn't be significantly slower than using "&#92;\d+". On the other hand, throwing and catching exceptions is hideously expensive. If you expect to get a lot of invalid strings, you're definitely better off validating them with a regex before calling Integer.parseInt(). But none of this really matters unless you're processing large numbers of strings in a tight loop.

  • Example for UITestControl.WaitForControlCondition Method checking for WpfText.Text value

    Hi
    I want to wait until the text value of a WpfText is a certain string. How would that be done using UITestControl.WaitForControlCondition Method when a predicate of the test function must be used and I need to reference the WpfText item I want to check
    text value of?
    Thanks
    RB_IA

    Hi RB_IA,
    AdrianHHH’s idea for that code is right, he meant that he compiled the code but he did not execute it to verify whether the code can run fine. I think that code should run.
    For the code you pasted, yes, the UITestControl parameter is not sent to IsStatusDone method through
     parameters within it directly, but the text is defined outside of IsStutusDone method and it is used in the IsStatusDone method.
    For your second doubt, Adrian used this API:
    WaitForControlCondition(Predicate<UITestControl>) which accepts a bool parameter as the specific condition instead of this API:
    WaitForCondition<T>(T, Predicate<T>).
    You can reference this code snippet which is used to
    wait till the status text of a control is “Succeeded” or “Failed”.in this blog:How
    To: Make playback wait for certain event?
    // Define the method to evaluate the condition
    private
    static
    bool IsStatusDoneOrError(UITestControl[] controls)
        WinText statusText = controls[0]
    as
    WinText;
        WinWindow errorDialog = controls[1]
    as
    WinWindow;
        return statusText.DisplayText ==
    "Succeeded" || errorDialog.Exists;
    // In test method, wait till the method evaluates to true
    UITestControl.WaitForCondition<UITestControl[]>(new
    UITestControl[] { statusText, errorDialog }, IsStatusDoneOrError);
    I am not a developer, maybe you can try to write your code like below to compare the text value of the wpf control through WpfText.DisplayText property with the expected text value:
    class ParameterisedIsStatusDone
        public
    ParameterisedIsStatusDone(string t)
    expectedtext = t;
        private
    string expectedtext;
        public
    bool IsStatusDone(UITestControl control)
    WpfText ControlTextVale = control
    as WpfText;
    return
    ControlTextVale.DisplayText ==
    expectedtext;
    ParameterisedIsStatusDone pisd =
    new ParameterisedIsStatusDone("Succeeded");
    yourControl.WaitForControlCondition(pisd.IsStatusDone);
    You also can reference Victor Zn's solution in that thread.
    Best regards,
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • Checking for an empty query

    Hi guys,
    I wanted to know if it was possible to check a query to see
    if it is empty or not (or if the value comes out to be true or
    false). I hope I'm understandable.
    Would I use a IsBoolean or IsVaild function?

    Typically, you can check the query.RecordCount to see if it
    contains one or more.
    <cfquery name="qTest" datasource="dsn">
    select * from mytable
    </cfquery>
    <cfif qTest.RecordCount GTE 1>
    //code
    </cfif>
    As long as the query itself does not fail (error, exception,
    etc.), you will get a query variable back and can test it's record
    count.
    If there is a concern that the query might fail (perhaps the
    SQL is dynamic in some way), you can use cftry/cfcatch to ensure
    that, at the least, you get back an empty query:
    <cftry>
    <cfquery name="qTest" datasource="dsn">
    select * from mytable
    </cfquery>
    <cfcatch type="database">
    <cfset qTest = QueryNew("column1,column2")/>
    </cfcatch>
    </cftry>
    <cfif qTest.RecordCount GTE 1>
    //code
    </cfif>
    Hope this helps...

  • Check for empty session variable

    Hey there we're making a login for our jsp web application.
    The login allready works and so does the log out but now we want to make a check to make it impossible to login with names that are not in the database.
    So what basicly happens is as follows...
    Login reads the database info:
    while (rs.next()) {
         if (request.getParameter("username").equals(rs.getString("username")) && request.getParameter("password").equals(rs.getString("password"))){
              session.setAttribute("username", rs.getString("username"));
              session.setAttribute("firstname", rs.getString("first_name"));
              session.setAttribute("lastname", rs.getString("last_name"));
    }but when you enter invalid information teh session variabe "lastname" for example should read null. Now we want to make a check for this null value, which should look something like this:
    if(session.getAttribute("username").equals(null)){
         response.setStatus(301);
         response.setHeader("Location", "/index.jsp");
    } else {
         response.setStatus(301);
         response.setHeader("Location", "/mainmenu.jsp");
    }But this doesnt work, it just logs in with the null values... any1 got a clue??
    edit: im actually looking for something like the isSet command in PHP to give an idea...
    Message was edited by:
    whappit

    Your test for null will always fail, because request.getParameter("username") is NEVER null, in that it exists, even though it contains no data.
    Try .equals(""); instead.

  • Passing null/empty values from a actionscript VO to a Coldfusion ORM object

    This is the situation.
    If you have an actionscript VO that binds to a Coldfusion ORM object via the RemoteClass metadata and some of the values are not set, null, or empty strings and you pass it from Flex to Coldfusion then the Coldfusion deserialization barfs saying the values are not acceptable date values (for type="date") or valid emails (for validation="email") or other such validations, even if required="false" on the property.
    For instance, if you have the following actionscript VO:
    package vo
        [RemoteClass(alias="com.companyname.Person")]
        [Bindable]
        public class Person
            public var person_id:Number;
            public var last_name:String;
            public var first_name:String;
            public var email:String;
            public var created_date:date;
         public function Person() {}
    And you have the corresponding Coldfusion component:
    <cfcomponent displayname="person" output="false"
        alias="com.companyname.Person"
        schema="dbo" persistent="true"
        table="PERSON">
        <cfproperty name="person_id" type="numeric" fieldtype="id" validate="integer" required="true" column="PERSON_ID"/>
        <cfproperty name="last_name" type="string" column="LAST_NAME" required="true"/>
        <cfproperty name="first_name" type="string" required="true" column="FIRST_NAME"/>
        <cfproperty name="email" type="string" validate="email" required="false" column="EMAIL"/>
        <cfproperty name="date_created" type="date" required="false" column="DATE_CREATED"/>
    </cfcomponent>
    Then if you pass the actionscript VO as is to Coldfusion, the deserialization complains that you do not have a valid email or a valid date for date_created.  This is bad, bad, bad.  Essentially if you have a validation of certain types (email being one) or a date property, or probably some other cases, then you essentially can not make it not required, it automatically makes it required because the Coldfusion serializer considers null/empty values as invalid dates or emails.  But the serializer should not care for values that are not required, there has to be a way to pass null/empty values to these data types, but apparently there's not.  If you pass an empty string ("") you still have the same problem.  I know Coldfusion does not have null values, but there has to be a way to do this, otherwise it defeats the purpose of having required="false" and some kind of validation on the property.
    There seems to be two ways around it.  One is to override the implicit setters for the properties on the Coldfusion side and check for 0 length values yourself, then set the property if it is not, or create your own validation routine.  I ended up creating my own validation function since I didn't want to have to write a setter function for everyone of these cases and I can pass back user friendly validation messages.
    Have other people encountered this problem?  How have you gotten around it?  Thanks.

    I realize that I didn't clarify that I am using ColdFusion
    for getting the data. This class was generated by the Create CFC
    wizard in Flex Builder.
    package com.generated
    [Managed]
    [RemoteClass(alias="components.generated.clients.Clients")]
    public class Clients
    public var clientid:Number = 0;
    public var clientfirstname:String = "";
    public var clientlastname:String = "";
    public var clientaddress1:String = "";
    public var clientaddress2:String = "";
    public var clientcity:String = "";
    public var clientstate:String = "";
    public var clientzip:String = "";
    public var clientphone:String = "";
    public var clientemail:String = "";
    public function Clients()
    }

  • Passing null/empty values from Flex to a Coldfusion ORM object

    This is the situation.
    If you have an actionscript VO that binds to a Coldfusion ORM object via the RemoteClass metadata and some of the values are not set, null, or empty strings and you pass it from Flex to Coldfusion then the Coldfusion deserialization barfs saying the values are not acceptable date values (for type="date") or valid emails (for validation="email") or other such validations, even if required="false" on the property.
    For instance, if you have the following actionscript VO:
    package vo
        [RemoteClass(alias="com.companyname.Person")]
        [Bindable]
        public class Person
            public var person_id:Number;
            public var last_name:String;
            public var first_name:String;
            public var email:String;
            public var created_date:date;
         public function Person() {}
    And you have the corresponding Coldfusion component:
    <cfcomponent displayname="person" output="false"
        alias="com.companyname.Person"
        schema="dbo" persistent="true"
        table="PERSON">
        <cfproperty name="person_id" type="numeric" fieldtype="id" validate="integer" required="true" column="PERSON_ID"/>
        <cfproperty name="last_name" type="string" column="LAST_NAME" required="true"/>
        <cfproperty name="first_name" type="string" required="true" column="FIRST_NAME"/>
        <cfproperty name="email" type="string" validate="email" required="false" column="EMAIL"/>
        <cfproperty name="date_created" type="date" required="false" column="DATE_CREATED"/>
    </cfcomponent>
    Then if you pass the actionscript VO as is to Coldfusion, the deserialization complains that you do not have a valid email or a valid date for date_created.  This is bad, bad, bad.  Essentially if you have a validation of certain types (email being one) or a date property, or probably some other cases, then you essentially can not make it not required, it automatically makes it required because the Coldfusion serializer considers null/empty values as invalid dates or emails.  But the serializer should not care for values that are not required, there has to be a way to pass null/empty values to these data types, but apparently there's not.  If you pass an empty string ("") you still have the same problem.  I know Coldfusion does not have null values, but there has to be a way to do this, otherwise it defeats the purpose of having required="false" and some kind of validation on the property.
    There seems to be two ways around it.  One is to override the implicit setters for the properties on the Coldfusion side and check for 0 length values yourself, then set the property if it is not, or create your own validation routine.  I ended up creating my own validation function since I didn't want to have to write a setter function for everyone of these cases and I can pass back user friendly validation messages.
    Have other people encountered this problem?  How have you gotten around it?  Thanks.

    Looks like a known workaround to this issue is to wrap the Flex object in an array.
    The ColdFusion CFC will accept that as an array, with the first an only element being a struct, which is the object you built in Flex.

  • SQLLDR - how to set a default value for an empty string

    I'm using SQLLDR to load data from a flat file on Oracle 10g 10.2.0.4 EE, Linux RHEL 4 update 6. Seems like my question is simple, but darned if I can't find the solution.
    My source file (comma delimited extracted form a different RDBMS) has some (not all) rows where the output for a string is "", and not NULL. How do I check for empty string and add a default value in the control file? The target column is non-nullable
    Here's my current control file - however, the column attributeName where sometimes the source record is "" does not get evaluated as NULL.
    load data
    infile 'mydata.del'
    badfile 'mydata.bad'
    discardfile 'mydata.dsc'
    into table mydata
    fields terminated by "," optionally enclosed by '"'
       TRAILING NULLCOLS           
    (l_metadata,
    company,
    className,
    attributeName "decode(:vc_attributeName,null, 'none')",
    attributeDefault)
    {code}
    When I tried decode with "", I received the following error:
    {code}SQL*Loader-350: Syntax error at line 11.
    Expecting "," or ")", found ", 'none')".
    attributeName "decode(:vc_attributeName,"", 'none')", {code}
    This does not work either:
    {code}
    load data
    infile 'mydata.del'
    badfile 'mydata.bad'
    discardfile 'mydata.dsc'
    into table mydata
    fields terminated by "," optionally enclosed by '"'
       TRAILING NULLCOLS           
    (l_metadata,
    company,
    className,
    attributeName NULLIF attributeName = BLANKS ,"decode(:vc_attributeName,null, 'none')",
    attributeDefault) I get the following in the log:
    Table COMPANYMETADATA, loaded from every logical record.
    Insert option in effect for this table: INSERT
    TRAILING NULLCOLS option in effect
       Column Name                  Position   Len  Term Encl Datatype
    L_METADATA                          FIRST     *   ,  O(") CHARACTER
    COMPANY                            NEXT     *   ,  O(") CHARACTER
    CLASSNAME                         NEXT     *   ,  O(") CHARACTER
    ATTRIBUTENAME                     NEXT     *   ,  O(") CHARACTER
        NULL if ATTRIBUTENAME = BLANKS
        SQL string for column : "decode(:attributeName,null, 'none')"
    ATTRIBUTEDEFAULT                  NEXT     *   ,  O(") CHARACTER
    Record 1: Rejected - Error on table COMPANYMETADATA, column ATTRIBUTENAME.
    ORA-01400: cannot insert NULL into ("SRV5"."COMPANYMETADATA"."ATTRIBUTENAME")
    {code}
    Any help is appreciated -
    Edited by: kpw on Feb 9, 2009 11:10 AM                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

    Hello,
    I just loaded following data successfully in my_data table using the same control file I posted. Yes it will evaluate "" as null and replace with none, remember in control file you have this option, "optionally enclosed by '"'.
    #my_data.dat
    "myname1", "attribname1"
    "myname2", "attribname2"
    "myname3", "attribname3"
    "myname4", ""
    #my_data.ctl
    load data
    into table my_data
    fields terminated by "," optionally enclosed by '"'
    TRAILING NULLCOLS           
    my_name char(30),
    vc_attributeName "decode(:vc_attributeName,null, 'none', :vc_attributeName)"
    {code}
    Here is the output log file
    {code}
    Control File:   my_data.ctl
    Data File:      mydata.dat
      Bad File:     mydata.bad
      Discard File:  none specified
    (Allow all discards)
    Number to load: ALL
    Number to skip: 0
    Errors allowed: 50
    Bind array:     64 rows, maximum of 256000 bytes
    Continuation:    none specified
    Path used:      Conventional
    Table MY_DATA, loaded from every logical record.
    Insert option in effect for this table: INSERT
    TRAILING NULLCOLS option in effect
       Column Name                  Position   Len  Term Encl Datatype
    MY_NAME                             FIRST    30   ,  O(") CHARACTER           
    VC_ATTRIBUTENAME                     NEXT     *   ,  O(") CHARACTER           
        SQL string for column : "decode(:vc_attributeName,null, 'none', :vc_attributeName)"
    Table MY_DATA:
      4 Rows successfully loaded.
      0 Rows not loaded due to data errors.
      0 Rows not loaded because all WHEN clauses were failed.
      0 Rows not loaded because all fields were null.
    Space allocated for bind array:                  18560 bytes(64 rows)
    Read   buffer bytes: 1048576
    Total logical records skipped:          0
    Total logical records read:             4
    Total logical records rejected:         0
    Total logical records discarded:        0
    Run began on Mon Feb 09 18:17:35 2009
    Run ended on Mon Feb 09 18:17:36 2009
    Elapsed time was:     00:00:00.98
    CPU time was:         00:00:00.10
    {code}
    Hope this helps clearing your dobuts
    Regards                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • Check for null or empty in the functoid

    I want to check for null and empty values on input source node. If there exists a null or empty in the input source node, I should not pass that to output destination node. Does the
    following attachment work? I want to check for null or empty in the date and time and then concatenate them to send to output. If any of them is null or empty, the other should not fail. In the Not Equal Functoid I am checking for blank, but how to check for
    null?

    A null check might not be you best option.  If your requirement is you must have both the date and time component supplied in order to populate EventDate, then I would use a Script Functoid that takes data and time as parameters.
    In the C# method, first check if either is an empty string, if so return an empty string.
    If not, TryParse the data, if successful, return a valid data string for EventDate.  If not, error or return empty string, whichever satsifies the requirement.

  • How does APEX check for null values in Text Fields on the forms?

    Hello all,
    How does APEX check for null values in Text Fields on the forms? This might sound trivial but I have a problem with a PL/SQL Validation that I have written.
    I have one select list (P108_CLUSTER_ID) and one Text field (P108_PRIVATE_IP). I made P108_CLUSTER_ID to return null value when nothing is selected and assumed P108_PRIVATE_IP to return null value too when nothign is entered in the text field.
    All that I need is to validate if P108_PRIVATE_IP is entered when a P108_CLUSTER_ID is selected. i.e it is mandatory to enter Private IP when a cluster is seelcted and following is my Pl/SQL code
    Declare
    v_valid boolean;
    Begin
    IF :P108_CLUSTER_ID is NULL and :P108_PRIVATE_IP is NULL THEN
    v_valid := TRUE;
    ELSIF :P108_CLUSTER_ID is NOT NULL and :P108_PRIVATE_IP is NOT NULL THEN
    v_valid := TRUE;
    ELSIF :P108_CLUSTER_ID is NOT NULL and :P108_PRIVATE_IP is NULL THEN
    v_valid := FALSE;
    ELSIF :P108_CLUSTER_ID is NULL and :P108_PRIVATE_IP is NOT NULL THEN
    v_valid := FALSE;
    END IF;
    return v_valid;
    END;
    My problem is it is returning FALSE for all the cases.It works fine in SQL Command though..When I tried to Debug and use Firebug, I found that Text fields are not stored a null by default but as empty strings "" . Now I tried modifying my PL/SQL to check Private_IP against an empty string. But doesn't help. Can someone please tell me how I need to proceed.
    Thanks

    See SQL report for LIKE SEARCH I have just explained how Select list return value works..
    Cheers,
    Hari

  • Checking for null value in arraylist

    Hi
    i have an excel file which i i am reading into an arraylist row by row but not necesarrily that all columns in the row mite be filled. So how do i check for null values in the array list.
    try
                        int cellCount = 0;
                        int emptyRow = 0;
                        HSSFWorkbook workbook = new HSSFWorkbook(new FileInputStream(file));
                        HSSFSheet sheet = workbook.getSheetAt(0);
                        Iterator rows = sheet.rowIterator(); 
                        myRow = new ArrayList();
                        int r = 1;
                             while (rows.hasNext())
                                  System.out.println("Row # " + r);
                                  HSSFRow row = (HSSFRow) rows.next();
                                  Iterator cells = row.cellIterator();          
                                  cellCount = 0;
                                  boolean isValid = false;
                                  while (cells.hasNext())
                                       HSSFCell cell = (HSSFCell) cells.next();
                                       switch (cell.getCellType())
                                            case HSSFCell.CELL_TYPE_NUMERIC:
                                                 double num = cell.getNumericCellValue();     
                                                 DecimalFormat pattern = new DecimalFormat("###,###,###,###");     
                                                 NumberFormat testNumberFormat = NumberFormat.getNumberInstance();
                                                 String mob = testNumberFormat.format(num);               
                                                 Number n = null;
                                                 try
                                                      n = pattern.parse(mob);
                                                 catch ( ParseException e )
                                                      e.printStackTrace();
                                                 System.out.println(n);
                                                 myRow.add(n);                                             
                                                 //myRow.add(String.valueOf(cell.getNumericCellValue()).trim());
                                                 //System.out.println("numeric: " +cell.getNumericCellValue());
                                                 break;
                                            case HSSFCell.CELL_TYPE_STRING:
                                                 myRow.add(cell.getStringCellValue().trim());
                                                 System.out.println("string: " + cell.getStringCellValue().trim());
                                                 break;
                                            case HSSFCell.CELL_TYPE_BLANK:
                                                 myRow.add(" ");
                                                 System.out.println("add empty:");
                                                 break;
                                       } // end switch
                                       cellCount++;
                                  } // end while                    
                                  r++;
                             }// end while
                   } myRow is the arrayList i am adding the cells of the excel file to. I have checked for blank spaces in my coding so please help with how to check for the black spaces that has been added to my arraylist.
    I have tried checking by looping through the ArrayList and then checking for null values like this
    if(myRow.get(i)!=null)
      // do something
    // i have tried this also
    if(myRow.get(i)!="")
    //do something
    }Edited by: nb123 on Feb 3, 2008 11:23 PM

    From your post I see you are using a 3rd party package to access the Excel SpreadSheets, you will have to look in your API for you 3rd party package and see if there is a method that will identify a blank row, if there is and it does not work, then you have to take that problem up with them. I know this is a pain, but it is the price we pay for 3rd party object use.
    In the mean time, you can make a workaround by checking every column in your row and seeing if it is null, or perhaps even better: check and see if the trimmed value of each cell has a lenth of 0.

  • Person or Group colum in the SharePoint list retrieves empty value for Mobile phone property

    Person or Group colum in the SharePoint list retrieves empty Mobile phone for some users although thoses users have Mobile Phone values in the User Proifles. This happens only for some users. For some users  it shows Mobile phone for
    some days and after some days it dess not show Mobile Phone though Mobile Phone entries are in the User Profiles for those users.
    Appreciate any help to fix this.
    Thanks in Advance!
    Narayana Reddy
    Narayana Reddy G

    Hi Narayana,
    According to your description, my understanding is that the person or group column retrieved an empty value for Mobile phone in SharePoint 2010.
    Please go to the hidden User Information List using
    http://<SiteCollectionUrl>/_catalogs/users/detail.aspx , check the value of Mobile phone.
    Please go to CA->Monitoring->Review job definitions, scroll to User Profile to SharePoint Full Synchronization
    and
    User Profile to SharePoint Quick Synchronization, make sure they work well.
    In addition, please take a look at :
    http://donalconlon.wordpress.com/2012/03/02/sharepoint-user-information-list-is-not-being-updated/
    I hope this helps.
    Thanks,
    Wendy
    Wendy Li
    TechNet Community Support

Maybe you are looking for

  • Unusual network issues.. some programs work fine... others not.

    I'm staying at a small hotel and was pleased to discover they had wireless Internet access so I won't have to go to the local Internet cafe to do my work. Or so I thought. I connected easily to their network and immediately went to Speedtest.net to t

  • Where does the ipad back up stored

    where does the ipad back up stored

  • RoboHelp 8: Vertical scroll bar problem

    I just installed RoboHelp 8. When I view a topic page that is longer than the window, sometimes the vertical scroll bars appear and sometimes they don't. If I click the <> HTML tab and then click the Design tab again, the scroll bar appears. The scro

  • Why is the podcasts folder empty?

    I put the most recent Nano software on last week. Since then, my Podcasts folder on my Nano has been empty. They are all still on my iPod but now they're under Music > Genres > Podcasts, which is very irritating. How can I get back to the old, sensib

  • Enable archivelog mode while datbase is open

    Hi everybody Kindly I need to ask if possible to enable archivelog mode while database in open status for oracle 11g? and if yes .. what is the statment? Thanks in advance Edited by: user11254543 on Jun 8, 2011 11:51 PM