Supervisor validation

Good day! I'm having problem doing the validation for supervisor column in my module. Only with supervisor role can be listed and imported in the supervisor column (image attached). If the employee in the excel file to be imported is not having a supervisor role, and he is under the supervisor column, it needs to be have an error showing "invalid supervisor" and the importing will not be process. Hope I make a clear explanation for you to understand what the issue is. I also attached the oml for clearer visualization. 

SlimDirectory.oml

Solution

Thank you all guys for taking time in answering my questions, it is all appreciated. I already got what to do in this one.

I have an aggregate GetEmployeesSupervisor and add a filter to show only the employee with supervisor roles, then connect to an IF widget with a condition

GetEmployeesSupervisor.List.Empty

and that's it. Attached is the screenshot of the flow.



Hello RD,

In the Oml you have posted , you are assigning the 'SupervisorId' which is not yet created.Change the Flow first To create the Employees(Assign Their Concern Roles) ,Then Loop through the Same Excel Imported list, Update Each Employee with SupervisorId(EmployeeId) Into each ones Supervisor Column. You can also Do your Required Role Validation In the Second Loop.

Hello Varada

My concern is what condition is Im going to use to filter that the employees that are imported had valid value in their supervisor column. I try different conditions but didnt work, hope I explain it well. Thanks!

In that scenario you can check..list.current.supervisorId <> NullIdentifier

I already tried this one but didn't work, its not exactly the needed logic

Hi @Varada Rajan ,

Can you please ass core module in your oml ?

Thanks,

Vani

Hello Vani,

Its not me who posted the Oml and Question, I just Tried to answer him as I remember bulding the same kind of Application.

Helo Vani!

Here is the core module

SlimDirectoryCore.oml

Thank you. Alos, if you can attach sample excel file.

 I will check and see if i can provide you some help :)

Hello Ms. Vani! Here is the sample excel file. The row 1 is valid and the row 2 is not, therefore, the error should be "Invalid Supervisor in Row 2" and the file should not be uploaded because it has errors.

Thank you so much!

ImportFile.xlsx

Hello @RD. 

May be below logic could help -

1) GetEmployeeswithSupervisor roles

2) User listfilter and check if the current user(Supervisor ciolumn value) exists in the list 

3) If listfilter list is empty then user is not having supervisor role else its valid entry.

Please try out and let us know if this helps.

Thanks,

Vani

Probably similar logic to this. 

Great to hear the issue solved :)

Thanks,

Vani

Hi RD,

I updated the .oml file. Please take a look.

Best,

Khuong

SlimDirectory1.oml

Hi again,

Please ignore the above .oml file.

Let use this one instead. I tested and it's working.


SlimDirectory1.oml

Hello Khuong! I tried this one but still not able to validate if the value sin supervisor column in excel to be imported is having a role of supervisor (supervisor role is the Engagement Manager and Delivery Manager).

Hi RD,

Please take a look at this one.

Last time, I though the role name is "Supervisor", if you have many supervisor roles please update this filter condition.

SlimDirectory1.oml

Hello Khuong! Thanks always for your reply. I already did this one, but I don't think its filtering the values in supervisor column. Attached in top is the main and core of the Slim Directory for reference, I mean like for example, I'm going to import an excel file with values in supervisor column "Jack Maximuns", Jack Maximuns role in the Slim Directory is Developer, so the importing should stop and should be an error which shows "Invalid Supervisor", but when I import an excel file whose value in supervisor column is "John Doe" (his role is Engagement Manager), the import should go through and shows "File Uploaded". Each invalid value in supervisor column will stop the importing and shows the message "Invalid Supervisor Found in Row _". Like the validations in the birthday column if you notice in the SlimDirectory1.oml. If there is an invalid value in each column in the excel file, the import should not go through and just shows the message of invalids.

Hi RD,

I updated the code to check supervisor inside the loop. I also added check supervisor if already added into DB. For the import list I added the sort to make sure supervisor will be imported first then other roles go later. For each loop I added commitTransaction to make sure record is added into DB (if you don't want it can remove).

I have added comments too.

Hope this can solve your issue.

Cheers,

Khuong

SlimDirectory1.oml

Thank you so much Khuong! This one is a big help :)

Hi R.D,

TO make it clear, for checking any role or any condition, the record has to exist in the database or if u want to filter it initially while importing from excel, only way is to check if the value is Empty.. list.current.supervisor

Here I have Attached a working Oml and Link

Check for

ImportEmployeesYourScenario in the Server Actions of the Oml and Look for Comments in the flow

Working Link is here.


SlimDirectorySample.oml

Solution

Thank you all guys for taking time in answering my questions, it is all appreciated. I already got what to do in this one.

I have an aggregate GetEmployeesSupervisor and add a filter to show only the employee with supervisor roles, then connect to an IF widget with a condition

GetEmployeesSupervisor.List.Empty

and that's it. Attached is the screenshot of the flow.



Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.