DataColumn.Expression

  • Thread starter Christopher Dedels
  • Start date
C

Christopher Dedels

How canI get the DataColumn.Expression property handle trigonometric
functions?

For example:
I have a DataTable with 1 columns named "x". I want to add a column that
shows sin(x).

dataset.Tables["trigsample"].Columns.Add("sinx", typeof(double));
dataset.Tables["trigsample"].Columns["sinx"].Expression = "sin(x)";

Any help or ideas you may have are appreciated.

Thanks,

Chris
 
W

William Ryan eMVP

Hi Chris:

Sin isn't supported by the Expression Syntax. You can do quite a bit and
can probably do it yourself using the available expression
http://msdn.microsoft.com/library/d...fSystemDataDataColumnClassExpressionTopic.asp
but in this instance, you may want to do it on the Sever side or manually
calculate it and add it to the row programatically. Normally this isn't a
good idea b/c expressions automatically update themselves when any of their
source column data changes, but while the Expression values available are
pretty accomodating, they aren't unlimited.

HTH,

Bill
 
C

Christopher Dedels

Bill,

Thanks for the response. I was hoping to be able to get the automatic
recalculation if the source data changed. I had a feeling this was not
possible. Too bad.

Chris

William Ryan eMVP said:
Hi Chris:

Sin isn't supported by the Expression Syntax. You can do quite a bit and
can probably do it yourself using the available expression
http://msdn.microsoft.com/library/d...fSystemDataDataColumnClassExpressionTopic.asp
but in this instance, you may want to do it on the Sever side or manually
calculate it and add it to the row programatically. Normally this isn't a
good idea b/c expressions automatically update themselves when any of their
source column data changes, but while the Expression values available are
pretty accomodating, they aren't unlimited.

HTH,

Bill
Christopher Dedels said:
How canI get the DataColumn.Expression property handle trigonometric
functions?

For example:
I have a DataTable with 1 columns named "x". I want to add a column that
shows sin(x).

dataset.Tables["trigsample"].Columns.Add("sinx", typeof(double));
dataset.Tables["trigsample"].Columns["sinx"].Expression = "sin(x)";

Any help or ideas you may have are appreciated.

Thanks,

Chris
 
W

William Ryan eMVP

It's still 'possible' it's just not possible using the standard methodology.
If you don't minding doing some slightly high level footwork events , it'll
be 'automatic' to the user. If you are interested, let me know and we'll
get cracking on it.

Bill

www.devbuzz.com
www.knowdotnet.com

Christopher Dedels said:
Bill,

Thanks for the response. I was hoping to be able to get the automatic
recalculation if the source data changed. I had a feeling this was not
possible. Too bad.

Chris

William Ryan eMVP said:
Hi Chris:

Sin isn't supported by the Expression Syntax. You can do quite a bit and
can probably do it yourself using the available expression
http://msdn.microsoft.com/library/d...fSystemDataDataColumnClassExpressionTopic.asp
but in this instance, you may want to do it on the Sever side or manually
calculate it and add it to the row programatically. Normally this isn't a
good idea b/c expressions automatically update themselves when any of their
source column data changes, but while the Expression values available are
pretty accomodating, they aren't unlimited.

HTH,

Bill
Christopher Dedels said:
How canI get the DataColumn.Expression property handle trigonometric
functions?

For example:
I have a DataTable with 1 columns named "x". I want to add a column that
shows sin(x).

dataset.Tables["trigsample"].Columns.Add("sinx", typeof(double));
dataset.Tables["trigsample"].Columns["sinx"].Expression = "sin(x)";

Any help or ideas you may have are appreciated.

Thanks,

Chris
 
C

Christopher Dedels

Bill,

Im interested in any suggestions that you may have to solve this problem.
Sounds like fun.

Thanks,

Chris


William Ryan eMVP said:
It's still 'possible' it's just not possible using the standard methodology.
If you don't minding doing some slightly high level footwork events , it'll
be 'automatic' to the user. If you are interested, let me know and we'll
get cracking on it.

Bill

www.devbuzz.com
www.knowdotnet.com

Christopher Dedels said:
Bill,

Thanks for the response. I was hoping to be able to get the automatic
recalculation if the source data changed. I had a feeling this was not
possible. Too bad.

Chris
http://msdn.microsoft.com/library/d...fSystemDataDataColumnClassExpressionTopic.asp isn't
a
good idea b/c expressions automatically update themselves when any of their
source column data changes, but while the Expression values available are
pretty accomodating, they aren't unlimited.

HTH,

Bill
How canI get the DataColumn.Expression property handle trigonometric
functions?

For example:
I have a DataTable with 1 columns named "x". I want to add a column that
shows sin(x).

dataset.Tables["trigsample"].Columns.Add("sinx", typeof(double));
dataset.Tables["trigsample"].Columns["sinx"].Expression = "sin(x)";

Any help or ideas you may have are appreciated.

Thanks,

Chris
 

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