dataset column expression

G

Gary

Hi,

I have a typed data set defined thus:

Title
Forename
Surname
FullName

FullName is a derived column with the expression:
Title + ' ' + Forename + ' ' + Surname

I have set the dataset so that Title, Forename and Surname
allow Nulls.

In some cases the Title is null, so the dataset is set to
return (Empty) in these cases.

Unfortunately this means that the expression doesn't work
for the FullName column as it equates to:
null + Forename + Surname
Therefore the final value is Null.

This seems rather odd as I would have expected the none
derived colums to be populated first and then the
expression to be evaluated on the basis of those values.
Therefore the expression should equate to:
EmptyString +Forename+Surname

I know I can get around this with IsNull, but it seems a
rather odd way of behaving.

Is this by design?

Cheers

Gary
 
K

Kevin Yu [MSFT]

Hi Gary,

Do you want to do this in the SQL command or in code? If you want to do it
in code, you can try the following if you're using C#.

FullName = (Title == DBNull.Value?string.Empty:Title) + Forename + Surname.

Does this answer your question? If anything is unclear, please feel free to
reply to the post.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."

--------------------
| Content-Class: urn:content-classes:message
| From: "Gary" <[email protected]>
| Sender: "Gary" <[email protected]>
| Subject: dataset column expression
| Date: Wed, 15 Oct 2003 01:15:17 -0700
| Lines: 37
| Message-ID: <[email protected]>
| MIME-Version: 1.0
| Content-Type: text/plain;
| charset="iso-8859-1"
| Content-Transfer-Encoding: 7bit
| X-Newsreader: Microsoft CDO for Windows 2000
| X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300
| Thread-Index: AcOS9HfGrDXghWV5TSuB7YKCNMxP8g==
| Newsgroups: microsoft.public.dotnet.framework.adonet
| Path: cpmsftngxa06.phx.gbl
| Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.framework.adonet:63683
| NNTP-Posting-Host: TK2MSFTNGXA08 10.40.1.160
| X-Tomcat-NG: microsoft.public.dotnet.framework.adonet
|
| Hi,
|
| I have a typed data set defined thus:
|
| Title
| Forename
| Surname
| FullName
|
| FullName is a derived column with the expression:
| Title + ' ' + Forename + ' ' + Surname
|
| I have set the dataset so that Title, Forename and Surname
| allow Nulls.
|
| In some cases the Title is null, so the dataset is set to
| return (Empty) in these cases.
|
| Unfortunately this means that the expression doesn't work
| for the FullName column as it equates to:
| null + Forename + Surname
| Therefore the final value is Null.
|
| This seems rather odd as I would have expected the none
| derived colums to be populated first and then the
| expression to be evaluated on the basis of those values.
| Therefore the expression should equate to:
| EmptyString +Forename+Surname
|
| I know I can get around this with IsNull, but it seems a
| rather odd way of behaving.
|
| Is this by design?
|
| Cheers
|
| Gary
|
 
G

Gary

The expression is against the column definition in the
typed dataset.

Fixing the problem is not really the issue. It's more a
case of understanding WHY the expression in FullName is
using the original value of Title (null) rather than the
empty string I have told the dataset to use for the Title
column.

It's as if the expression is being evaluated but ignoring
the rules of one of the columns the dataset is made up of.

Cheers

Gary
 
K

Kevin Yu [MSFT]

Hi Gary,

This issue seems to be quite complicated. Are you binding the dataset to a
datagrid? Actually, the data stored in the dataset has been set to
string.Empty. However, when shown on the datagrid, it shows (null) instead.
I will continue working on this issue, and will update you as soon as I get
some progress. If you need to fix it immediately, try to write some code to
identify the null value.

If anything is unclear, please feel free to reply to the post.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."

--------------------
| Content-Class: urn:content-classes:message
| From: "Gary" <[email protected]>
| Sender: "Gary" <[email protected]>
| References: <[email protected]>
<[email protected]>
| Subject: RE: dataset column expression
| Date: Wed, 15 Oct 2003 03:25:33 -0700
| Lines: 104
| Message-ID: <[email protected]>
| MIME-Version: 1.0
| Content-Type: text/plain;
| charset="iso-8859-1"
| Content-Transfer-Encoding: 7bit
| X-Newsreader: Microsoft CDO for Windows 2000
| X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300
| Thread-Index: AcOTBqpdxV/lgTt8TAGSyag43HiTBg==
| Newsgroups: microsoft.public.dotnet.framework.adonet
| Path: cpmsftngxa06.phx.gbl
| Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.framework.adonet:63690
| NNTP-Posting-Host: TK2MSFTNGXA09 10.40.1.161
| X-Tomcat-NG: microsoft.public.dotnet.framework.adonet
|
| The expression is against the column definition in the
| typed dataset.
|
| Fixing the problem is not really the issue. It's more a
| case of understanding WHY the expression in FullName is
| using the original value of Title (null) rather than the
| empty string I have told the dataset to use for the Title
| column.
|
| It's as if the expression is being evaluated but ignoring
| the rules of one of the columns the dataset is made up of.
|
| Cheers
|
| Gary
|
|
| >-----Original Message-----
| >Hi Gary,
| >
| >Do you want to do this in the SQL command or in code? If
| you want to do it
| >in code, you can try the following if you're using C#.
| >
| >FullName = (Title == DBNull.Value?string.Empty:Title) +
| Forename + Surname.
| >
| >Does this answer your question? If anything is unclear,
| please feel free to
| >reply to the post.
| >
| >Kevin Yu
| >=======
| >"This posting is provided "AS IS" with no warranties, and
| confers no
| >rights."
| >
| >--------------------
| >| Content-Class: urn:content-classes:message
| >| From: "Gary" <[email protected]>
| >| Sender: "Gary" <[email protected]>
| >| Subject: dataset column expression
| >| Date: Wed, 15 Oct 2003 01:15:17 -0700
| >| Lines: 37
| >| Message-ID: <[email protected]>
| >| MIME-Version: 1.0
| >| Content-Type: text/plain;
| >| charset="iso-8859-1"
| >| Content-Transfer-Encoding: 7bit
| >| X-Newsreader: Microsoft CDO for Windows 2000
| >| X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300
| >| Thread-Index: AcOS9HfGrDXghWV5TSuB7YKCNMxP8g==
| >| Newsgroups: microsoft.public.dotnet.framework.adonet
| >| Path: cpmsftngxa06.phx.gbl
| >| Xref: cpmsftngxa06.phx.gbl
| microsoft.public.dotnet.framework.adonet:63683
| >| NNTP-Posting-Host: TK2MSFTNGXA08 10.40.1.160
| >| X-Tomcat-NG: microsoft.public.dotnet.framework.adonet
| >|
| >| Hi,
| >|
| >| I have a typed data set defined thus:
| >|
| >| Title
| >| Forename
| >| Surname
| >| FullName
| >|
| >| FullName is a derived column with the expression:
| >| Title + ' ' + Forename + ' ' + Surname
| >|
| >| I have set the dataset so that Title, Forename and
| Surname
| >| allow Nulls.
| >|
| >| In some cases the Title is null, so the dataset is set
| to
| >| return (Empty) in these cases.
| >|
| >| Unfortunately this means that the expression doesn't
| work
| >| for the FullName column as it equates to:
| >| null + Forename + Surname
| >| Therefore the final value is Null.
| >|
| >| This seems rather odd as I would have expected the none
| >| derived colums to be populated first and then the
| >| expression to be evaluated on the basis of those values.
| >| Therefore the expression should equate to:
| >| EmptyString +Forename+Surname
| >|
| >| I know I can get around this with IsNull, but it seems
| a
| >| rather odd way of behaving.
| >|
| >| Is this by design?
| >|
| >| Cheers
| >|
| >| Gary
| >|
| >
| >.
| >
|
 
K

Kevin Yu [MSFT]

Hi Gary,

I've got some results on my research. This is a known issue in the current
version of .net framework and might be fixed in the next version.

The workaround is to add extended properties manually in the code of typed
dataset like the following:

this.columnPhone.ExtendedProperties.Add("nullValue", "_empty");

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."
--------------------
| X-Tomcat-ID: 338547628
| References: <[email protected]>
<[email protected]>
<[email protected]>
| MIME-Version: 1.0
| Content-Type: text/plain
| Content-Transfer-Encoding: 7bit
| From: (e-mail address removed) (Kevin Yu [MSFT])
| Organization: Microsoft
| Date: Thu, 16 Oct 2003 13:51:59 GMT
| Subject: RE: dataset column expression
| X-Tomcat-NG: microsoft.public.dotnet.framework.adonet
| Message-ID: <YupTvy#[email protected]>
| Newsgroups: microsoft.public.dotnet.framework.adonet
| Lines: 115
| Path: cpmsftngxa06.phx.gbl
| Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.framework.adonet:63766
| NNTP-Posting-Host: TOMCATIMPORT1 10.201.218.122
|
| Hi Gary,
|
| This issue seems to be quite complicated. Are you binding the dataset to
a
| datagrid? Actually, the data stored in the dataset has been set to
| string.Empty. However, when shown on the datagrid, it shows (null)
instead.
| I will continue working on this issue, and will update you as soon as I
get
| some progress. If you need to fix it immediately, try to write some code
to
| identify the null value.
|
| If anything is unclear, please feel free to reply to the post.
|
| Kevin Yu
| =======
| "This posting is provided "AS IS" with no warranties, and confers no
| rights."
|
| --------------------
| | Content-Class: urn:content-classes:message
| | From: "Gary" <[email protected]>
| | Sender: "Gary" <[email protected]>
| | References: <[email protected]>
| <[email protected]>
| | Subject: RE: dataset column expression
| | Date: Wed, 15 Oct 2003 03:25:33 -0700
| | Lines: 104
| | Message-ID: <[email protected]>
| | MIME-Version: 1.0
| | Content-Type: text/plain;
| | charset="iso-8859-1"
| | Content-Transfer-Encoding: 7bit
| | X-Newsreader: Microsoft CDO for Windows 2000
| | X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300
| | Thread-Index: AcOTBqpdxV/lgTt8TAGSyag43HiTBg==
| | Newsgroups: microsoft.public.dotnet.framework.adonet
| | Path: cpmsftngxa06.phx.gbl
| | Xref: cpmsftngxa06.phx.gbl
microsoft.public.dotnet.framework.adonet:63690
| | NNTP-Posting-Host: TK2MSFTNGXA09 10.40.1.161
| | X-Tomcat-NG: microsoft.public.dotnet.framework.adonet
| |
| | The expression is against the column definition in the
| | typed dataset.
| |
| | Fixing the problem is not really the issue. It's more a
| | case of understanding WHY the expression in FullName is
| | using the original value of Title (null) rather than the
| | empty string I have told the dataset to use for the Title
| | column.
| |
| | It's as if the expression is being evaluated but ignoring
| | the rules of one of the columns the dataset is made up of.
| |
| | Cheers
| |
| | Gary
| |
| |
| | >-----Original Message-----
| | >Hi Gary,
| | >
| | >Do you want to do this in the SQL command or in code? If
| | you want to do it
| | >in code, you can try the following if you're using C#.
| | >
| | >FullName = (Title == DBNull.Value?string.Empty:Title) +
| | Forename + Surname.
| | >
| | >Does this answer your question? If anything is unclear,
| | please feel free to
| | >reply to the post.
| | >
| | >Kevin Yu
| | >=======
| | >"This posting is provided "AS IS" with no warranties, and
| | confers no
| | >rights."
| | >
| | >--------------------
| | >| Content-Class: urn:content-classes:message
| | >| From: "Gary" <[email protected]>
| | >| Sender: "Gary" <[email protected]>
| | >| Subject: dataset column expression
| | >| Date: Wed, 15 Oct 2003 01:15:17 -0700
| | >| Lines: 37
| | >| Message-ID: <[email protected]>
| | >| MIME-Version: 1.0
| | >| Content-Type: text/plain;
| | >| charset="iso-8859-1"
| | >| Content-Transfer-Encoding: 7bit
| | >| X-Newsreader: Microsoft CDO for Windows 2000
| | >| X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300
| | >| Thread-Index: AcOS9HfGrDXghWV5TSuB7YKCNMxP8g==
| | >| Newsgroups: microsoft.public.dotnet.framework.adonet
| | >| Path: cpmsftngxa06.phx.gbl
| | >| Xref: cpmsftngxa06.phx.gbl
| | microsoft.public.dotnet.framework.adonet:63683
| | >| NNTP-Posting-Host: TK2MSFTNGXA08 10.40.1.160
| | >| X-Tomcat-NG: microsoft.public.dotnet.framework.adonet
| | >|
| | >| Hi,
| | >|
| | >| I have a typed data set defined thus:
| | >|
| | >| Title
| | >| Forename
| | >| Surname
| | >| FullName
| | >|
| | >| FullName is a derived column with the expression:
| | >| Title + ' ' + Forename + ' ' + Surname
| | >|
| | >| I have set the dataset so that Title, Forename and
| | Surname
| | >| allow Nulls.
| | >|
| | >| In some cases the Title is null, so the dataset is set
| | to
| | >| return (Empty) in these cases.
| | >|
| | >| Unfortunately this means that the expression doesn't
| | work
| | >| for the FullName column as it equates to:
| | >| null + Forename + Surname
| | >| Therefore the final value is Null.
| | >|
| | >| This seems rather odd as I would have expected the none
| | >| derived colums to be populated first and then the
| | >| expression to be evaluated on the basis of those values.
| | >| Therefore the expression should equate to:
| | >| EmptyString +Forename+Surname
| | >|
| | >| I know I can get around this with IsNull, but it seems
| | a
| | >| rather odd way of behaving.
| | >|
| | >| Is this by design?
| | >|
| | >| Cheers
| | >|
| | >| Gary
| | >|
| | >
| | >.
| | >
| |
|
|
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top