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 / 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.

 

 

 

Categories:
I have the same question (0)
  • 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,297 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

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 765 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 343 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 272

Last 30 days Overall leaderboard