Table of Contents |
---|
outline | true |
---|
absoluteUrl | true |
---|
|
...
什么是哈希变量?
Panel |
---|
borderColor | green |
---|
borderWidth | 1 |
---|
titleBGColor | #ddffcc |
---|
borderStyle | solid |
---|
title | Definition |
---|
|
Hash Variables gives users greater flexibility and freedom in accessing useful information or relevant run-time values from the system. |
A hash variable is a special hash-escaped keyword that can be used in :
- Form Builder
- Datalist Builder
- Userview Builder
- Supported plugin configuration properties
- Activity name in Workflow Designer
- External Form URL when mapping an activity to an external form
to return the value of some useful runtime variables from Joget components.
Tip |
---|
To conveniently access the list of all hash variables available, use shortcut combination Ctrl-Shift-3 in any of the components above. |
Tip |
---|
Download the tutorial app on Hash Variables from Joget Workflow Marketplace to learn more about Hash Variable. |
Nested Hash Variable
Since version 3.0.3, a Hash Variable can be used inside another Hash Variable to form a Nested Hash Variable.
哈希变量 为用户提供更大的灵活性和自由从系统访问有用的信息或相关的运行时间值。 |
散列变量是一个特殊的散列转义关键字,可用于:
- 表单生成器
- 数据主义生成器
- Userview生成器
- 支持的插件配置属性
- 工作流设计器中的活动名称
- 将活动映射到外部表单时的外部表单URL
从Joget组件返回一些有用的运行时变量的值。
Tip |
---|
为了方便地访问所有可用散列变量的列表,可以在上面的任何组件中使用快捷键组合Ctrl-Shift-3 。 |
Tip |
---|
从 Joget Workflow Marketplace 下载Hash变量的教程应用程序, 以了解更多关于Hash变量的信息。 |
嵌套哈希变量
从版本3.0.3开始,哈希变量可以在另一个哈希变量中使用,形成一个嵌套哈希变量。
内部哈希变量的语法由一对大括号包围。The syntax for the inner Hash Variable is wrapped by a pair of curly bracket.
Code Block |
---|
language | java |
---|
title | Syntax / Format |
---|
|
#prefix.#prefix。{prefix.variableKey}## |
这里有一些例子:Here's some examples:
Code Block |
---|
|
#date.#date。{envVariable.dateFormat}##
#user.#user。{} variable.username}username#.firstName#firstName
#form#form.tableChild.field1 [{form.tableParent.childId}]## |
Escaping the Resultant Hash Variable
The parsed/returned Hash Variable may cause incompatibility with the current context/environment such as syntax error in a script. Therefore, one may pass in additional parameters into the hash variable declared to escape certain characters.
Before ending a hash variable with a hash "#", add a question mark character "?" followed by the required format. You may include multiple by defining semicolon ";" separated values.
转义结果散列变量
解析/返回的哈希变量可能会导致与当前上下文/环境(如脚本中的语法错误)不兼容。因此,可以将附加参数传递给声明的散列变量来转义某些字符。
在使用散列“#”结束散列变量之前,添加一个问号字符“?” 其次是所需的格式。你可以通过定义分号来包含多个“;” 分隔值。
- 正则表达式
- JSON
- JavaScript的
- HTML
- XML
- java的
- SQL
- 网址
- regex
- json
- javascript
- html
- xml
- java
- sql
- url
Code Block |
---|
|
#envVariable#envVariable.script?java# |
...
哈希变量列表
Workflow Assignment Hash Variable
Name | Description |
---|
Prefix | assignment |
Description | To get workflow activity information of the current assignment. |
Attributes | - #assignment.processId#
- #assignment.processDefId#
- #assignment.processName#
- #assignment.processVersion#
- #assignment.processRequesterId#
- #assignment.description#
- #assignment.activityId#
- #assignment.activityName#
- #assignment.activityDefId#
- #assignment.assigneeId#
|
Scope of Use | - Elements within and part of a Process.
- Activity Name.
- Form mapped as part of process activity mapping.
- Email Tool configuration as part of process tool mapping.
|
Current User Hash Variable
Name | Description |
---|
Prefix | currentUser |
Description | To retrieve currently logged in user information. |
Attributes | - #currentUser.id#
- #currentUser.username#
- #currentUser.firstName#
- #currentUser.lastName#
- #currentUser.email#
- #currentUser.active#
- #currentUser.timeZone#
In Joget Enterprise edition, these additional attributes are available:- User Meta Organization - #currentUser.organization.id#
- #currentUser.organization.name#
- #currentUser.organization.description#
Department - #currentUser.department.id#
- #currentUser.department.name#
- #currentUser.department.description#
- #currentUser.department.treeStructure#
Grade - #currentUser.grade.id#
- #currentUser.grade.name#
- #currentUser.grade.description#
- #currentUser.grade.organizationId#
HOD - #currentUser.hod.username#
- #currentUser.hod.firstName#
- #currentUser.hod.lastName#
- #currentUser.hod.email#
- #currentUser.hod.active#
- #currentUser.hod.timeZone#
Group - #currentUser.groups.id#
- #currentUser.groups.name#
Employment - #currentUser.employee.code#
- #currentUser.employee.jobTitle#
- #currentUser.employee.isHod#
Department HOD - #currentUser.department.hod.username#
- #currentUser.department.hod.firstName#
- #currentUser.department.hod.lastName#
- #currentUser.department.hod.email#
- #currentUser.department.hod.active#
- #currentUser.department.hod.timeZone#
|
Scope of Use | - All components within the App.
|
Date Hash Variable
工作流分配散列变量
名称 | 描述 |
---|
字首 | 分配 |
描述 | 获取当前分配的工作流活动信息。 |
属性 | - #assignment.processId#
- #assignment.processDefId#
- #assignment.processName#
- #assignment.processVersion#
- #assignment.processRequesterId#
- #assignment.description#
- #assignment.activityId#
- #assignment.activityName#
- #assignment.activityDefId#
- #assignment.assigneeId#
|
使用范围 | - 过程中的元素和部分。
- 活动名称。
- 表单映射为流程活动映射的一部分。
- 电子邮件工具配置作为过程工具映射的一部分
|
当前用户哈希变量
名称 | 描述 |
---|
字首 | 当前用户 |
描述 | 检索当前登录的用户信息。 |
属性 | - #currentUser.id#
- #currentUser.username#
- #currentUser.firstName#
- #currentUser.lastName#
- #currentUser.email#
- #currentUser.active#
- #currentUser.timeZone#
在Joget企业版中,这些附加属性是可用的: - 用户元 组织 部 年级 HOD - #currentUser.hod.username#
- #currentUser.hod.firstName#
- #currentUser.hod.lastName#
- #currentUser.hod.email#
- #currentUser.hod.active#
- #currentUser.hod.timeZone#
组 雇用 - #currentUser.employee.code#
- #currentUser.employee.jobTitle#
- #currentUser.employee.isHod#
HOD部门 - #currentUser.department.hod.username#
- #currentUser.department.hod.firstName#
- #currentUser.department.hod.lastName#
- #currentUser.department.hod.email#
- #currentUser.department.hod.active#
- #currentUser.department.hod.timeZone#
|
使用范围 | |
日期哈希变量
名称 | 描述 |
---|
字首 | 日期 |
描述 | 根据指定的格式获取日期时间。 Info |
---|
| 在Joget Workflow v5中,返回的值将跟随当前登录用户的时区。如果用户的信息不可用,那么它将使用服务器的时区。 |
|
属性 | - #日期。dateFormat#
- #日期。dateUnit [+ - ] integerValue。dateFormat #
Info |
---|
| 日期格式 - 在Java日期格式; 例如2011年6月1日的yyyy-MM-dd
dateUnit integerValue |
|
使用范围 | |
示例属性 |
Name | Description |
---|
Prefix | date |
Description | To get date time according to a specified format. Info |
---|
| In Joget Workflow v5, the returned value would follow current logged in user's timezone. If user's information is not available, then it will use server's timezone. |
|
Attributes | - #date. dateFormat #
- #date.dateUnit[+-]integerValue.dateFormat #
Info |
---|
| dateFormat - In Java date format; e.g., yyyy-MM-dd for 2011-06-01
dateUnit integerValue - Numeric integer value. E.g. 10
|
|
Scope of Use | - All components within the App.
|
Sample Attributes | #date.h:mm a# #date.EEE,d MMM yyyy h:mm:ss a#
#date.DAY+ 7 .EEE,d MMM yyyy h:mm:ss a#
#date.DAY- 1 .EEE,d MMM yyyy h:mm:ss a#
|
Environment Variable Hash Variable
环境变量哈希变量
名称 | 描述 |
---|
字首 |
Name | Description |
---|
Prefix | envVariable |
Description | To retrieve Environment Variable value. Learn more about Environment Variables . |
Attributes | |
Scope of Use | - Anywhere within the Joget app itself. (i.e. Process, Process Tool, Form, List, Userview)
|
描述 | 检索环境变量值。了解有关环境变量的更多信息。 |
属性 | |
使用范围 | - 在Joget应用程序本身的任何地方。(即流程,流程工具,表单,列表,用户视图)
|
示例属性Sample Attributes | #envVariable.smtpServer# #envVariable.smtpPort#
|
Form Data Hash Variable
表单数据哈希变量
名称 | 描述 |
---|
字首 | 形成 |
描述 | 从表格中获取字段值。 |
属性 | - #形成。tableName。fieldId#
- #形成。tableName。fieldId [ 的recordId ]#(提供3.1以上)
|
使用范围 | - 在Process中的Process Tool部分。
- 在表单中。
- 在一个过程设计中。
|
示例属性 |
Name | Description |
---|
Prefix | form |
Description | To get field value from form table. |
Attributes | - #form. tableName . fieldId #
- #form. tableName . fieldId [recordId]# (Available in 3.1 and above)
|
Scope of Use | - In a Process Tool part of a Process.
- In a Form.
- In a process design.
|
Sample Attributes | #form.registration.registeredDate# //will use the current record ID
#form.registration.registeredDate[ 0001 ]# //0001 is the record ID to seek for
#form.registration.registeredDate[{variable.recordId}]#
|
App Message Hash Variable (Internationalization)
应用程序消息散列变量(国际化)
名称 | 描述 |
---|
字首 | 国际化 |
描述 | 在应用程序级别支持语言本地化。 |
属性 |
Name | Description |
---|
Prefix | i18n |
Description | To support language localization on application level. |
Attributes | |
Scope of Use | - All components within the App.
|
使用范围 | |
示例属性 | #i18n.logout# | Sample Attributes | #i18n.logout#
|
Example | Please see Add Message. |
Performer Hash Variable
执行者哈希变量
名称 | 描述 |
---|
字首 |
Name | Description |
---|
Prefix | performer |
Description | To get user information of the performer of an activity. |
描述 | 获取活动执行者的用户信息。 |
属性Attributes | - #performer. activityDefId .id#
- #performer. activityDefId .username#
- #performer. activityDefId .firstName#
- #performer. activityDefId .lastName#
- #performer. activityDefId .email#
- #performer. activityDefId .active#
- #performer. activityDefId .timeZone#
|
Scope of Use | - Elements within and part of a Process.
- Activity Name.
- Form mapped as part of process activity mapping.
- Email Tool configuration as part of process tool mapping.
Info |
---|
To get activityDefId (activity definition ID), mouseover the activity name in the Activity Mapping tab (Workflow Management Console); there will be an overlay showing the ID. |
Warning |
---|
The activity chosen must had already been performed. |
|
Sample Attributes | - #performer.runProcess.firstName#
- #performer.submitLeave.firstName#
|
Request Parameter Hash Variable
Name | Description |
---|
Prefix | requestParam |
Description | To access request parameter' values. |
Attributes | - #requestParam.parameterName[separator]#
- Separator (, or ;) can be indicated if requestParam is used in datalist filter with multiple values, to define the separator character in data output. Comma "," is used as default if no separator is indicated in cases of multiple values.
|
Scope of Use | - All components within the App.
|
Sample Attributes | - #requestParam.key# can be used specifically to obtain Userview Key value.
- #requestParam.name[;]# to indicate 'name' variable will store multiple values separated by semicolon. For example, this SQL statement "select * from expenses where title in (#requestParam.title[,]#)" will be translated to "select * from expenses where title in (a,b,c)" to cater for multiple values in "where-in" statement.
- In a Userview page, one may access the following attributes.
- #requestParam.key#
- #requestParam.userviewId#
- #requestParam.menuId#
- #requestParam.appId#
|
User Hash Variable
使用范围 | - 过程中的元素和部分。
- 活动名称。
- 表单映射为流程活动映射的一部分。
- 电子邮件工具配置作为过程工具映射的一部分
Info |
---|
要获取activityDefId(活动定义ID),请在“活动映射”选项卡(工作流程管理控制台)中将活动名称鼠标悬停; 会有覆盖显示ID。 |
|
示例属性 | - #performer.runProcess.firstName#
- #performer.submitLeave.firstName#
|
请求参数哈希变量
名称 | 描述 |
---|
字首 | requestParam |
描述 | 访问请求参数的值。 |
属性 | - #requestParam。parameterName [分隔符]#
- 如果在具有多个值的数据列表过滤器中使用requestParam,则可以指示分隔符(或;),以便在数据输出中定义分隔符。如果在多个值的情况下不指定分隔符,则使用逗号“,”作为默认值。
|
使用范围 | |
示例属性 | - #requestParam.key#可以专门用于获取UserView Key值。
- #requestParam.name [;]#表示“name”变量将存储以分号分隔的多个值。例如,这个SQL语句“select * from expenses where title in(#requestParam.title [,]#)”将被转换为“select * from(where a,b,c)中的标题”以满足多个值在“where-in”声明中。
- 在用户视图页面中,可以访问以下属性。
- #requestParam.key#
- #requestParam.userviewId#
- #requestParam.menuId#
- #requestParam.appId#
|
用户哈希变量
名称 | 描述 |
---|
字首 | 用户 |
描述 | 要根据用户名获取用户信息。 |
属性 |
Name | Description |
---|
Prefix | user |
Description | To get user information based on username. |
Attributes | - #user. username .id#
- #user. username .username#
- #user. username .firstName#
- #user. username .lastName#
- #user. username .email#
- #user. username .active#
- #user. username .timeZone#
In Joget Enterprise edition, these additional attributes are available:在Joget企业版中,这些附加属性是可用的: - User Meta用户元 - #user. username .meta.KEY#
Organization组织 Department部 id#name#- name#
- #user. username .department.
description#- description#
- #user. username .department.
treeStructure#Grade年级 id#name#- name#
- #user. username .grade.
description#- description#
- #user. username .grade.
organizationId#HOD username#- username#
- #user. username .hod.
firstName#- firstName#
- #user. username .hod.
lastName#- lastName#
- #user. username .hod.
email#- email#
- #user. username .hod.
active#- active#
- #user. username .hod.
timeZone#Group组 id#name#Employment雇用 - #user. username .employee.
code#- code#
- #user. username .employee.
jobTitle#- jobTitle#
- #user. username .employee.
isHod#HOD部门 Department HOD- #user. username .department.hod.
username#- username#
- #user. username .department.hod.
firstName#- firstName#
- #user. username .department.hod.
lastName#- lastName#
- #user. username .department.hod.
email#- email#
- #user. username .department.hod.
active#- active#
- #user. username .department.hod.
timeZone# |
Scope of Use | - All components within the App.
|
|
使用范围 | |
示例属性 | | Sample Attributes | - #user.admin.email#email#
- #user#user.cat.firstName#firstName#
- #user.#user。{requestParam.username} .email# to retrieve the email address of the user passed via url parameter
|
Userview Key Hash Variable
Name | Description |
---|
Prefix | userviewKey |
Description | Userview Key Hash Variable is used solely for the purpose of accessing the current Userview key's value. Typical use case for this hash variable are:- - Filtering a Datalist based on Userview Key.
- Preloading certain form data field (e.g. subform) in a Form or Form part of a process flow based on Userview Key.
|
Attributes | |
Scope of Use | |
Workflow Variable Hash Variable
Name | Description |
---|
Prefix | variable |
Description | To get the value of a workflow variable in a Process Flow. |
Attributes | - #variable. variableName #
|
Scope of Use | - Elements within and part of a Process.
- Activity Name.
- Form mapped as part of process activity mapping.
- Email Tool configuration as part of process tool mapping.
|
Sample Attributes | #variable.approvalStatus# |
Request Hash Variable
- email#检索通过url参数传递的用户的电子邮件地址
|
用户视图密钥哈希变量
名称 | 描述 |
---|
字首 | userviewKey |
描述 | 用户视图密钥散列变量仅用于访问当前用户视图密钥的值。 这个散列变量的典型用例是: - 滤波Datalist中基于用户视图的关键。
- 在基于UserView Key 的过程流程的Form或Form部分预加载某些表单数据字段(例如子表单)。
|
属性 | |
使用范围 | |
工作流变量哈希变量
名称 | 描述 |
---|
字首 | 变量 |
描述 | 在Process Flow中获取工作流程变量的值。 |
属性 | |
使用范围 | - 过程中的元素和部分。
- 活动名称。
- 表单映射为流程活动映射的一部分。
- 电子邮件工具配置作为过程工具映射的一部分
|
示例属性 | #variable.approvalStatus# |
请求哈希变量
名称 | 描述 |
---|
字首 | 请求 |
描述 | 从页面视图的当前 HttpServletRequest对象获取值 。 |
属性 | - #request.characterEncoding#
- #request.contextPath#
- #request.header.name#
name 是自定义标题名称。
|
Name | Description |
---|
Prefix | request |
Description | To get the value from the current HttpServletRequest object of the page view. |
Attributes | - #request.characterEncoding#
- #request.contextPath#
- #request.header.NAME#
NAME is the custom header name. - #request.locale#
- #request.method#
- #request.pathInfo#
- #request.protocol#
- #request.queryString#
- #request.remoteAddr#
- #request.requestURI#
- #request.requestURL#
- #request.requestedSessionId#
- #request.scheme#
- #request.serverName#
- #request.serverPort#
- #request.servletPath#
|
Scope of Use | - All components within the App where there is valid HttpServletRequest object. Such object will not be available in background activity such as in Process Tool triggered as a result of Deadlines.
|
使用范围 | - App中的所有组件都有有效的HttpServletRequest对象。这样的对象不能在后台活动中使用,例如由于截止时间而触发的过程工具。
|
示例属性 | Image Added 要检索上面屏幕截图中的“Referer”标题属性值,可以使用下面的散列变量。 | Sample Attributes | Image Removed To retrieve the "Referer" header attribute value in the screenshot above, one may use the following hash variable. Code Block |
---|
| #request#request.header.Referer#Referer# |
|
...
平台哈希变量
Panel |
---|
borderColor | red |
---|
borderWidth | 1 |
---|
titleBGColor | #ffcccc |
---|
borderStyle | solid |
---|
title | New Feature |
---|
|
This is a new feature in Joget Workflow v6. |
...
#platform.name#
#platform.version#
#platform.jdbcDriver#
#platform.setting.dataFileBasePath#
#platform.setting.deadlineCheckerInterval#
#platform.setting.defaultUserview#
#platform.setting.fileSizeLimit#
#platform.setting.landingPage#
#platform.setting.systemDateFormat#
#platform.setting.systemLocale#
#platform.setting.systemTimeZone#
In Joget Enterprise edition, these additional attributes are available:-
#platform.license.name#
#platform.license.holder#
#platform.license.users#
#platform.license.appLimit#
#platform.license.expiry#
#platform.license.activated#
#platform.systemKey#
这是Joget Workflow v6中的一个新功能。 |
名称 | 描述 |
---|
字首 | 平台 |
描述 | 检索特定于平台的信息。 |
属性 | #platform.name# #platform.version# #platform.jdbcDriver# #platform.setting.dataFileBasePath# #platform.setting.deadlineCheckerInterval# #platform.setting.defaultUserview# #platform.setting.fileSizeLimit# #platform.setting.landingPage# #platform.setting.systemDateFormat# #platform.setting.systemLocale# #platform.setting.systemTimeZone#
在Joget企业版中,这些附加属性是可用的: - #platform.license.name# #platform.license.holder# #platform.license.users# #platform.license.appLimit# #platform.license.expiry# #platform.license.activated# #platform.systemKey#
|
使用范围 | |
Bean Shell哈希变量
...
Panel |
---|
borderColor | purple |
---|
borderWidth | 1 |
---|
titleBGColor | #ddccff |
---|
borderStyle | solid |
---|
title | New Feature |
---|
|
This is a new feature in Joget Workflow v6. |
这是Joget Workflow v6中的一个新功能。 |
名称 | 描述 |
---|
字首 | BeanShell的 |
描述 | 使用环境变量来执行bean shell脚本。使用URL查询字符串语法传递参数。 |
属性 | |
Name | Description |
---|
Prefix | beanshell |
Description | Using environment variable to execute bean shell script. Passing parameter using URL query string syntax. |
Attributes | |
ScopeofUseAll components within the App.
| |
示例属性 | 使用参数“username”和“dept”执行存储在“welcome”环境变量中的脚本: | Sample Attributes | To execute a script stored in "welcome" environment variable with parameter "username" and "dept": Code Block |
---|
| if (username != null && username.length == 1 && !username[0].isEmpty()) {
return "Welcome " + username[0] + " (" + dept[0] + "),";
} else {
return "";
} |
|