function:
calculates the given expression on the current line that is used to pass the filter condition.
format:
Object Compute (String expression,string filter)
Parameters:
expression: The expressions to evaluate. The expression parameter requires an aggregate function.
Filter : Filters to limit the rows that are evaluated in an expression. such as: "menu_id=5"//indicates that the line of menu_id is 5
return Value:
as the object type, the result is calculated.
expression says:
One purpose of the Expression property is to create computed columns. The second purpose is to create an aggregate column. Similar to calculated values, aggregations perform operations based on the entire rowset in the DataTable.
expression Syntax
when creating an expression, use the ColumnName property (the name of the column in the table) to refer to the columns in the table.
Usage:
Get the maximum value of the order column in the Menu1 Table object s = dsset.tables["menu1"]. Compute ("Max (Order)", "");
The above is a purely developed code, with a focus on understanding the use of methods, used in our measurement development platform:
Dim dt= Mesh Part 1.datatable.compute ("Sum (planted area)", "Parcel number = '" &dr["plot number"]& "'")
Second, create expression to say:
2.1. When creating an expression for a filter, enclose the string in single quotation marks:
"LastName = ' Jones '"
2.1.1 Special characters:
The following characters are special characters, as explained below, if they are used in column names, they must be escaped.
650) this.width=650; "src=" Http://s4.51cto.com/wyfs02/M00/7F/AA/wKioL1coaFKAIikFAABmQrabZGI862.jpg "title=" Psb.jpg "alt=" Wkiol1coafkaiikfaabmqrabzgi862.jpg "/>
2.1.2 The method of transformation:
If the column name contains one of the characters above, the name must be enclosed in brackets. For example, to use a column named "column#" in an expression, write "[column#]":
Total * [column#]
Because the brackets are special characters, if it is part of a column name, you must use a slash ("" ") to escape the brackets. For example, a column named "column[]" should be written as:
Total * [column[]] (only the second bracket must be escaped.) )
2.2, user-defined value handling
2.2.1 can be used in an expression that will be compared to the column value. The value of the string should be enclosed in single quotation marks. The date value should be placed within the pound sign (#). For numeric values, decimals and scientific notation are allowed. For example:
"FirstName = ' John '" "" Price <= 50.00 "" Birthdate < #1/31/82# "
2.2.2 A column with an enumeration value and casts the value to an integer data type. For example:
"Enumcolumn = 5"
2.3, operator
2.3.1 allows concatenation when using the Boolean and, or, and not operators. You can use parentheses to combine clauses and enforce precedence. The AND operator takes precedence over other operators. For example:
(LastName = ' Smith ' OR LastName = ' Jones ') and FirstName = ' John '
2.3.2 allows the following operators to be used when creating comparison expressions:
650) this.width=650; "src=" Http://s4.51cto.com/wyfs02/M00/7F/AA/wKioL1coaTCxp2YKAABIKA5gK1E210.jpg "title=" Psb.jpg "alt=" wkiol1coatcxp2ykaabika5gk1e210.jpg "/> 2.3.3 also supports the following arithmetic operators in an expression:
650) this.width=650; "src=" Http://s1.51cto.com/wyfs02/M00/7F/AC/wKiom1coaH6hbuiRAABEkpqM5PE995.jpg "title=" Psb.jpg "alt=" Wkiom1coah6hbuiraabekpqm5pe995.jpg "/> Original address: http://bbs.delit.cn/thread-936-1-1.html
Reprint please specify the source:
Author: metric Technology http://www.delit.cn
Datatable.compute Powerful Features