cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
venka91
Helper IV
Helper IV

Populate dropdown based on variable

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.

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
JR-BejeweledOne
Super User
Super User

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
)

 

 

 



If you like this post, give it a Thumbs up. If it answered your question, Mark it as a Solution to enable other users find it.

View solution in original post

4 REPLIES 4
JR-BejeweledOne
Super User
Super User

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
)


If you like this post, give it a Thumbs up. If it answered your question, Mark it as a Solution to enable other users find it.

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

JR-BejeweledOne
Super User
Super User

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
)

 

 

 



If you like this post, give it a Thumbs up. If it answered your question, Mark it as a Solution to enable other users find it.

View solution in original post

RandyHayes
Super User III
Super User III

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

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too!

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

MBAS Attendee Badge

Claim Your Badge & Digital Swag!

Check out how to claim yours today!

secondImage

Are Your Ready?

Test your skills now with the Cloud Skill Challenge.

Top Solution Authors
Top Kudoed Authors
Users online (41,769)