Hi I'm attempting to evaluate a listing of three data records returning from database.

I have to see if these values are null &lifier replace a "-" symbol.

The issue I finish up is getting a really lengthy listing of if claims, can there be a good way to get this done?

if (row count == 1)
{
    if (only firstNull)
    {
        //Replace first.label with "-"
    }
    else if (only secondNull)
    {
        //Replace second.label with "-"
    }
    else if (only thirdNull)
    {
        //Replace third.label with "-"
    }
    else if (only (firstNull && secondNull))
    {
        //Replace first.label = "-" & second.label = ""
    } 
    else if (only (secondNull && thirdNull))
    {
        //Replace second & third label = "-"
    }
    else if (only (thirdNull && firstNull))
    {
        //Replace third && first label = "-"
    }
}
else
{
    // Replace all labels with "-"
}

Whenever you access the required fields you should use the nullable operator: field ?? "-". This can yield the area title or "-" if field==null.

for instance

Object field = null;
System.Console.WriteLine(field ?? "field is null");

will output:

area is null

without tossing the best.

I do not understand how you get a lot of clauses... If your area is null, you need to change it with "-"... You've 3 fields, you need to for the most part have 3 clauses... (Note, this really is pseudocode, to fit your question)

if (row count == 1)
{
    if (firstNull)
    {
        //Replace first.label with "-"
    }
    if (secondNull)
    {
        //Replace second.label with "-"
    }
    if (thirdNull)
    {
        //Replace third.label with "-"
    }
}
else
{
    // Replace all labels with "-"
}

You don't have to handle every mixture of the three fields separate ifs...

Ideally your fields could be saved in certain type of collection (which you've overlooked), this way you'd have the ability to make a move like:

if(row count == 1)
{
    foreach(field in Fields) 
    {
        if(fieldIsNull) 
        {
            // Set corresponding label to "-"
        }
    }
}

Being an aside, should you always wish to perform a translation when reading through in the database, to ensure that if it's NULL, you would like '-', it could make sense additional in your choose clause. So, with Oracle you might have:

SELECT
    NVL(FIELD1, '-'),
    NVL(FIELD2, '-'),
    NVL(FIELD3, '-')
FROM
    SOME_TABLE

I believe for SQLServer, the same could be:

SELECT
    ISNULL(FIELD1, '-'),
    ISNULL(FIELD2, '-'),
    ISNULL(FIELD3, '-')
FROM
    SOME_TABLE

These two indicates the database came back '-' rather than NULL when the column was empty. This may obviously think that the column you are coming back is really a string type. Otherwise, you would need to carry out the appropriate conversion around the area to show it into one.

Make use of a loop to undergo each record and appearance whether or not they are null. When the record you're searching at is null, change it with "-".