在Datagrid中进行数学运算 [英] Doing math in Datagrid

查看:60
本文介绍了在Datagrid中进行数学运算的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个包含两列的数据网格.从数据库填充的TagName和值

I have a datagrid containing two columns. TagName and Value populated from a database

网格可以包含一个或多个(最多约5个)行.

The grid can contain one ore more (up to about 5) rows.

然后,我必须创建某种公式字段,用户可以在其中存储公式以计算结果.

Then i have to create some kind of formula field where the user can store a formula to compute a result.

例如:

样本1 =(ValueRow1 + ValueRow2)* ValueRow3

Sample 1 = (ValueRow1 + ValueRow2)*ValueRow3

样本2 = ValueRow1 + ValueRow2 + ValueRow3 + ValueRow4 + ValueRow5

Sample 2 = ValueRow1 + ValueRow2 +ValueRow3 +ValueRow4 + ValueRow5

示例3 = ValueRow1 ^ 2/4

Sample 3 = ValueRow1 ^2 / 4

该公式也应该存储在数据库中,而不是结果中.

The formula should also be stored in the database but not the result.

有人知道怎么做吗?

推荐答案

听起来您认为这是一种电子表格.

Sounds you think it is a kind of spreadsheet. 

不是,电子表格包含可以包含所有内容的单元格.

It is not, a spreadsheet contains cells which can have all kind of things. 

数据网格只是由行和列组成的矩阵.

A datagrid is just a matrix made from rows and columns. 

单元格始终是一种值类型(尽管也可以是图像),并且与该列中的所有其他值相同. 

The cells are always a kind of value type (although that can be also an image) and all the same as all others in the column. 


这篇关于在Datagrid中进行数学运算的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆