Jump to content
Server Maintenance This Week. ×

Conditional List Function


aguest

This topic is 3277 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Hi,

 

I've got the attached script which takes the users account name and and then based on the relationshihps returns their staffID, DeptID and then a list of staff members in that dept.

This code brings back all employees in that staff table related to that department, irrespective of whether they are Active or Leaver.

How do I amend this script / relationship to return only Active members of staff?

TIA

loginScript.png

Relationships.png

Link to comment
Share on other sites

You could add another relationship that uses a constant to constrain the related set, but the easiest solution is probably to create a calculation field = Case ( status = "Active" ; ID ) and List() that.

Or look into creating a query via ExecuteSQL().

Link to comment
Share on other sites

What is the purpose of this exercise? If the list of employees is (or can be made) available through relationships, why do you need a script? Or to put it another way: if you're using a script, you should not need to add any more relationships for this purpose. The script should be able to get the required list through finds and/or GTRR, using the existing core relationships only.

Edited by comment
Link to comment
Share on other sites

Thank you both for the responses.

In answer, the reason for this is the Heads of dept can only see the staff members attached to that department. From the home layout, they click on a staff button which takes them to the staff list layout displaying only those staff members in the department. The script is doing this perfectly for me.

However, at the moment it is also showing Leavers as well as Active staff members in this list and I don't want it to.

Eos I have got that constant field already set up in my School Database table  (zg_Constant_Active) but I'm struggling to figure out how to add it into the relationship i've created.

Any help is greatly appreciated.

TIA

Link to comment
Share on other sites

This topic is 3277 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.