Versions Compared

Key

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

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.

Thai

ผู้ใช้อาจสงสัยว่าสถานะของแอพพลิเคชันที่ส่งมานั้นเป็นอย่างไร เราจะพยายามแก้ไขปัญหานี้โดยสร้างรายการที่จะแสดงข้อมูลแอปพลิเคชันพร้อมกับกิจกรรมที่รอดำเนินการและผู้ใช้ที่รอดำเนินการ ด้วยวิธีนี้ผู้ร้องขอ / ผู้ใช้จะสามารถบอกสถานะของแอปพลิเคชัน / กระบวนการของพวกเขาได้

ในแบบฝึกหัดนี้เรากำลังใช้แอพเรียกร้องค่าใช้จ่ายการบริหารทรัพยากรบุคคลที่รวมอยู่ใน Joget Enterprise รุ่นที่มี MySQL เป็นฐานข้อมูล


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.

Thai

รูปที่ 1: การดูแอปพลิเคชันที่ส่งผ่าน Datalist

ตามค่าเริ่มต้นผู้ใช้จะสามารถเห็นแอปพลิเคชันที่ส่งมาโดยไปที่รายการ "ค่าใช้จ่ายส่วนตัว" แต่จะไม่มีใครสามารถบอกได้ว่ากิจกรรมต่อไปในไลน์คืออะไรและใครควรจะเข้าร่วม สิ่งนี้สามารถแก้ไขได้โดยการสร้าง Datalist ใหม่

  1. Create a new Datalist.

    Thai

    สร้างดาต้าลิสต์ใหม่

  2. Choose JDBC Datalist Database Binder.

    Thai

    เลือกตัวยึดฐานข้อมูล JDBC Datalist

  3. In "Configure JDBC Datalist Database Binder", choose "Default Datasource" in "Datasource".

    Thai

    ใน "กำหนดค่า JDBC Datalist Binder ฐานข้อมูล" เลือก "Default Datasource" ใน "Datasource"

  4. Apply the following query in "SQL SELECT Query"

    Thai

    ใช้แบบสอบถามต่อไปนี้ใน "SQL SELECT Query"

    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_fd_hr_expense_claim" with your own table name if you intend to use it for other application.

    Thai

    หมายเหตุ: โปรดแทนที่รหัส "app_fd_hr_expense_claim" ด้วยชื่อตารางของคุณเองหากคุณตั้งใจจะใช้สำหรับแอปพลิเคชันอื่น

  5.  Set "Primary Key" to "a.id"

    Thai

    ตั้งค่า "คีย์หลัก" เป็น "a.id"

  6.  Click OK.

    Thai

    คลิกตกลง


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.

Thai

รูปที่ 2: การเพิ่มคอลัมน์ใน Datalist

ถัดไปเพิ่มในคอลัมน์ที่ตั้งใจและที่สำคัญที่สุดคือเพิ่ม "activityName" และ "assignee" เพื่อเปิดเผยกิจกรรมและผู้รับมอบหมายที่รอดำเนินการ



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.

Thai

รูปที่ 3: นักดาต้าลิสต์แสดงกิจกรรมและผู้รับมอบหมายที่รอดำเนินการ

Datalist จะแสดงรายการกิจกรรมที่รอดำเนินการทั้งหมดของทุกคน ต่อไปเราจะกรองรายการตามที่ผู้ใช้จะเห็นเฉพาะสิ่งที่พวกเขาส่ง



Figure 4: Retrieving the requester information

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

In the Datalist's "SQL SELECT Query", modify the code to the following:-

Thai

รูปที่ 4: การดึงข้อมูลผู้ร้องขอ

เราอาจตัดสินได้ว่าใครเป็นผู้อ้างสิทธิ์โดยค้นหาช่อง "ผู้อ้างสิทธิ์"

ใน "SQL SELECT Query" ของดาต้าลิสต์ให้แก้ไขโค้ดดังต่อไปนี้: -

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.

Thai

นี่คือรหัสใหม่ที่เพิ่มเข้ามา

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.

Thai

ด้วยการเปลี่ยนแปลงที่ทำไว้ข้างต้นตอนนี้เราจะสามารถบันทึกรายการที่เกี่ยวข้องกับผู้ใช้ที่เข้าสู่ระบบในปัจจุบัน



Figure 5: Filtered List of Pending Activity and Assignee

Additional Information:

Thai

รูปที่ 5: รายการที่กรองของกิจกรรมที่รอดำเนินการและผู้รับโอนสิทธิ์

ข้อมูลเพิ่มเติม:

  1. The following query is for MSSQL to use.

    Thai

    แบบสอบถามต่อไปนี้ใช้สำหรับ MSSQL

    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