16
Views
3
Comments
Solved
how can solve problem in switch widget and voting screen
Question
Application Type
Reactive

in screen Voting i need using this screen  for voting if  user (value form dropdown for select Employee)  <>userid  Stored in an entity (Voting) and creator (value form user = getuserid()) <> creator Stored in an entity (Voting)

user can make vote 

--------------------------------

user (value form dropdown for select Employee)  = userid  Stored in an entity (Voting) and creator (value form user = getuserid()) = creator Stored in an entity (Voting) 

User cannot vote for this employee because this user has already voted

For this employee and show this voting 

how can do it

as at Attachment oml

HRMS.oml

Rank: #311
Solution

Hi Andrew,

Please see attached OML to fulfil your requirement. Kindly review this and let me know, if you need any help.

Thanks & Kind Regards,

Sachin

HRMSSachin21.oml

Rank: #541

Hi Andrew,

What you want is use a Switch widget on Save server action's flow?
If so, I think you should consider to use the Valid and ValidationMessage attributes of the widgets, as it is made in the exercise: https://www.outsystems.com/training/lesson/1776/input-validation-exercise.

It will reduce the number os Ifs and End widgets, and will eliminate the Message ones. 


Best regards

mvp_badge
MVP
Rank: #72

Hi Andrew,

For the required validation check, you will have to define a similar logic as mentioned below, within the save button action flow.

Steps to follow

  • Define an Aggregate (GetVotingsByUserid), referring the Voting entity as its source entity (Set the Fetch property to - Only on demand)
  • Within the same Aggregate filter section, define a filter condition based on the Validation clause
  • Voting.userid = userid and Voting.Careator = GetUserId()
  • In the Save button action flow, define an IF check - i.e. if the aggregate result-set is empty then the user can make vote otherwise showcase an Error Feedback message, as shown below.

Please refer to the attached updated .oml file.


Hope this helps you!


Kind regards,

Benjith Sam

HRMS.oml

Rank: #311
Solution

Hi Andrew,

Please see attached OML to fulfil your requirement. Kindly review this and let me know, if you need any help.

Thanks & Kind Regards,

Sachin

HRMSSachin21.oml