Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

用户可能想知道他们提交的流程应用程序的状态是什么。我们将尝试通过创建一个列表来显示应用程序信息以及未决活动和未决用户,以解决这个问题。这样,请求者/用户将能够告诉他们的应用程序/流程实例的状态。

在本练习中,我们将使用人力资源费用索赔应用程序捆绑在Joget企业版中,将MySQL作为数据库。

Image Added

图1:通过Datalist查看提交的应用程序

默认情况下,用户可以通过查看“个人支出”列表来查看提交的申请,但是无法分辨下一个活动是否在线,以及谁应该参加。这可以通过创建一个新的Datalist来解决。

  1. 创建一个新的Datalist。
  2. 选择JDBC数据库数据库活页夹。
  3. 在“配置JDBC数据库绑定器”中,选择“数据源”中的“默认数据源”。
  4. 在“SQL SELECT查询”中应用以下查询

Users may wonder on what is the state of their submitted process applications. We are going to attempt to address this issue by creating a list that will show the application information together with the pending activity and the pending user. This way, the requesters/users would be able to tell on the state of their applications/process instances.

In this exercise, we are using the HR Expenses Claim App that is bundled together in the Joget Enterprise edition with MySQL as the database.

Image Removed

Figure 1: Viewing submitted application through Datalist

By default, users would be able to see the submitted applications by going through the "Personal Expenses" listing but one will not be able to tell what is the next activity in line and who is supposed to attend to it. This can be solved by creating a new Datalist.

  1. Create a new Datalist.
  2. Choose JDBC Datalist Database Binder.
  3. In "Configure JDBC Datalist Database Binder", choose "Default Datasource" in "Datasource".
  4. Apply the following query in "SQL SELECT Query"
  5. Code Block
    langsql
    SELECT a.*, sact.Name AS activityName, GROUP_CONCAT(DISTINCT sass.ResourceId SEPARATOR ', ') AS assignee
    FROM app_fd_hr_expense_claim a
    JOIN SHKActivities sact on a.id = sact.ProcessId
    JOIN SHKActivityStates ssta ON ssta.oid = sact.State
    INNER JOIN SHKAssignmentsTable sass ON sact.Id = sass.ActivityId
    WHERE ssta.KeyValue = 'open.not_running.not_started'
    GROUP BY a.id
    Note: Please replace the code "app

    注意:如果您打算将其用于其他应用程序,请将代码“app_fd_hr_expense_

    claim" with your own table name if you intend to use it for other application.

    claim”替换为您自己的表名称。

  6. 将“主键”设置为“ Set "Primary Key" to "a.id"
  7.  Click OK. 点击OK。

Figure 2: Adding the columns into the Datalist

Next, add in the columns intended, and most importantly, add "activityName" and "assignee" to reveal the pending activity and assignees.

Image Removed
Figure 3: Datalist showing the pending activity and assignees

The Datalist will now list all the pending activities of everyone. Next, we are going filter the list such that user will only see what they submitted. Image Removed
Figure 4: Retrieving the requester information

We may determine on who is the claimant by looking up the "claimant" field.

图2:将列添加到Datalist中

接下来,添加预期的列,并且最重要的是,添加“活动名称”和“受让人”以显示未决活动和受让人。

Image Added

图3:数据显示未决活动和受让人

Datalist现在将列出所有人的未决活动。接下来,我们要过滤列表,使用户只会看到他们提交的内容。

Image Added

图4:检索请求者信息

我们可以通过查找“索赔人”字段来确定索赔人是谁。

在Datalist的“SQL SELECT Query”中,将代码修改为以下内容:In the Datalist's "SQL SELECT Query", modify the code to the following:-

Code Block
langsql
SELECT a.*, sact.Name AS activityName, GROUP_CONCAT(DISTINCT sass.ResourceId SEPARATOR ', ') AS assignee
FROM app_fd_hr_expense_claim a
JOIN SHKActivities sact on a.id = sact.ProcessId
JOIN SHKActivityStates ssta ON ssta.oid = sact.State
INNER JOIN SHKAssignmentsTable sass ON sact.Id = sass.ActivityId
WHERE ssta.KeyValue = 'open.not_running.not_started' AND a.c_claimant = '#currentUser.firstName# #currentUser.lastName#'
GROUP BY a.id

This is the new code added in.这是添加的新代码。

Code Block
langsql
AND a.c_claimant = '#currentUser.firstName# #currentUser.lastName#'

With the changes made above, we will now be able to list down the records related to the currently logged in user.通过上面所做的更改,我们现在可以列出与当前登录用户相关的记录。

Figure 5: Filtered List of Pending Activity and Assignee

Additional Information:

图5:待处理活动和受让人的已过滤列表

附加信息:

  1. 以下查询是为MSSQL使用的。

    The following query is for MSSQL to use.

    Code Block
    langsql
    SELECT dat.*, asg.activityName, asg.assignees FROM (SELECT id, activityName, assignees from
    (SELECT a.id, sact.Name AS activityName, sass.ResourceId AS assignee
    FROM app_fd_applications a
    JOIN SHKActivities sact on a.id = sact.ProcessId
    JOIN SHKActivityStates ssta ON ssta.oid = sact.State
    INNER JOIN SHKAssignmentsTable sass ON sact.Id = sass.ActivityId
    WHERE ssta.KeyValue = 'open.not_running.not_started'
    group by sact.Name, sass.ResourceId, a.id)
    AS A CROSS APPLY
    
    (SELECT assignee + ',' FROM
    (SELECT a.id, sact.Name AS activityName, sass.ResourceId AS assignee
    FROM app_fd_applications a
    JOIN SHKActivities sact on a.id = sact.ProcessId
    JOIN SHKActivityStates ssta ON ssta.oid = sact.State
    INNER JOIN SHKAssignmentsTable sass ON sact.Id = sass.ActivityId
    WHERE ssta.KeyValue = 'open.not_running.not_started'
    group by sact.Name, sass.ResourceId, a.id)
    AS B WHERE A.id = B.id AND A.activityName = B.activityName FOR XML PATH('')) D (assignees) GROUP BY id, activityName, assignees
    ) asg JOIN app_fd_applications dat ON asg.id = dat.id