DataColumn.Expression Property - need other functions

R

Rui Rosa Mendes

I need a Round function, in Expression Syntax.

- Is there any not documented?
- Can I associate one?

Thanks.
Rui

(e-mail address removed)
 
M

Miha Markic

Hi Rui,

There is no Round function for expression.
You might check
DataColumn.Expression
..net help topic which lists all functions available for expressions.

You can/should compute the values yourself rather than using expressions,
which I always recommend.
It gives you full power and also it works as expected :)
 
C

Cor

Hi Miha,
It gives you full power and also it works as expected :)

Not always with the round function

More it works as described.

(I agree with your sentence)

:)))

Cor
 
R

Rui Rosa Mendes

Right,
but I would like to take advantage of column dependence calculus that
column expression gives.

Ex:

COLUMNS
col_value_a
col_percentage_y
col_value_b

EXPRESSIONS
col_value_b.Expression = "col_value_a * col_percentage_y / 100"
better
col_value_b.Expression = "round(col_value_a * col_percentage_y / 100, 2)"

REMARKS
- I change, col_value_a and automatically have col_value_b calculated.
- I have big pipeline calculation
- I want to made aggregations at run time without made query the database.
- The expressions(like Excel formulas) seem to me a valid solution for de
points I describe above. Maybe not!?

Many thanks.
 
C

Cor

Hi Rui,

The header says datacolumn.expresions
- I want to made aggregations at run time without made query the database.

????

What do you mean by this?
(What am I seeing wrong?)

Cor
 
R

Rui Rosa Mendes

You can made aggregations, if you have related datatables.
In my calculations I also have aggregations (running totals, potentialy
rounded).


See .Net framework help for DataColumn.Expression.

.....
AGGREGATES

The following aggregate types are supported:

Sum (Sum)

Avg (Average)

Min (Minimum)

Max (Maximum)

Count (Count)

StDev (Statistical standard deviation)

Var (Statistical variance).

Aggregates are usually performed along relationships. Create an aggregate
expression by using one of the functions listed above and a child table
column as detailed in PARENT/CHILD RELATION REFERENCING above. For example:

Avg(Child.Price)

.....
 
C

Cor

Rui,

You have to read those tables first from your database.
It is not a calculation using the Select.

And therefore I think there will not be a big benefit over just itterating
that datatable, I cannot imaging why that would be less effective than an
Expression property.

Cor
 
M

Miha Markic

Hi Rui,

Rui Rosa Mendes said:
You can made aggregations, if you have related datatables.
In my calculations I also have aggregations (running totals, potentialy
rounded).

Cor was thinking:
You'll have to have data *present* in dataset if you want accurate results.
All expression results are based on data present in dataset.
 
R

Rui Rosa Mendes

Of course.



Resuming and generally:



- I fill a hierarchy dataset from the database.



- Bound it to interface controls.



- Change numeric values of datatable columns.



- Use DataColumn.Expression for automatic calculations.



- Use DataColumn.Expression for aggregate totals on parent tables.



- Transferring data from this hierarchy dataset to flat dataset's for
charting and summary.



- Saving hierarchy dataset to database.
 

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