Managing Null Values in a string

Dear all,
I have an employee view with these columns ( EmpNo , FirstName, SecondNane, ThirdName, FamilyName )
now when i bring the full name am writing the following :
ViewObject vo = ...
Row vor=vo.next();
fullName = (String) vor.getAttribute("FirstName") +" " +
(String) vor.getAttribute("SecondNane")
+" " +(String) vor.getAttribute("ThirdName") +
" " +(String) vor.getAttribute("FamilyName ") ;
now at run time the fullName would be like this if the SecondName is Null --> Lama Null Sam Aj
I know i can write if statements to fix this, but is there any easier way to do this ( as in nvl( ) in oracle developer )
thank in advance

Java doesn't have a direct equivalent, no.
However, if you ask Google (NVL for Java) you get goodies like [url http://bytes.com/topic/java/answers/15773-nvl-isnull-equivilent-java-null-handling]this
John

Similar Messages

  • Using Convert to handle NULL values for empty Strings ""

    After having had the problem with null values not being returned as nulls and reading some suggestion solution I added a converter to my application.
      <converter>
        <converter-id>NullStringConverter</converter-id>
        <converter-for-class>java.lang.String</converter-for-class>
        <converter-class>com.j2anywhere.addressbookserver.web.NullStringConverter</converter-class>
      </converter>
    ...I then implemented it as follows:
      public String getAsString(FacesContext context, UIComponent component, Object object)
        System.out.println("Converting to String : "+object);
        if (object == null)
          System.out.println("READING null");
          return "NULL";
        else
          if (((String)object).equals(""))
            System.out.println("READING null (Second Check)");
            return null;       
          else
            return object.toString();
      public Object getAsObject(FacesContext context, UIComponent component, String value)
        System.out.println("Converting to Object: "+value+"-"+value.trim().length());
        if (value.trim().length()==0 || value.equals("NULL"))
          System.out.println("WRITING null");
          return null;
        else
          return value.toUpperCase();
    ...I can see that it is converting my values, however the object to which the inputText fields are bound are still set to empty strings ""
    <h:inputText size="50" value="#{addressBookController.contactDetails.information}" converter="NullStringConverter"/>Also when reading the object values any nulls are already converted to empty strings before ariving at the converter. It seems that there is a default converter handling string values.
    How can I resolve this problem as set nulls when the input value is an empty string other then checking every string in my class individually. I would really hate to pollute my object model with empty string tests.
    Thanks in advance
    Edited by: j2anywhere.com on Oct 19, 2008 9:06 AM

    I changed my converter as suggested :
      public Object getAsObject(FacesContext context, UIComponent component, String value)
        if (value == null || value.trim().length() == 0)
          if (component instanceof EditableValueHolder)
            System.out.println("SUBMITTED VALUE SET TO NULL");
            ((EditableValueHolder) component).setSubmittedValue(null);
          else
            System.out.println("COMPONENT :"+component.getClass().getName());
          System.out.println("Converting to Object: " + value + "< to " + null);
          return null;
        System.out.println("Converting to Object: " + value + "< to " + value);
        return value;
      }which produces the following output :
    SUBMITTED VALUE SET TO NULL
    Converting to Object: < to null
    Info : The INFO line however comes from my controller object where I print out the set value :
    package com.simple;
    import java.util.ArrayList;
    import java.util.List;
    public class Controller
      private String information;
      /** Creates a new instance of Controller */
      public Controller()
        System.out.println("Createing Controller");
        information = "Constructed";
      public String process()
        System.out.println("Info : "+getInformation());
        return "processed";
      public String reset()
        setInformation("Re-Constructed");
        System.out.println("Info : "+getInformation());
        return "processed";
      public String setNull()
        setInformation(null);
        System.out.println("Info : "+getInformation());
        return "processed";
      public String getInformation()
        return information;
      public void setInformation(String information)
        this.information = information;
    }I also changes my JSP / JSF page a little. Here is the updated version
    <%@page contentType="text/html"%>
    <%@page pageEncoding="UTF-8"%>
    <%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
    <%@taglib prefix="f" uri="http://java.sun.com/jsf/core"%>
    <%@taglib prefix="h" uri="http://java.sun.com/jsf/html"%>
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">
    <%--
        This file is an entry point for JavaServer Faces application.
    --%>
    <html>
      <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>JSP Page</title>
      </head>
      <body>
        <f:view>
          <h:form>
            <h:inputText id="value" value="#{Controller.information}"/>
            <hr/>
            <h:commandLink action="#{Controller.process}">
              <h:outputText id="clicker" value="Process"/>
            </h:commandLink>             
            <hr/>
            <h:commandLink action="#{Controller.reset}">
              <h:outputText id="reset" value="Reset"/>
            </h:commandLink>             
            <hr/>
            <h:commandLink action="#{Controller.setNull}">
              <h:outputText id="setNull" value="Set Null"/>
            </h:commandLink>             
          </h:form>
        </f:view>
      </body>
    </html>The converter is declared for the String class in the faces configuration file. From the log message is appears to be invoked, however the object is not set to null.
    I tested this with JSF 1.2_04-b20-p03 as well as 1.2_09-b02-FCS.
    any other suggestions what could be causing this.

  • Removing Null values from character string

    Hi All,
    Can i remove NULL values (hexadecimal - 0000) from character string. I am uploading a file from presentation layer (shared server) and getting NULL values in many fields which i want to remove.
    please assist.
    Thanks for you help..
    Regards,
    Mohaiyuddin

    Hi,
    Most likely, nobody needed it, but if anybody in future will need the solution for related problem  - here's solution:
    data: lv_nullchar type xstring value '0'.
    shift lv_xstring right deleting trailing lv_nullchar in byte mode.
    shift lv_xstring left deleting leading lv_nullchar in byte mode.
    This hack deleting null chars in lv_xstring at end file and at begining of file. Works perfect for me, where i also worked with files.

  • Doubt about  a null value assigned to a String variable

    Hi,
    I have a doubt about a behavior when assigning a null value to a string variable and then seeing the output, the code is the next one:
    public static void main(String[] args) {
            String total = null;
            System.out.println(total);
            total = total+"one";
            System.out.println(total);
    }the doubt comes when i see the output, the output i get is this:
    null
    nulloneA variable with null value means it does not contains a reference to an object in memory, so the question is why the null is printed when i concatenate the total variable which has a null value with the string "one".
    Is the null value converted to string ??
    Please clarify
    Regards and thanks!
    Carlos

    null is a keyword to inform compiler that the reference contain nothingNo. 'null' is not a keyword, it is a literal. Beyond that the compiler doesn't care. It has a runtime value as well.
    total contains null value means it does not have memory,No, it means it refers to nothing, as opposed to referring to an object.
    for representation purpose it contain "null"No. println(String) has special behaviour if the argument is null. This is documented and has already been described above. Your handwaving about 'for representation purpose' is meaningless. The compiler and the JVM don't know the purpose of the code.
    e.g. this keyword shows a hash value instead of memory addressNo it doesn't: it depends entirely on the actual class of the object referred to by 'this', and specifically what its toString() method does.
    similarly "total" maps null as a literal.Completely meaningless. "total" doesn't 'map' anything, it is just a literal. The behaviour you describe is a property of the string concatenation operator, not of string literals.
    I hope you can understand this.Nobody could understand it. It is compete nonsense. The correct answer has already been given. Please read the thread before you contribute.

  • JDBC Receiver Adapter with Null Value

    HI,
    I have configured ID for JDBC Receiver. In my communication channel, I already check Integration of Empty String Values = Null Value. However, when I check the result from audit log, it still shows that SAP XI sends the null value to database. In my understanding, it should not send the field which has null value (It shouldn't be included in sql statement).
    I check this with other scenario. With the same check at Integration of Empty String Values = Null Value, it doesn't send null value to database. It happens only with my first scenario.
    Have anyone ever been through this before? Any suggestion please?
    Thanks,
    Pavin

    Hi,
    1. The occurrence is 0...1
    2. This is the first result with null value (Please see field Error)
    UPDATE EXPCRM_T_CustomerProfile SET RequestID=455, RecordNo=1, SAPCustomerCode=0001000344, Error=NULL, Status=2, UpdateDateTime=12/03/2008 13:45:03 WHERE (RequestID=455 AND RecordNo=1)
    Then, I change the option from Null Value to Empty string. This is the result.
    UPDATE EXPCRM_T_CustomerProfile SET RequestID=455, RecordNo=1, SAPCustomerCode=0001000344, Error=', Status=2, UpdateDateTime=12/03/2008 13:46:12 WHERE (RequestID=455 AND RecordNo=1)
    Field Error Change from NULL to '
    The expected result from me is that field Error should not exist at all. Please help.
    Thanks,
    Pavin

  • JDBC Querying Null Values

    I'm using the JDBC Query Multiple Rows as XML to query an Oracle database. Many of the fields I'm querying are nullable and in fact some contain null values. I can't figure out why the JDBC component queries a null value as the string "null". I've tried to work with nvl() or replace() in my SQL statement, but I haven't got either of them to work.
    I would assume someone else has run into this. Anyone have any advice on how to get around this?

    I just found a solution that worked for my situation.
    On the form being merged with the xml data, select the field(s) you want to hide the null value for.
    Then go into the 'Field' tab in the 'Object' palette, click on the patterns button.
    In the Data tab click 'Allow empty' and in the text box below it type
    null
    This should hide any null values from being displayed as 'null' on the form. This also works for numeric fields and date/time fields.

  • Distinguishing between empty string and null values

    hi all,
    I am using an ODBC connection to connect my java app to database using JDBCODBC driver. I have 2 columns 'aColumn' and 'bColumn' in my table, both allow null values. I have one row in it, which has null value in aColumn and empty string in bColumn. I retrieve this row's data and assign it to 2 columns : 'aColumnVar' and 'bColumnVar' respectively. I find out that both 'aColumnVar' and 'bColumnVar' variables has null values (although bColumnVar should has an empty string as its value). Now my ODBC connection Data Source has the option "Use ANSI nulls, paddings, and warnings" ON. I turn it off and try again. This time both 'aColumnVar' and 'bColumnVar' variables has empty string as values (although aColumnVar should has null as its value).
    How can I make sure that i can get the data exactly as it is in the database in my variables?
    Thanks

    there is a wasNull() method on ResultSet. After you
    have obtained the value of a column e.g. by calling a
    method like getString you can call wasNull and if it
    returns true then the value on the database is null.
    Check the java docs, it might explain it better
    http://java.sun.com/j2se/1.4.1/docs/api/java/sql/Result
    et.html#wasNull()I am using MS SQL Server 7.0 under Windows NT 4.0 with JDK 1.2. My ODBC connection Data Source has to have the option "Use ANSI nulls, paddings, and warnings" ON.
    I try the wasNull() method but it is doing the same thing i.e. telling me that a column is null when in database it is null (right); and a column is null when in database it is an empty string (wrong). I suspect it is something to do with the JDBC-ODBC driver I am using.

  • Remove null values from string array

    Hi ,
    I have a string array in a jsp page which I save some values inside. After I store the values I want to print only those who are not null. How can I do this? Is there a way to delete the null values?

    Thank you but because I am new in programming what do you mean to use continue. Can you explain it a little bit further?<%
    //go through the array to check all the values
    for(int i=0; i<array.length();i++) {
    //If array is null, nothing happen
    if(array==null){
    //leave here blank; instead use continue like:
    //this will skip the statements next to it, and increments the value of i in for loop and continues to execute the body of for loop.
    //The same will be repeated till the last iteration.
    continue;
    //If array not null, then print value in a new line
    else{
    out.print(array+"<br>"); //don't change the logic here
    %>

  • Report is showing "null" string for null values.

    hi ,
    I am new to BI Publisher and creating a report in BI Publisher. In the result set for null values, report is printing as "null". I checked the query , it gives blank (empty value) data for null values. But in report it is coming as "null" value (string "null"). I require to show the report as blank data for null values. Can you please help me to find solution for this ?.
    Thank you very much in advance.
    Regards
    Gayathri.

    it shouldnt happen like that
    try these
    <?xdoxslt:ifelse(ADDRESS3!='',ADDRESS3,'')?>
    or
    <?xdoxslt:ifelse(ADDRESS3!='null',ADDRESS3,'')?>
    if those didnt work send me your template and xml to my email i can try that at my side .
    Email [email protected]

  • Getting null value while parsing "XML String" with  encoding WINDOWS-1252.

    Hi,
    when I am converting the Follwoing "xml string " to Document, I am getting the "null" as a document value.
        String strXML =  "<?xml version="1.0" encoding="WINDOWS-1252"?>
                              <category name="SearchByAttributes" value="Search By Attributes">
                                <item name="ORDER_LINE_ID" description="Application Search Attributes" >
                                   <attribute name="Sequence" value="0001"/>
                                 </item>
                                </category>"      
    My "xml string" has the encoding vaule: WINDOWS-1252.
    I am using the following code to convert the "xml string" to Document. I am getting the Document values as a "null" while converting the above "string xml"
            String strXML = //my above string xml.
            DocumentBuilderFactory docBuilderFactory = DocumentBuilderFactory.newInstance();
            docBuilderFactory.setIgnoringElementContentWhitespace(true);
            docBuilder = docBuilderFactory.newDocumentBuilder();
            doc = docBuilder.parse(new InputSource(new StringReader(strXML)));              
            System.out.println("doc value.."+doc)//I am getting null value for "doc".
    Can anyone help me to resolve the issue.

    Thagelapally wrote:
    I am coverting the below "XML string" to Document, once it is converted I am reading that Document,which have an "attribue" Element in.
      String strXML = "<?xml version="1.0" encoding="WINDOWS-1252"?>
    <category name="SearchByAttributes" value="Search By Attributes">
    <item name="ORDER_LINE_ID" description="Application Search Attributes" >
    <attribute name="Sequence" value="0001"/>
    </item>
    </category>" I am using the above code to read the Document. When run the code in "OC4J Server" and using Jdeveloper as an editor,I am able to perfectly read the "attribute" element in the document with out any problem.Println statement printing as I expected.
    System.out.println("Element Name..."+listOfAtt.getNodeName());
    //getting Element Name as...."attribute"(as expected)
    System.out.println("Element Attibrute list....."+elementAtt);
    //getting Element Attribute list as an...."oracle.xml.parser.v2.XMLAttrList@afe"But when run the same code(reading the same Document) in Tomcat and Eclipse,println satatement not printing as i expected.
    System.out.println("Element Name..."+listOfAtt.getNodeName());
    //getting Element Name as...."#text"(I am expecting output value "attribute" but it is printing "#text" which i don't know)
    System.out.println("Element Attibrute list....."+elementAtt);
    //getting Element Attribute list as an...."null"(I am expecting output value object reference but it is printing "null"
    (without the rest of the code, i'm guessing that) most likely you are grabbing the first child node of the item element. however, you are not accounting for some text nodes that are most likely in that list, like the whitespace between the item element and the attribute element. please go read some tutorials on xml, there are thousands of them out there, and they will answer all you initial questions much more efficiently than posting each step to the forums.

  • Problem when passing string array in sessions showing null value

    i am trying to pass a string array but it is showing me the null value
    i think the the problem is seem to be in session.settAttribute("subject['"+i+"']",subject) in 2.login_action.jsp
    or in String sub1=(String) session.getAttribute("subject[0]"); in 3.user_home.jsp
    i have following three pages
    1.login.html
    2.login_action.jsp
    3.user_home.html
    1.login.html
    <html>
    <body>
    <form method="post" action="login_action.jsp">
    Username<input type="text" name="username"></input>
    <br>
    Password<input type="password" name="password"></input>
    <input type="submit" value="login"></input>
    </form>
    </body>
    </html>
    2.login_action.jsp
    <%@ page contentType="text/html"%>
    <%@ page import="java.sql.*" %>
    <%!
    String user,pwd;
    String subject[]=new String[10];
    int i,totalsubject;
    %>
    <%
    try
    user=request.getParameter("username");
    pwd=request.getParameter("password");
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    Connection con = DriverManager.getConnection("jdbc:odbc:ods","scott","tiger");
    PreparedStatement ps = con.prepareStatement("select password from users where username='"+user+"'");
    ResultSet rs = ps.executeQuery();
    if(rs.next())
    if(rs.getString("password").equals(pwd))
    session.setAttribute("username",user);
    PreparedStatement ps2 = con.prepareStatement("select subject_id from allot_teachers where staff_id='"+user+"'");
                        ResultSet rs2 = ps2.executeQuery();          
                             while(rs2.next())
                             i=0;
                             subject[i]=rs2.getString(1);
    // if i display here the subjects in out.println(subject[i]) it is working fine
    // but in next redirected page it is showing null
                             session.setAttribute("subject['"+i+"']",subject[i]);
                             //out.println(subject[i]);
                             i++;
    response.sendRedirect("user_home.jsp");
    else
    out.println("error invalid username or password");
    else
    out.println("error invalid username or password");
    con.close();
    catch(Exception e)
    out.println(e);
    %>
    3. user_home.jsp
    <%@ page contentType="text/html"%>
    <%@ page import="java.sql.*" %>
    <html>
    <%
    String user,pwd,cat,cat1;
    String username=(String) session.getAttribute("username");
    if(username==null)
    response.sendRedirect("login.html");
    //just tried for first two subjects
    String sub1=(String) session.getAttribute("subject[0]");
    String sub2=(String) session.getAttribute("subject[1]");
    //here it is printing null
    out.println(sub1);
    //here it is printing null
    out.println(sub2);
    %>
    <form method="post" action="logout.jsp">
    <input type="submit" value="Logout"></input>
    </form>
    </html>
    Cheers & Regards
    sweety

    The name in getAttributre doesnt match the name in setAttribute.
    Note "subject[0]" is a string containing 10 chars, "subject" is a string containing 7 chars.
    Here is your code:
    session.setAttribute("subject",subject);
    String sub1=(String) session.getAttribute("subject[0]");

  • Exchange Edge clone config import in Exchange Management shell throws error "You cannot call a method on a null-valued expression"

    Hi All,
    During the Coexistence of Exchange 2007 to 2010 Migration..
    I have create new Edge Scubscription in Edge Server 1 and Export the Edge Configuration File from Edge Server 1.
    While trying to Import Edge configuration to Edge Server 2 in Exchange Management Shell, I am getting the below Error.
    I have tried importing on both Exchange 2007 and 2010 Edge Servers, getting the same error.
    "Importing Edge configuration information Failed.
    Reason: You cannot call a method on a null-valued expression."
    Please help in resolving this issue...

    Also found the CloneLogFile as below : I masked my domain name as xxx for security reason..
    Get-TransportServer -Identity:xxx | Set-TransportServer -AntispamAgentsEnabled:$true -ConnectivityLogEnabled:$false -ConnectivityLogMaxAge '30.00:00:00' -ConnectivityLogMaxDirectorySize '250MB' -ConnectivityLogMaxFileSize '10MB' -ConnectivityLogPath 'C:\Program
    Files\Microsoft\Exchange Server\TransportRoles\Logs\Connectivity' -DelayNotificationTimeout '04:00:00' -ExternalDelayDsnEnabled:$true -ExternalDNSAdapterEnabled:$true -ExternalDNSAdapterGuid '00000000-0000-0000-0000-000000000000' -ExternalDNSProtocolOption
    'Any' -ExternalDNSServers:$null -ExternalIPAddress:$null -ExternalDsnDefaultLanguage 'en-US' -ExternalDsnLanguageDetectionEnabled:$true -ExternalDsnMaxMessageAttachSize '10MB' -ExternalDsnSendHtml:$true -InternalDelayDsnEnabled:$true -InternalDNSAdapterEnabled:$true
    -InternalDNSAdapterGuid '00000000-0000-0000-0000-000000000000' -InternalDNSProtocolOption 'Any' -InternalDNSServers:$null -InternalDsnDefaultLanguage 'en-US' -InternalDsnLanguageDetectionEnabled:$true -InternalDsnMaxMessageAttachSize '10MB' -InternalDsnSendHtml:$true
    -MaxConcurrentMailboxDeliveries '7' -MaxConcurrentMailboxSubmissions '20' -MaxConnectionRatePerMinute '1200' -MaxOutboundConnections '1000' -MaxPerDomainOutboundConnections '20' -MessageExpirationTimeout '2.00:00:00' -MessageRetryInterval '00:01:00' -MessageTrackingLogEnabled:$true
    -MessageTrackingLogMaxAge '30.00:00:00' -MessageTrackingLogMaxDirectorySize '1GB' -MessageTrackingLogMaxFileSize '10MB' -MessageTrackingLogPath 'C:\Program Files\Microsoft\Exchange Server\TransportRoles\Logs\MessageTracking' -MessageTrackingLogSubjectLoggingEnabled:$true
    -OutboundConnectionFailureRetryInterval '00:30:00' -IntraOrgConnectorProtocolLoggingLevel 'None' -PickupDirectoryMaxHeaderSize '64KB' -PickupDirectoryMaxMessagesPerMinute '100' -PickupDirectoryMaxRecipientsPerMessage '100' -PickupDirectoryPath 'C:\Program
    Files\Microsoft\Exchange Server\TransportRoles\Pickup' -PipelineTracingEnabled:$false -ContentConversionTracingEnabled:$false -PipelineTracingPath 'C:\Program Files\Microsoft\Exchange Server\TransportRoles\Logs\PipelineTracing' -PipelineTracingSenderAddress:$null
    -PoisonMessageDetectionEnabled:$true -PoisonThreshold '2' -QueueMaxIdleTime '00:03:00' -ReceiveProtocolLogMaxAge '30.00:00:00' -ReceiveProtocolLogMaxDirectorySize '250MB' -ReceiveProtocolLogMaxFileSize '10MB' -ReceiveProtocolLogPath 'C:\Program Files\Microsoft\Exchange
    Server\TransportRoles\Logs\ProtocolLog\SmtpReceive' -RecipientValidationCacheEnabled:$true -ReplayDirectoryPath 'C:\Program Files\Microsoft\Exchange Server\TransportRoles\Replay' -RoutingTableLogMaxAge '7.00:00:00' -RoutingTableLogMaxDirectorySize '50MB' -RoutingTableLogPath
    'C:\Program Files\Microsoft\Exchange Server\TransportRoles\Logs\Routing' -SendProtocolLogMaxAge '30.00:00:00' -SendProtocolLogMaxDirectorySize '250MB' -SendProtocolLogMaxFileSize '10MB' -SendProtocolLogPath 'C:\Program Files\Microsoft\Exchange Server\TransportRoles\Logs\ProtocolLog\SmtpSend'
    -TransientFailureRetryCount '6' -TransientFailureRetryInterval '00:10:00'
    New-AcceptedDomain -DomainName 'xxx' -DomainType 'Authoritative' -Name 'xxx'
    Set-AcceptedDomain -DomainType 'Authoritative' -AddressBookEnabled:$true -Name 'xxx'
    Importing Edge configuration information Failed.
    Reason: You cannot call a method on a null-valued expression.

  • How can I manage byte size of a string value in java?

    Hi,
    How can I manage byte size of a string value in java? I have NAME column in my database table, of type VARCHAR2(128). Supports multilingual, so value in Name can be English, French or Dutch.. like that. Byte size of English character is 1 and that of French is 2 and varies.. . Because of this reason I find difficulty in insert query. Please suggest solution.

    But the event does not really have a size - you can export the photos and make the size pretty much what you want - while it is in iPhoto it is an event
    I guess that iPhoto could report the size of the original photos as imported - or the size of the modified photos if exported as JPEGs - or the size of the modified photos if exported with a maximum dimension of 1080 - but the event simply is photos and does not have a "size" until you export it
    Obviously you want to know the size but the question was
    what is your puprose for knowing the size?
    WIth that information maybe there is a way to get you what you want
    But the basic answer is simply that an event does not have a size - an event is a collection of photos and each photo has either two or three versions in the iPhoto library and each photo can be exported for outside use in several formats and at any size
    LN

  • Null Values from a Data Source

    This is more of an implementation question than a
    troubleshooting question. Also, since I've been unable to find any
    documentation on this I was wondering if anyone has come across
    this behavior or found a bug with it.
    Yesterday I was working on an application to explore some
    proof of concept aspects of Flex for an application I'm developing.
    I started running into a problem with Flex Data Services throwing
    back an 'Unknown Property: "clientaddress1"' error whenever I tried
    to update data. It seemed that whenever I tried to update a record
    in the database it would thrown the Unknown Property error. I spent
    a good chunk of the day trying to figure out what was causing this
    and finally gave up and called it a day.
    This morning I was reassessing what the problem was and
    trying to find the differences between my database and my code and
    I stumbled upon the fact that I could add no records and modify
    them without a problem, however if I tried to access an existing
    record and update it I'd get the Unknown Property error.
    I start analyzing the database and found that I'd configured
    the database to use null values for empty values and the records
    that I created with the database had null values, however, any of
    the values inserted from Flex were inserted as blank values. As
    matching my action script class as clientaddress1 = ""; So, upon
    further testing I fould that Flex was not processing the null
    values correctly, so that when it came back and rightly generated a
    Conflict Error...and then called AcceptServer() it was unable to
    find the clientaddress1 property of the class.
    Also, if any of the properties in the database are null it
    throws the same error. Basically it seems to have invalidated the
    object just because one value was null. So if all of my values from
    the DB are set to something and only one field is set to null it's
    still throwing the error on the first alphabetical item of the
    properties.
    I can resolve the problem by not using null values in the
    database, but...what sort of effect would this have on someone
    working with a large legacy database that extensively uses nulls
    for undefined values?
    Also, if a Flex guru could explain the reasoning for this
    happening I would greatly appreciate it!
    Best regards,
    Chris Maloney

    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()
    }

  • Setting null values vs Default or initial values in the Database?

    i am working on a system and i have set any field that might optional as Allow Null,, but this is causing me a lot of troubles especially when i am querying the data or perfoming some calculations from the database. So is it valid if i changed all the Allow null field to have initial values an restricting null values to be inserted into them, so example, to set the initial values for an integer to be 0 and string to be empty?

    Hi,
    You can implement business logic on db side or on app side.
    Advantage and disadvantage of implementation business logic on DB side.
    Advantages:
    1.Don't require app server software version changes/compilations (Java, C, C++, C#...)
    2.Stored procedures are stored directly in the db.
    3.DBA can manage and optimize the stored procedures in flexible way; it'll be transparent for app server because the same remaining interface.
    4.Avoidance of network traffic - the stored procedures can run directly within DB engine.
    5.Encapsulation of business logic as API in the database.
    6.Reports can be implemented like PL/SQL functions that return table data type. The functions can be called from application side - sort of API.
    Disadvantages:
    1.DB vendor specific, but when dealing with the same databases (for example Oracle) it's not relevant.
    2.Require DB skills to write the procedures correctly: it will require time for a pure java/c/c++/c# programmer to understand the DB code and to write it in optimal (from db point of view) way.
    3.If it's too complex business logic - the db side implementation can become too complex.
    To overcome issue with null(s) please use NVL function.
    Example:
    drop table  TEST_TABLE;
    create table TEST_TABLE(parameter varchar2(20), val number(10, 2));
    insert into TEST_TABLE values ('A', 23.245);
    insert into TEST_TABLE values ('B', null);
    insert into TEST_TABLE values ('C', 123);
    insert into TEST_TABLE values ('D', null);
    select avg(nvl(val, 0)) from TEST_TABLE;Hope this will help.
    Best Regards,
    http://dba-star.blogspot.com/

Maybe you are looking for

  • Best way to read data sources in parallel

    Hi, I'm looking for conceptual help as I start a project. I am trying to figure out the best way to get data from several sources at different timings and deliver them to a main vi. I have 4 systems, which each work well on their own (OK, one doesn't

  • Funky axis dragging in CS3?

    I am finding a weird bit of behaviour in Flash CS3. When authoring, if I hold down 'shift' in order to drag a movieclip on the stage along a single axis, the clip doesn't follow the initial axis, as it did in previous versions. Instead, it inevitably

  • How to execute vb module in java

    i'm developing a application in java in which i need to run the vb module plz reply me as soon as possible.

  • Search Google with Firefox instead of Safari from Mail.app

    Is there a way to have Mail use Firefox when searching a term via Google from within Mail instead of Safari? My default browser is Firefox but mail launches Safari instead. (See image for clarification) http://skitch.com/gagegecko/ngepy/fullscreen-2

  • Layer styles gone rogue?

    (P-shop CS5, Mac OS 10.6.8) I have a doc with several layers. I have layer style "Bevel & Emboss" applied to an element on one layer. But, when I apply layer style "Inner Shadow" to an element on another layer, it messes with the layer style settings