Product Catalog(学习记录)

301 阅读5分钟

Built-in Functions

Text

Trim function : data type Text

Removes all leading and trailing space characters (' ') from Text 't'.

  • Inputs:

    t : mandatory; data type Text The Text to trim.

  • Examples:
Trim(" First string ") = "First string" 
Trim("First string ") = "First string"

image.png

Index function : data type Integer

返回文本't'中可以找到'search'文本的从零开始的位置。如果没有找到'search'或'search'为空,则返回-1。

  • Inputs:   

    t : mandatory; data type

Text The Text where the search Text can be found.

search : mandatory; data type

Text The Text string to be found.     

startIndex : optional; data type

整数 *从零开始查找的索引。在从末尾到开始搜索的情况下,startIndex不等于0(零)表示文本的结束。默认值为0(零)。当在聚合中使用时,此参数不存在。

searchFromEnd:可选;数据类型。

布尔型 *搜索方向。在从末尾到开始搜索的情况下,startIndex不等于0(零)表示文本的结束。默认值为False。当在聚合中使用时,此参数不存在。

ignoreCase:可选;数据类型。

布尔值 *设置为True,将小写和大写字符视为相等,忽略文本输入't'和'search'的大小写。默认值为False。当在聚合中使用时,此参数不存在。

  • Examples:
Index("First string", "F") = 0
Index("First string", "st") = 3
Index("First string", "xx") = -1
Index("First string", "F", startIndex: 5) = -1
Index("First string", "st", startIndex: 5) = 6
Index("First string", "xx", startIndex: 5) = -1
Index("First string", "F", searchFromEnd: True) = 0
Index("First string", "st", searchFromEnd: True) = 6
Index("First string", "xx", searchFromEnd: True) = -1
Index("First string", "f") = -1
Index("First string", "f", ignoreCase: True) = 0
Index("", "xx") = -1
Index("First string", "") = -1
Index("", "") = -1

image.png

EmailAddressValidate function : data type Boolean

*如果Text 'address'是一个有效的电子邮件地址返回true。注意,EmailAddressValidate("")返回True。 这个内置函数实现了HTML5指定的验证(html.spec.whatwg.org/multipage/i…) which has a practical approach to RFC 5322.

  • Inputs:     

    address : mandatory; data type Text The email address to validate.

  • Examples:

EmailAddressValidate(EmailAddressCreate("John Smith", "john.smith@worldmail.com")) = True
EmailAddressValidate("John Smith <john.smith@>") = False

image.png

GetUserId function : data type User Identifier

Returns the identifier of the user that is currently authenticated with the server or 'NullIdentifier()' if the user is not authenticated.

image.png

ToLower function : data type Text

Converts Text 't' to the equivalent lowercase text.

  • Inputs:     t : mandatory; data type Text *Thet Text to transform into lowercase.
    • Examples:
`ToLower("First string") = "first string"`

Math

Round function : data type Decimal

*Returns the Decimal number 'n' rounded to a specific number of 'fractional digits'.
*返回十进制数'n'四舍五入到特定的'小数位数' 不同的场景不同的结果 The round method applied depends on where the function is used:

  • In expressions in client-side and server-side logic, applies the method round half to even (rounds to the nearest integer, 0.5 rounds to the nearest even integer).

  • In aggregates that query SQL Server or Oracle databases, applies the method round half away from 0 (rounds to the nearest integer, 0.5 rounds the number further away from 0).

  • In aggregates that query MySQL or iDB2 databases, applies the method round half up (rounds to the nearest integer, 0.5 rounds up).* Inputs:     n : mandatory; data type Decimal The Decimal number to round     fractionalDigits : optional; data type Integer Use it to specify the number of fractional digits that n has to be rounded to. The default value is 0. Note: In aggregates this parameter is not specified. Examples: When used in expressions in client-side and server-side logic:

Round(-10.89) = -11
Round(-5.5) = -6
Round(9.3) = 9
Round(2.5) = 2
Round(3.5) = 4
Round(9.123456789, 5) = 9.12346

When used in aggregates that query SQL Server or Oracle database:\

Round(-10.89) = -11
Round(-5.5) = -6
Round(9.3) = 9
Round(2.5) = 3
Round(3.5) = 4

When used in aggregates that query iDB2 database:\

Round(-10.89) = -11
Round(-5.5) = -5
Round(9.3) = 9
Round(2.5) = 3
Round(3.5) = 4

Date Time

DiffMinutes函数:数据类型为Integer

返回'dt1'和'dt2'之间的分钟差;例如,这两个日期之间经过了多少分钟:

-如果'dt1'小于'dt2',则返回正数; -如果'dt1'大于'dt2',则返回一个负数。 —如果两个日期相等,则返回0。

忽略夏令时(Daylight Saving Time)。无论最终用户的区域设置如何,用于评估此函数的时区始终是Platform Server的时区。

支持的最大值是(2^31)-1分钟。这相当于大约4085.78年。如果DiffMinutes(dt1, dt2)大于(2^31)-1,您将得到一个意外值。

输入: Dt1:强制;数据类型日期时间 第一次约会时间。 Dt2:强制性;数据类型日期时间 第二个约会时间。

例子: DiffMinutes(#1982-05-21 22:20:30#, #1982-05-21 22:26:00#) = 6 DiffMinutes(#1982-05-21 22:26:00#, #1982-05-21 22:20:30#) = -6 DiffMinutes(#1982-05-21 22:26:00#, #1982-05-21 22:26:59#) = 0 DiffMinutes(#1982-05-21 22:26:30#, #1982-05-21 22:27:20#) = 1 DiffMinutes(#1982-05-21 22:26:30#, #1982-05-21 22:27:40#) = 1 DiffMinutes(#2006-05-21 15:00:00#, #2006-05-22 15:00:00#) = 1440 DiffMinutes(#2006-03-25 15:00:00#, #2006-03-26 15:00:00#) = 1440,假设GMT+1时区(2006日光节约时间于2006年3月26日在欧洲开始)。如果您的服务器在不同的时区,您将得到不同的结果。 DiffMinutes(#2006-10-28 15:00:00#, #2006-10-29 15:00:00#) = 1440,假设GMT+1时区(2006日光节约时间在欧洲于2006年10月29日结束)。如果您的服务器在不同的时区,您将得到不同的结果。

Reset Form(技巧)

image.png

User Functions

OutSystemsUI

DeviceDetection->GetDiviceOrientation() data type Text

Get the current device orientation 获取当前设备朝向

  • Portrait: 纵向
  • Landscape: 横向

DeviceDetection->GetDeviceType() data type Text

Get the current device type 获取当前设备类型

image.png 注:ToLower()将英文字母全部转为小写字母