1
0
-1

Hello, experts.

I need ideas because I've stuck on this one.

I have two forms. Form Staff and Form Asset. So the user fill in form staff which means they have to key in staff ID. Then, on form asset. they will register their asset and assign the asset to their staff ID that will be in drop down list. They have to choose their staff ID from that drop down list.

Right now, I'm using Default Form Options Binder to display staff ID which means user can submit multiple times. I tried using JDBC Binder with coding:

 

SELECT c_name, c_staffId
FROM `jwdb`.`app_fd_staff`
WHERE c_StaffId NOT IN (SELECT c_assignAsset FROM `jwdb`.`app_fd_aset`)

This will only display staff ID for those who not register their asset yet. It seems inefficient to my team.

I also tried:

IF EXISTS (SELECT c_staffId, c_assignAset
FROM app_fd_staff
JOIN app_fd_aset
WHERE c_staffId
IN (SELECT c_assignAsset
FROM app_fd_asset))
Print 'Record exists'
ELSE
Print 'Record does not exist' 

But JDBC Binder can only read Select statement.

What I want to do is, the form will display all staff ID and if user already have their asset registered, there will be popup notification "Record already exist" when they select their staff ID. If not, the data will be insert into database. 

Can anyone give me ideas, please. 

Thank you, in advance.

    CommentAdd your comment...

    1 answer

    1.  
      2
      1
      0

      Agree on your approach- This will only display staff ID for those who not register their asset yet.

      You can also do this. In your "Default Form Options Binder", make use of the extra filter conditions.

       

      customProperties.asset = 'No'

      In the selectbox itself, you can use duplicate value validator so that on submission of the form, it will be rejected.

      1. Nurul Akhmar

        Thank you so much! Your suggestion really helps.

      CommentAdd your comment...