深入浅出Nintex——使用查询XML动作

通常我们使用“查询XML”动作(EN:Query XML)可以方便的根据需要进行必要地运算和转换来得到想要的值,并制定为相应的数据类型(通过对应的赋值变量类型)。

扩展查询XML动作功能——使用XSLT

详细可参考http://www.cnblogs.com/mingle/archive/2010/11/27/Nintex_GetGroupCollectionFromUser.html

扩展查询XML动作功能——使用内置函数

参考函数

fn-Abs
返回数字的绝对值。比如:fn-Abs({WorkflowVariable:Number})

参数:取其绝对值的数字。

fn-Currency
返回货币格式的数字文本。

比如:fn-Currency({WorkflowVariable:Cost})。如果你传入数字9996666,fn-Currency(9996666),执行将返回$9,996,666.00

参数:包含数字值的数字变量。

fn-DateDiffDays
测定两个日期相差的天数。
格式:fn-DateDiffDays({WorkflowVariable:StartDate}, {WorkflowVariable:EndDate})

参数:用作计算差值的起始日期时间,用作计算差值的结束日期时间。

fn-DateDiffHours
测定两个日期相差的天数。

格式:fn-DateDiffHours({WorkflowVariable:StartDate}, {WorkflowVariable:EndDate})

参数:用作计算差值的起始日期时间,用作计算差值的结束日期时间。

fn-DateDiffMinutes

测定两个日期相差的分钟。

格式:fn-DateDiffMinutes({WorkflowVariable:StartDate}, {WorkflowVariable:EndDate})

参数:用作计算差值的起始日期时间,用作计算差值的结束日期时间。

fn-DateDiffSeconds

测定两个日期相差的秒数。

格式:fn-DateDiffSeconds({WorkflowVariable:StartDate}, {WorkflowVariable:EndDate})

参数:用作计算差值的起始日期时间,用作计算差值的结束日期时间。

fn-FormatDate
根据指定的日期时间格式,返回日期时间值。

比如:fn-FormatDate({WorkflowVariable:MyDate}, d)

参数:1、日期变量;2 格式文本。

由于格式文本用起来跟平常的不一样,大家要特别注意。我做了如下测试:

输入:

fn-FormatDate({ItemProperty:Created},dd-M-yyyy)
fn-FormatDate({ItemProperty:Created},dd)
fn-FormatDate({ItemProperty:Created},M )
fn-FormatDate({ItemProperty:Created},yyyy)

输出:

16-11-2010
16
11
2010

注意:获取日期的月份时候,格式文本必须"M "(M后面有个空格)。

fn-Insert
在字符串中插入文本。

格式:fn-Insert({WorkflowVariable:Text}, 4, {ItemProperty:Title})

参数:

Text:将被修改的源字符串。
Start:新字符串将被插入的位置. 源字符串的起始位置为0。
New text:被插入的字符串。

fn-Length
返回字符串长度。

比如:fn-Length({WorkflowVariable:Text})

参数:用作计算长度的字符串。

fn-Max
比较两个数字的大小,并返回最大值。

格式:fn-Max({WorkflowVariable:Number1}, {WorkflowVariable:Number2})

参数:Number 1 :第一个用作比较的数字。Number 2 :第二个用作比较的数字。

fn-Min
比较两个数字的大小,并返回最小值。

格式:fn-Min({WorkflowVariable:Number1}, {WorkflowVariable:Number2})

参数:Number 1 :第一个用作比较的数字。Number 2 :第二个用作比较的数字。

fn-NewGuid
生成全局的唯一标识符。

格式:fn-NewGuid()

fn-PadLeft
使用指定的字符串来自右向左(右看齐)填充提供的字符串,使其总长度增加到指定的长度。如果提供的字符串总长度大于指定的长度数字,将不会做填充。

Example

fn-PadLeft({WorkflowVariable:Text}, 6)

fn-PadLeft({WorkflowVariable:Text}, 6,-)

参数:

Text :被填充的字符串。

Number Length:目标字符串被填充后的总长度。

Character Optional:可选的用做填充的字符串。默认的填充字符为空格。

fn-PadRight
使用指定的字符串来自左向右(左看齐)填充提供的字符串,使其总长度增加到指定的长度。如果提供的字符串总长度大于指定的长度数字,将不会做填充。

比如:

fn-PadRight({WorkflowVariable:Text}, 6)

fn-PadRight({WorkflowVariable:Text}, 6,-)

参数:

Text :被填充的字符串。

Number Length:目标字符串被填充后的总长度。

Character Optional:可选的用做填充的字符串。默认的填充字符为空格。

fn-Power
Raises a number to the specified power.

Example

fn-Power({WorkflowVariable:Number}, {WorkflowVariable:Power})

Arguments

Number The number to raise to the power.
Number The power to raise number to.

fn-Remove
Removes a section of text in a larger string.

Example

fn-Remove({WorkflowVariable:Text},xxx,{ItemProperty:Title})

Arguments

Text The text to modify.
Start position The character position from which to remove the following characters. The first character in the string is at position 0.
Length Optional. The number of characters from the start position to remove. All remaining characters will be removed by default.

fn-Replace
Replaces a section of text in a larger string.

Example

fn-Replace({WorkflowVariable:Text},xxx,{ItemProperty:Title})

Arguments

Text The text to modify.
Old value The text to search for and replace.
New value The text to replace Old value with.

fn-Round
Rounds a decimal value to the nearest integer.

Example

fn-Round({WorkflowVariable:Number})

Arguments

Number The decimal number to round.

fn-SubString
Extracts a portion of text from a string.

Example

fn-SubString({WorkflowVariable:Text},5,10)

Arguments

Text The text to extract a value from
Start index The position in the text of the first character to retrieve. The first character in the string is at position 0.
Number of characters The number of characters to retrieve from the start index.

fn-ToLower
Formats text in a string to all lower case.

Example

fn-ToLower({WorkflowVariable:Text})

Arguments

Text The string to convert to all lower case.

fn-ToTitleCase
Formats text in a string to title case.

Example

fn-ToTitleCase({WorkflowVariable:Text})

Arguments

Text The string to convert to title case.

fn-ToUpper
Formats text in a string to all upper case.

Example

fn-ToUpper({WorkflowVariable:Text})

Arguments

Text The string to convert to all upper case.

fn-Trim
Removes leading and trailing whitespace from a string.

Example

fn-Trim({WorkflowVariable:Text})

Arguments

Text The text to remove leading and trailing whitespace characters from.

fn-XmlEncode
Encodes a string to make it safe for viewing in html.

Example

fn-XmlEncode({WorkflowVariable:Text})

Arguments

Text The text to encode.

fn-XmlDecode
Decodes a html safe string to regular text.

Example

fn-XmlDecode({WorkflowVariable:Text})

Arguments

Text The text to decode.

示例1 获取当前年份

 

posted @ 2010-12-01 13:01  风影极光  阅读(1456)  评论(0编辑  收藏  举报