crazybake Posted September 8, 2015 Share Posted September 8, 2015 I have a new table named CourseList - a self join table using courseID. Within a layout, I have a portal which is filtered and sorted based on dropdown menus and checkboxes. For example, I can see which courses are assigned to a particular budget for a particular quarter (e.g., in fall 2015, I have (7) courses for budget A, which are taught by (3) instructors). I have also created a duplicate single-row portal to get the record count (or # courses for that qtr). How can I get unique counts for number of teachers from the filtered portal data. For example Smith teaches (4) classes, Jones teaches (2) classes and Wilson teaches (1) class - I need to get a count of (3). Link to comment Share on other sites More sharing options...
laurentades Posted September 9, 2015 Share Posted September 9, 2015 Have you tried using a custom function like this one ? Really helped me out of a pickle lately... Link to comment Share on other sites More sharing options...
eos Posted September 9, 2015 Share Posted September 9, 2015 Try this: • create a value list of CourseList::teacherID• create a summary field in CourseList as sListOfTeacherID• put the summary field into a single-row, filtered portal• assign that field an object name The count of teachers is ValueCount ( FilterValues ( ValueListItems ( "" ; "TeacherIDVL" ) ; GetLayoutObjectAttribute ( "objectNameOfRelatedASummaryField" ; "content" ) ) ) Link to comment Share on other sites More sharing options...
crazybake Posted September 9, 2015 Author Share Posted September 9, 2015 Try this: • create a value list of CourseList::teacherID• create a summary field in CourseList as sListOfTeacherID• put the summary field into a single-row, filtered portal• assign that field an object name The count of teachers is ValueCount ( FilterValues ( ValueListItems ( "" ; "TeacherIDVL" ) ; GetLayoutObjectAttribute ( "objectNameOfRelatedASummaryField" ; "content" ) ) ) I was so close to this initially, and I still cannot get it to function. The portal will show the (11) sections (and the portal count will show 11.) However, when I create the summary field as a list of Teacher IDs, I get duplicate IDs. Sorry - of course duplicates are listed - thus the idea of the filter values. I just cannot get the count to work properly. I changed the info you gave to include get(FileName), instead of "" for the location of the value list and it initially counted correctly. I then realized that changing it back to "" would also update the field and count correctly... so... what I am finding is that the field is not updating when I change the dropdown criteria. I am not storing the results and tried to put a script trigger to commit records, but does not seem to work. Any Ideas? Link to comment Share on other sites More sharing options...
eos Posted September 9, 2015 Share Posted September 9, 2015 If you have a created a calculation field with this formula, make sure it is set to unstored. Link to comment Share on other sites More sharing options...
crazybake Posted September 9, 2015 Author Share Posted September 9, 2015 Thanks eos. I thought I had done so - but I had not. All works well now Link to comment Share on other sites More sharing options...
Recommended Posts
This topic is 3168 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 accountSign in
Already have an account? Sign in here.
Sign In Now