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
Community Champion
Community Champion

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

KrishnaV
Community Champion
Community Champion

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
Community Champion
Community Champion

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.

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

KrishnaV
Community Champion
Community Champion

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.

Helpful resources

Announcements
Power Platform Call June 2022 768x460.png

Power Platform Community Call

Join us for the next call on August 17, 2022 at 8am PDT.

Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

Users online (1,813)