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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Populate dropdown base...
Power Apps
Answered

Populate dropdown based on variable

(0) ShareShare
ReportReport
Posted on by 1,119

Dear All,

 

I am making a Student app. I am using two sharepoint list. Campus and Studentprofile. Campus Sharepoint list, will include the all the campus name. Student Profile list will save all details of students.

 

I am using custom control and not using Edit form option.

I have student ID text control and i placed a Search Button. When i click on Search button, the record as per the student id box will be fetched from studentprofile sharepoint list and displays rest of the student profile details on the screen. 

 

If the student id not found, the user still can key in the rest of the details and save it to profile list.

The campus details are coming from another sharepoint list called "Campus". the dropdown is set with showing the list of campus from the another list.

 

In Search button i have set a variable as Set(varStudent, StudentID = text_studentid.Text)

 

In the Campus drop down box i used a condition as If(IsBlank(varStudent), Distinct(Campus, Name), [varStudent.Campus].Value

 

I want to show if the student id exists, the dropdown should fetch the detail from profile list else it should should the dropdown items from campus list.

 

i am not able to do this. any one please help. attaching screenshots.

 

 

 

Stu_FND.PNG
Stu_Warning.PNG
Stu_NF.PNG
Categories:
  • JR-BejeweledOne Profile Picture
    5,836 Moderator on at

    It looks like there is something wrong with your syntax.

    Try removing the square brackets around your variable and replace them with parens like so:

     

    If(
     IsBlank(varStudent), Distinct(Campus, Name), 
     (varStudent.Campus).Value
    )
  • venka91 Profile Picture
    1,119 on at

    It does not work and showing me error , the function if has invalid arguments

  • Verified answer
    JR-BejeweledOne Profile Picture
    5,836 Moderator on at

    You set your variable to the student ID.    That won't have any additional properties such as Campus.  So you need to pull the value from the student list, something like this.   You might need to adjust the formula

     

     

    If(
     IsBlank(varStudent), Distinct(Campus, Name), 
     (Lookup(studentprofile, text_studentid = varStudent).Campus
    )

     

     

     

  • RandyHayes Profile Picture
    76,299 Super User 2024 Season 1 on at

    @JR-BejeweledOne 

    The schemas of your results are totally dissimilar.  You need to make sure you are supplying the proper schema.

    If(IsBlank(varStudent), 
    
     RenameColumns(Distinct(Campus, Name), "Result", "Campus"), 
    
     Lookup(studentprofile, text_studentid = varStudent).Campus
    )

    I hope this is helpful for you.

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 402 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 328

#3
WarrenBelz Profile Picture

WarrenBelz 296 Most Valuable Professional

Last 30 days Overall leaderboard