cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Altontait
Regular Visitor

Display values from dropdown

Hi Guys: I'm new at this and I would really appreciate any help.

 

I'm trying to create this app to display the distance between two locations. I have everything stored in a list called mileage_distance please see a snap of my list below.

Milage Distance.png

I created two dropdown boxes for the user to select From their current location To their final Location. Please see the snap below

Altontait_0-1626371433395.png

When the user selects From and To, The value associated with those two locations should display in the "Value should display here" text box.  For Example, I selected From Board Office To ALP therefore the value 3.3 should display in the "Value should display here" text box.

 

Thanks for your help in advance.

 

7 REPLIES 7
Krishna_R
Resolver IV
Resolver IV

Hi @Altontait ,

try this in your label value

Lookup(mileage_distance, Title = dropdown1.selected.value, dropdown2.selected.value).dropdown2.selected.value

GarethPrisk
Resident Rockstar
Resident Rockstar

Not sure how often your locations will change, but I recommend you refactor your data. Otherwise you'll always be adding columns to account for locations, and rows.

Instead:

  • From Location
  • To Location
  • Distance

This way, you would be simply filtering (as a Lookup) the list based on the drop down values.

If you added a new location, it would simply be a case of adding the rows for that new location relative to the existing locations, instead of also having to add columns and update the app.

Data first!

Hi @Krishna_R 

I'll let u know if this works in a bit, I'm away from my computer rn. 

 

Hi @GarethPrisk 

I'll look into this but the location and the distance will always be the same. The list of FROM locations is the same as the list of TO location. 

 

GarethPrisk
Resident Rockstar
Resident Rockstar

Correct.

Add a list of Locations, and have the TO and FROM be lookups to that same list.

You'd always have the same distance regardless of X being the TO, and Y being the FROM, or vice-versa.

That way, you just need a single record to represent the relative distance. Alternatively, you could define the relationship from both ways but that effectively duplicates data.

Your Drop Down could reference the list and you'd simply LookUp to find the row where that combo was found defined from either direction.

Hi @Krishna_R 

I can't seem to get this working. Im not sure if it's because I'm using the ShowColumns function to display the columns in my text box. 

ShowColumns(
mileage_distance,
"Title",
"Board Office",
"6 Mile",
"Alexis Park",
"ALP",
"Beairsto",
"BX",
"Charles Bloom",
"Cherryville",
"Clarence Fulton",
"Coldstream",
"Ellison",
"Harwood",
"Hillview",
"JW Inglis",
"Kalamalka",
"Kelowna Airport",
"Kidston",
"Lavington",
"Mission Hill",
"OK College",
"Okanagan Landing",
"Open Door",
"UBCO",
"Vernon",
"vLearn"
)

I attached the milage distance list just in case you would like to take a look at it

Hi @GarethPrisk 

I was thinking about your solution, and I'm not sure if rearranging the list is the best option because it's a lot of data that won't be changing and im just looking for a simple solution that can work with my current data. This is hard for me to figure out because i am just learning PowerAps

 

I attached the excel document below, please review it and let me know if you have a solution that can work with my data.

Helpful resources

Announcements
PA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

secondImage

Power Apps Community Call

Please join us on Wednesday, October 20th, at 8a PDT. Come and learn from our amazing speakers!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Welcome Super Users.jpg

Super User Season 2

Congratulations, the new Super User Season 2 for 2021 has started!

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Top Solution Authors
Top Kudoed Authors
Users online (1,964)