473,320 Members | 2,109 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

How to display null elements in arraylist as 0(zeros)?

24
I am preparing an application which takes information and displays it..
I used arraylist to get elements from database..

Expand|Select|Wrap|Line Numbers
  1. ArrayList<String> noD = new ArrayList<String>();
In above line noD=No. of Days..

This is how I get data
Expand|Select|Wrap|Line Numbers
  1. noD.add(rs1.getString("noD"));
using for loop i display the data as
Expand|Select|Wrap|Line Numbers
  1. noD.get(loop variable)

There are certain noD in database which has no value and it is displayed as null and others as it is....

Now I want to display these null elements as 0... how to achieve that....
May 23 '13 #1
4 1636
Shepard
24
got it....
I figured it out....
May 23 '13 #2
Nepomuk
3,112 Expert 2GB
Well done for solving the problem, Shepard. Would you care to share your solution so that others with similar problems can find it in the future?
May 23 '13 #3
Shepard
24
before displaying the output simply added an if condition which checks for null values and replaces it with 0.
I am a newbie..
It was a newbie doubt..
May 23 '13 #4
Nepomuk
3,112 Expert 2GB
It may be a newbie question, but we all start as newbies. So thanks for sharing your solution.
May 23 '13 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

12
by: AFN | last post by:
I am running the code below to generate XML from a data table. But some fields in the data table are Null for every record. Suppose field5 has a null database value. I would expect to see: ...
1
by: Kenny Mullican | last post by:
I am using complex types in order to support serialization/deserialization of floating point numbers, since floating points can't be null. I've seen how to suppress attributes that are "not...
5
by: vooose | last post by:
Consider an ArrayList that you add an object to: ArrayList list = new ArrayList(); if(myObj != null) list.Add(myObj); else throw new Exception("obj cannot be null"); Some time down the...
4
by: dennis.joseph | last post by:
Hello Everyone, I have scoured through a million messages (ok...thats a bit exaggerated) but I just cannot figure out how to display null values in a query. I have tried Nz, IIF, Count(*) but it...
7
by: Jason | last post by:
I have some XML that contains some null elements, for example: <Document> <StartDate/> <EndDate/> </Document> I would like to process the XML using the .NET serialization tools (XSD.exe). ...
7
by: ClarkePeters | last post by:
I have large text files that I read into an array, but before that I take out all the special characters such as tabs, new lines, and returns. However I'm left with all the extra spaces (sometimes...
2
by: rickl2790 | last post by:
Hi All I am putting a form together and I need to be able to hide or display elements of the form based on what is selected with a select. The form is a passenger details entry form and the...
2
by: yongw99 | last post by:
I have an arraylist which has 0 number of elements. When i cast it to a string array, what happens ? Will my string be a "null" value, or will I get a ArgumentNullException ? eg. ArrayList al...
0
by: removeps-groups | last post by:
Now I'm wondering how to display 3 elements next to each other. I came up with the following solution using float:left, but would like opinions if this is the right way to go. The idea is to...
8
by: CatchSandeepVaid | last post by:
Say i have one-to-many relationship between Product and ProductNames. So Product has a List of ProductNames. Actually we are using List for productNames.and for list, in order to maintain...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.