web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / OnStart, Set Variable ...
Power Apps
Unanswered

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

(0) ShareShare
ReportReport
Posted on by 16

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.

Categories:
I have the same question (0)
  • Verified answer
    KrishnaV Profile Picture
    5,023 on at

    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.

     

  • GrahamD Profile Picture
    16 on at

    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

  • GrahamD Profile Picture
    16 on at

    @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

  • Verified answer
    KrishnaV Profile Picture
    5,023 on at

    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.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 793 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 333 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard