Hi, all
i need help, situation is, i have data from REST API, have Group and department. My question is how i want to show all and populate the department based on Group. Sample below i just drag into accodion, but only show 1 data, how to show all. for example
1st accordion Group Market Development have sustainbility department, Shariah Department and etc...
2nd accordion Group Procurement have AV department, Chargeman department etc...
This will definitely work. Let me know if you face any issues.
Thanks,
Sudip
Hi, please follow the below Widget structure to implement the scenario. Let me know if you need OML for this solution.
This might be helpful for you.
sure, if you can share the OML.
Thank you so much
Hey, try the below OML and let me know if you face any difficulty.
This solution can be implemented in different ways.
Thank you for your OML, my current data get from REST API, all attribute in same API, StaffName, Department,Group, etc.
i see your OML not using rest api, get me confuse...im so sorry, im new in outsystem. if you can use get data from rest api so i can learn the process.
Thank you
Hey , can you share the response structure image of your REST API? I will implement based on that.
Thanks
Hey, I have created a small simulation of the API. I am using Product API. So, consider Category as Group and ProductTitle as Department.
my situation is, i have listing all staff with group and department in same API, how i want to make accordion based on Group. when click Group it show department. I have try based on your OML, maybe im new in this area, need to understand 1st. I try again based on your OML.
NO
STAFF NAME
GROUP
DEPARTMENT
1
XXX
S
A
2
D
B
3
XX
C
4
Have you checked the v2 OML?
yes current im try your V2, based on your OML, how you get or create DepartmentList after Name attribute
mine
I have created the below structure. You can check that in v2
Hai, im able to make data appear, but the each group show same department, it should filter by group.
Can you please share the SourceList and Condition that you have used to filter?
As you are seeing all the departments under a group then recheck the below filter condition
If you share any sample OML, I will modify that
i just follow your oml, same name but only different API.
What about the filter condition? Have you changed anything on FilterDepartmentByGroupName ?
now im able to show list department based on group. Thank you very much for your help. But Im facing one problem, the department show based on staff in department. for example have 4 staff in department, it show 4 department same name. how to make group to the department so it not show based on number of staff
Use ListDistinct on DepartmentList and use the output to in ListAppendAllDepartmentByGroup.
like this?
Source should be DepartmentList
if like this, the result still same with previous
Let me understand the problem again.
Your case is like
GroupA
GroupB
and You want to make the result like the below example
Is this correct?
my case is, i have data that show staff name, group and department. This data i get using rest api. my case is, accordion have list of group, when user click accordion, the listing should show department based on what group that user click. As table show, when user click group S, the listing show department A,C and D.
My situation now, the listing repeating based on staff that have in department. for example, when user click group S, the listing show department A,C and D and when have exmpple 5 staff with same department it listing 5 same department instead of just 1 department.
for example that below current listing, for example Trusts & Investment Management have 5 it should show only 1. this happen because in this department have 5 person.
i hope you can understand my situation.
"Use ListDistinct on DepartmentList and use the output to in ListAppendAllDepartmentByGroup. "
@Sudip Pal , listdistinct on his original list won't do a thing, since there is different staff in same department. For listdistinct he needs to first create a helper list without staff information.
Thanks Dorine. I will follow your advice and guide him.
Have you followed these steps?
hi @Sudip Pal this is my implementation. The result still same
Hi @Sudip Pal
it's work!!!!!! Thank you for your help. can you explain about your new implementation, so i can understand more about this implementation.
Let's take an example of one case
Group Department
S D
T B
S C
First, I appended all the groups inside Groups variable. So now, Groups = [S, T, S, S]
As Groups contains duplicates so I have used ListDistinct to get Distinct values
ListDistinct(Groups) = [S, T]
I have assigned Groups = ListDistinct(Groups). So, Groups = [S, T]
Then I am looping Groups and filtering the original API data by the current group name.
Let me explain first iteration -------
FilterDepartmentByGroupName(SourceList: API_Data, Condition: API_Data.GroupName = 'S') = [D, C, D]
We are assigning DepartmentList = [D, C, D]
As DepartmentList contains duplicates then we need to use ListDistinct.
ListDistinct(DepartmentList) = [D, C]
At last, we are appending all the data in GroupWithDepartmentList
ListAppend(List: GroupWithDepartmentList,Element: {Group:'S',Department: [D, C]})
Thank so much for your explaination,
Thank you again for your help. Another thing, with this implementation, if i want to show total number staff in each department and show inside accordion is it possible?
Yes,it is possible
Okay, Thank you