cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
GrahamD
Regular Visitor

OnStart, Set Variable for user based on lookup across 2 SharePoint list

I have 3 SharePoint lists. And would like to use a combo box to present a list of equipment. Struggling to set a variable OnStart And having no luck .

 

1st SP list has equipment by # for all depatments, and another column with the department name, that the equipment belongs

2nd SP list had People, With a column for employee ID, and a column for the department name, that the people belong.

3rd SP list has O365 User info with employee ID.

 

In the combobox on the 1st screen, The user should should only be presented with the equipment from their department. On the ComboBox, I will use a filter with the varUserDepartment to filter list1. 

 

Please help.

2 ACCEPTED SOLUTIONS

Accepted Solutions
KrishnaV
Super User III
Super User III

Hi @GrahamD ,

 

Please add this code onStart of the APP:

ClearCollect(collDepartments,Filter(SpLst2,employeedID=Office365Users.MyProfileV2().id))
Forall(collDepartments,
Clearcollect(collEquipments,Filter(SPList1,departmentlist1column=departmentincollectioncolumn))

Now for the combo box:

distinct(collEquipments.Equipmentnumber)


I hope this resolved your issue if you see any challenge/need further help please let me know I am always happy to do it for my community.

Regards,
Krishna
If this post helps you give a 👍 and if it solved your issue consider Accept it as the solution to help the other members find it more.

 


I hope this resolved your issue if you see any challenge/need further help please let me know I am always happy to do it for my community.

Regards,
KrishnaV
Business Applications MVP, Microsoft Certified Trainer
Twitter | Linkedin | YouTube | GitHub
If this post helps you give a and if it solved your issue consider Accept it as the solution to help the other members / new members of the community.

View solution in original post

Hi @GrahamD ,

 

on App Start:

Set(varEmpID,LookUp(List3,O365Email=varUser.Email).EmployeeID2);
Set(varDepName,LookUp(List2,EmployeeID = varEmpID).Department);

For combo box, Items:

Distinct(Filter(List1,Department = varDepName).'Admin#','Admin#').Result


I hope this resolved your issue if you see any challenge/need further help please let me know I am always happy to do it for my community.

Regards,
Krishna
If this post helps you give a 👍 and if it solved your issue consider Accept it as the solution to help the other members find it more.


I hope this resolved your issue if you see any challenge/need further help please let me know I am always happy to do it for my community.

Regards,
KrishnaV
Business Applications MVP, Microsoft Certified Trainer
Twitter | Linkedin | YouTube | GitHub
If this post helps you give a and if it solved your issue consider Accept it as the solution to help the other members / new members of the community.

View solution in original post

4 REPLIES 4
KrishnaV
Super User III
Super User III

Hi @GrahamD ,

 

Please add this code onStart of the APP:

ClearCollect(collDepartments,Filter(SpLst2,employeedID=Office365Users.MyProfileV2().id))
Forall(collDepartments,
Clearcollect(collEquipments,Filter(SPList1,departmentlist1column=departmentincollectioncolumn))

Now for the combo box:

distinct(collEquipments.Equipmentnumber)


I hope this resolved your issue if you see any challenge/need further help please let me know I am always happy to do it for my community.

Regards,
Krishna
If this post helps you give a 👍 and if it solved your issue consider Accept it as the solution to help the other members find it more.

 


I hope this resolved your issue if you see any challenge/need further help please let me know I am always happy to do it for my community.

Regards,
KrishnaV
Business Applications MVP, Microsoft Certified Trainer
Twitter | Linkedin | YouTube | GitHub
If this post helps you give a and if it solved your issue consider Accept it as the solution to help the other members / new members of the community.

View solution in original post

ClearCollect(collDepartments,Filter(List2,employeedID=Office365Users.MyProfileV2().id))

Forall(collDepartments,

Clearcollect(collEquipments,Filter(List1,departmentlist1column=departmentincollectioncolumn))

 

I'm having no luck. I wasn't working with collections prior to this. I don't find that any collections are created. Errors in the underlined portion.

 

Thank you for your help

@KrishnaVbefore trying Collect, I was using Set Variable. And then was attempting to set a filter on the Combo Box to filter the List1 by varUserDepartment. I thought this would be best to do on start because list1 is more than 10,000 rows long. 

 

Set(varUserDepartmentUIC,List2.Department=LookUp(List2.Department=LookUp(List3.UserEmail=User().Email).EmployeeID).Department)

 

No luck and errors here also

 

 

Thanks, 

Graham

Hi @GrahamD ,

 

on App Start:

Set(varEmpID,LookUp(List3,O365Email=varUser.Email).EmployeeID2);
Set(varDepName,LookUp(List2,EmployeeID = varEmpID).Department);

For combo box, Items:

Distinct(Filter(List1,Department = varDepName).'Admin#','Admin#').Result


I hope this resolved your issue if you see any challenge/need further help please let me know I am always happy to do it for my community.

Regards,
Krishna
If this post helps you give a 👍 and if it solved your issue consider Accept it as the solution to help the other members find it more.


I hope this resolved your issue if you see any challenge/need further help please let me know I am always happy to do it for my community.

Regards,
KrishnaV
Business Applications MVP, Microsoft Certified Trainer
Twitter | Linkedin | YouTube | GitHub
If this post helps you give a and if it solved your issue consider Accept it as the solution to help the other members / new members of the community.

View solution in original post

Helpful resources

Announcements
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

secondImage

Demo Extravaganza Winner Announcement

Please join us on Wednesday, July 21st at 8a PDT. We will be announcing the Winners of the Demo Extravaganza!

V3_PVA CAmpaign Carousel.png

Community Challenge - Giveaways!

Participate in the Power Virtual Agents Community Challenge

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Top Solution Authors
Top Kudoed Authors
Users online (2,003)