Project Siena内置了很多函数,帮助我们实现常规操作,其中
- 绝对值
Abs(Number)
Abs(ColumnExpression)
如:
Abs(-12) = 12 - 逻辑与
And(LogicalExpression1[, LogicalExpression2, ...])
如:
And(3>1,3>2,3>3) = false - 平均值
Average(Table, Expression)
Average(Expression1[, Expression2, …])
如:
Average(Sales,CostPerUnit * UnitsSold),Average(1,2,3,4)= 2.5 - 将数字转换成ASCII编码的字符
Char(Number)
如:
Char(97) = ‘a‘ - 清空集合
Clear(Collection) - 创建集合
Collect(CollectionName, Item1[, Item2,...])
如:
Collect(CollectionName,TableName)
Collect(CollectionName,TableName!ColumnName)
Collect(Products, "violins", "trombones", "bongos")
Collect(CollectionName,ControlName1!Value,ControlName2!Value,ControlNameN!Value)
Collect(OrderHistory, {Products:Product!Text, Quantities:Quantity!Text}) - 颜色淡出
ColorFade(Color, FadeDelta)
如:
ColorFade(Color!DarkRed,0.5) - 字符串转颜色
ColorValue(ColorText)
如:
ColorValue(TextMessage!Text) - 拼接字符串
Concatenate(Text1[, Text2, ...])
Concatenate(ColumnExpression1[, ColumnExpression2, ...])
如:
Concatenate("By ", AuthorName!Text)
Concatenate(Employees!FirstName, " ", Employees!LastName) - 计数(注意:按照某一列进行计数)
Count(Column)
如:
Count(Value(OrderHistory!Quantities)) - 非空计数
CountA(Column) - 条件计数
CountIf(Table, Expression)
如:
CountIf(Employees, Salary > 100000) - 行号
CountRows(Table)
如:
CountRows(Employees) - 获取日期
Date(Year, Month, Day)
如:
Date(2015,03,15) - 添加日期
DateAdd(Date, NumberOfUnits[, Units])
如:
DateAdd(Now(), 3)
DateAdd(Today(), 1, Days)
DateAdd(Today(), 1, Months) - 时间间隔
DateDiff(StartDate, EndDate[, Units])
如:
DateDiff(Now(), 1/1/2014)
DateDiff(Now(), 1/1/2014, Months) - 格式化时间
DateTimeValue (DateTimeText, "LanguageCode")
如:
Text(DateTimeValue(Start!Text), DateTimeFormat!LongDateTime)
Text(DateTimeValue(Start!Text, "fr"), DateTimeFormat!LongDateTime)
Text(DateTimeValue(Start!Text), "dddd, mmmm dd, yyyy hh:mm:ss:ff AM/PM") - 字符串转日期格式
DateValue (DateText, "LanguageCode")
如:
Text(DateValue(Startdate!Text), DateTimeFormat!LongDate)
DateDiff(DateValue(Startdate!Text), Today()) - 获取日期
Day(DateTime) - 获取小时
Hour(DateTime) - 禁用功能
Disable(Signal)
如:
Disable(Location) - 启用功能
Enable(Signal)
如:
Enable(Location) - 消除冗余项
Distinct(Table, Expression)
如:
Distinct(Employees, Department) - 删除某列
DropColumns(Table, Column1[, Column2, …])
如:
DropColumns(Employees, "FirstName", "LastName", "Address") - 添加某列
AddColumns(Table, Column1, Expression1[, Column2, Expression2, ...])
如:
Collect(Items,AddColumns(Sales,"TotalPrice",UnitsSold*UnitsSold)) - URL地址编码
EncodeUrl(Text)
如:
EncodeUrl("‘http://example/page/url.aspx") = %27http%3A%2F%2Fexample%2Fpage%2Furl.aspx - 过滤数据
Filter(Table, Condition1[, Condition2, ...])
如:
Filter(Employees, Salary > 100000) - 查找文本
Find(FindText, WithinText[, StartNum])
如:
Find("me", "time") = 3
Find("my", "time") = nothing
Find("in", "Honorificabilitudinitatibus", 4) = 18
Find("in", "Honorificabilitudinitatibus", 19) = nothing - 返回集合中第一个元素
First(Table) - 返回指定数量的行数
FirstN(Table[, NumRows])
如:
FirstN(Employees, 10) - 根据#返回hashtable
HashTags(Text)
如:
字符串:This #app is #AMAZING and can #coUnt123 or #123abc but not #1-23 or #$*(#@")
HashTags(字符串) =- #app
- #AMAZING
- #coUnt123
- #123abc
- #1
- 分支选择
If(Condition1, Result1[, Condition2, Result2, ConditionN, ResultN, DefaultResult])
如:
If(MyShare!Value + YourShare!Value < 100, "Not enough", MyShare!Value + YourShare!Value > 100, "Too much", "Just right")
If(Value(ThisItem!Quantities) < 5, "Order more!") - 空白判断
IsBlank(Expression)
如:
If(IsBlank(Quantity!Text), "Please add a quantity.") - 集合为空
IsEmpty(Source)
如:
IsEmpty(Employees) - 获取本地语言
Language()
如:
Language() = en-US - 获取集合最后一个对象
Last(Table)
如:
Last(Employees) - 获取指定数量的后几条记录
LastN(Table[, NumRows])
如:
LastN(Employees, 15) - 跳转地址
Launch(Hyperlink)
如:
Launch("http://www.bing.com") - 左截取
Left(Text, NumChars)
Left(ColumnExpression, NumericExpression)
如:
Left(PhoneNumber!Text, 3)
Left(ThisItem!Products, 3) - 获取文本长度
Len(Text)
Len(ColumnExpression)
如:
Len(Password!Text) - 加载数据
LoadData(Collection, Filename)
如:
LoadData(OrderHistory, "SavedOrders") - 在表中条件查询
LookUp(Table, Condition, Expression)
如:
LookUp(Employees, FirstName = "John" && LastName = "Smith", Salary) - 转小写
Lower(Text)
Lower(ColumnExpression)
如:
Lower(Poetry!Text)
Lower(ThisItem!Product) - 获取最大值
Max(Table, Expression)
Max(Expression1[, Expression2, ...])
如:
Max(Sales, CostPerUnit * UnitsSold)
Max(Slider1!Value, Slider2!Value, Slider3!Value) - 截取字符串
Mid(Text, StartPosition, NumChars)
Mid(TextColumn, StartPositions, NumChars)
如:
Mid(PhoneNumber!Text, 3, 3)
Mid(ThisItem!Product, 4, 3) - 获取最小值
Min(Table, Expression)
Min(Expression1[, Expression2, ...])
如:
Min(Sales, CostPerUnit * UnitsSold)
Min(Slider1!Value, Slider2!Value, Slider3!Value) - 获取分钟
Minute(DateTime)
如:
Minute(TimeValue(EventTime!Text)) - 获取月份
Month(DateTime)
如:
Month(DateValue("03/17/1979")) - 场景跳转
Navigate(TargetScreen, Animation[, Context])
如:
Navigate(DetailView, ScreenTransition!Fade, {source: "Ravens"})
Navigate(DetailView, ScreenTransition!Fade)
Navigate(DetailView, "") - 取反
Not(BooleanExpression)
如:
Not(RadioButton1!Selected) - 获取当前时间
Now()
如:
Text(Now(), "mm/dd/yyyy hh:mm:ss:ff") - 逻辑或
Or(LogicalExpression1[, LogicalExpression2, ...])
如:
Or(Slider1!Value < 50, Slider1!Value> 100)
Or(Dept = HR, Salary >= 200000) - 返回纯文本
PlainText(TextWithTags)
如:
PlainText(ThisItem!description) - 首字母大写
Proper(Text)
Proper(ColumnExpression) - 获取随机数
Rand() - 刷新数据源
Refresh(ServiceDataSource) - 移除数据源
Remove(Collection, Record1[, Record2, ..., All])
Remove(Collection, Table[, All])
如:
Remove(OrderHistory, ThisItem) - 根据条件移除数据源
RemoveIf(Collection, Condition1[, Condition2 ...])
如:
RemoveIf(Cart, Price > 200) - 文本替换
Replace(Text, StartIndex, Count, NewText)
Replace(Column, StartIndex, Count, NewText)
如:
Replace("ABCDEFG", 3, 2, "X") = ABXEFG - 返回颜色
RGBA(Red, Green, Blue, Alpha)
如:
RGBA(255, 127, 39, 1) - 右截取
Right(Text, NumChars)
Right(ColumnExpression, NumericExpression)
如:
Right("ABCDE", 4) - 四舍五入
Round(Number, DecimalPlaces)
Round(Column, DecimalPlaces) - 向下取整
RoundDown(Number, DecimalPlaces)
RoundDown(Column, DecimalPlaces)
如:
RoundDown(23.54, 0) = 23 - 向上取整
RoundUp(Number, DecimalPlaces)
RoundUp(Column, DecimalPlaces)
如:
RoundUp(23.44, 1) = 23.5 - 保存数据
SaveData(Collection, FileName)
如:
Collect(OrderHistory, {Products:Product!Text, Quantities:Quantity!Text});
SaveData(OrderHistory, "SavedOrders") - 获取秒
Second(DateTime)
如:
Second(TimeValue(EventTime!Text)) - 重新排列集合
Shuffle(Collection)
如:
Shuffle(Deck) - 排序集合
Sort(Table, Expression[, SortOrder!Descending])
如:
Sort(Employees, Salary, SortOrder!Descending) - 平方根
Sqrt(Number)
Sqrt(ColumnExpression1)
如:
Sqrt(2) = 1.414 - 标准方差
StdevP(Table,Expression)
StdevP(Expression1[,Expression2, ...]) - 字符串替换
Substitute(Text, OldText, NewText[,InstanceNum])
Substitute(TextColumn, OldTextColumn, NewTextColumn[, InstanceNumColumn])
如:
Substitute(Text1!Text, " & ", " and ") - 求和
Sum(Table, Expression)
Sum(Expression1[, Expression2, ...]) - 格式化文本
Text(Value, Format)
如:
Text(Value(Source!Text), "$#.##") = $56.75
Text(Value(Source!Text), "#.##%") = 56.75%
Text(DateValue(Source!Text), "mmm dd, yyyy") = May 18, 1969
Text(TimeValue(Source!Text), "hh:mm:ss") = 2:20:30 PM - 获取时间
Time(Hour, Minute, Second)
如:
Text(Time(Value(BirthHour!Text), Value(BirthMinute!Text), Value(BirthSecond!Text)), "hh:mm:ss a/p") - 字符串转时间
TimeValue(TimeText)
TimeValue(TimeText, "LanguageCode")
如:
If(TimeValue(FinishedAt!Text)<TimeValue("5:00:00.000 PM"), "You made it!", "Too late!") - 获取今天的日期(不包含时分秒)
Today()
如:
Text(Today(), "mm/dd/yyyy") - 截取多余空格
Trim(Text)
Trim(ColumnExpression)
如:
Trim(Slogan!Text) - 更新数据
Update(Collection, Record1, Record2[, "All"])
如:
Update(OrderHistory, {Products:OldValue!Text}, {Products:NewValue!Text}, All) - 更新上下文
UpdateContext({Name1: Expression1, Name2: Expression2, …})
如:
UpdateContext({page: 5, displayItem: "Tablets"}) - 满足条件时更新集合
UpdateIf(Collection, Condition1, {Column1: Expression1, …}[, Condition2, {Column1: Expression2, …} …])
如:
UpdateIf(ShoppingCart, Price > 200, {NumItems: 0}) - 转大写
Upper(Text)
Upper(ColumnExpression) - 字符串转数字
Value(Text) - 获取方差
VarP(Table, Expression)
VarP(Expression1[, Expression2, ...])
如:
VarP(Sales, CostPerUnit * UnitsSold) - 获取年
Year(DateTime)
时间: 2024-11-01 20:56:34