cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
nliu
Helper II
Helper II

Switch function

Hello,

 

I would like to use a switch function in my datasource property in my form. But it seems like the form is not connected to any of my SP List. Do you know why and how can I fix it ?

 

Note : all my SP List has the same columns/structure

 

Thank you, 

 

Switch.jpg

 

1 ACCEPTED SOLUTION

Accepted Solutions
WarrenBelz
Super User
Super User

Hi @nliu ,

Your syntax looks OK, but I cannot check the validity of your Variable.

I just did a quick test using the same logic and got the same result as you until the Variable was set to one of the choices.

Once I did that, all was well.

Note that in Design mode, Variables quite often reset.

Try putting a label the the variable, set it and then check if it is one of your choices.

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

 

View solution in original post

5 REPLIES 5
WarrenBelz
Super User
Super User

Hi @nliu ,

Your syntax looks OK, but I cannot check the validity of your Variable.

I just did a quick test using the same logic and got the same result as you until the Variable was set to one of the choices.

Once I did that, all was well.

Note that in Design mode, Variables quite often reset.

Try putting a label the the variable, set it and then check if it is one of your choices.

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

 

eka24
Super User
Super User

Insert a dropdown and put in the items property:

["DT","DTECA","DTECE"] Add all other list of items you have.
 
Then in the Datasource of the form :
Switch(Dropdown5.SelectedText.Value,
"DTECA",ZA_Hardard_List,
"DT", ZA_Cost)
 
Change ZA_Hardard_List,ZA_Cost to your datasoucrces. Also add all other datasources.
 

If you like this reply, please give kudos. And if this solves your problem,
please accept this reply as the solution.

 

 

@eka24 @WarrenBelz 

 

Thank you both for your answers, here a screen where my variable "myTarget" is set :

 

Set(myTarget; "DTEXXX") is set on each button. But yes I try to click on one of this button and the form appears and the data was connected to right datasource. So as long as you don't choose on which datasource you are working with, the data will no longer be connected to the form.

 

Menu.jpg

Hi @nliu ,

Are you saying it is working as designed or do you have another question?

 

If working, please consider accepting either or both of the proposed solutions.

Yes it is working as designed 🙂

Helpful resources

Announcements
Power Apps Africa Challenge 2022

Power Apps Africa Challenge

Your chance to join an engaging competition of Power Platform enthusiasts.

Super User 2 - 2022 Congratulations

Welcome Super Users

The Super User program for 2022 - Season 2 has kicked off!

September Events 2022

Check out all of these events

Attend in person or online, there are incredible conferences and events happening all throughout the month of September.

Government Carousel

New forum: GCC, GCCH, DoD - Federal App Makers (FAM)

In response to the unique and evolving requirements of the United States public sector, Microsoft has created Power Apps US Government.

Users online (2,027)