Hello
I created one form and during the edit screen, I wanted to show the previously selected value from the dropdown. How to do that? because, whenever i go to edit form it again shows the default(first) value.
For Example:
Like I have the following values in dropdown:
1
2
3
So after selecting 2 form it. it should show 2 on edit screen. But, it shows 1
How to do that??
Solved! Go to Solution.
That is what the example I gave you does.
If(Form1.Mode = FormMode.New, "Neutral", galResults.Selected.Impact)
The blue part checks to see if you have the form open as a brand new form for which you have not selected a value.
The gray part sets the value to "Neutral" if the blue part was true (it is the first time so I want the user to see "Neutral").
The RED part sets to value to what you selected the first time to made a choice, with galResults being my gallery and Impact being the name of my column.
To adapt for your Location field, substitute the name of your form for Form1.
If you are using a gallery, substitute the name of the gallery that contains the Location field for galResults.
Then use Location in place of Impact which was my field name.
Without more specifics about where the field is located and if it is in a gallery, I can't give you a more specific guidance. If you aren't able to get it from here, post a screenshot of the same pieces I did from your app.
First, the "Neutral" was specific to my example. Yours may be "-- Select -- " or something else.
Second, I notice you are using Location Name in the Items property (which I belive is the words like Field). However, you are using LocationID in your two default fields because I'm guessing you are storing only the LocationID in your saved record. So, you make have to do a Lookup in order to get the name instead of the ID. The fact that you are currently using ID is likely causing it to not find a match and default back to Select.
Depending on how often this will occur, it may be the most efficient to store the location name and ids in a collection and use it for both your Items property and for the lookup. But if you just want to do the lookup on the SQL table, try using this for the dropdown default:
If(EditForm1.Mode = FormMode.New, "-- Select --",
Lookup('dbo].[Locations]', LocationId = ThisItem.LocationId).Name)
and this for the Card default:
Lookup('dbo].[Locations]', LocationId = ThisItem.LocationId).Name
Make sure your default values are set correctly. See the example below, paying particular attention to the highlighted properties. If your dropdown default is set to "1" (which is the initial default) it will cause the first value to always be shown. Assuming you are using the same form for add and edit, you need to test the form mode to determine whether to display the existing or show them a specific value to start.
i wanted to show in drop down value.
Like the screenshots
Like i selected Field in Location while creating for first time. Now during edit it shows select in the dropdown. I want to get Field instead of select.
That is what the example I gave you does.
If(Form1.Mode = FormMode.New, "Neutral", galResults.Selected.Impact)
The blue part checks to see if you have the form open as a brand new form for which you have not selected a value.
The gray part sets the value to "Neutral" if the blue part was true (it is the first time so I want the user to see "Neutral").
The RED part sets to value to what you selected the first time to made a choice, with galResults being my gallery and Impact being the name of my column.
To adapt for your Location field, substitute the name of your form for Form1.
If you are using a gallery, substitute the name of the gallery that contains the Location field for galResults.
Then use Location in place of Impact which was my field name.
Without more specifics about where the field is located and if it is in a gallery, I can't give you a more specific guidance. If you aren't able to get it from here, post a screenshot of the same pieces I did from your app.
I tried your expression. But, still no luck.
My expression:
If(EditForm1.Mode = FormMode.New, "Neutral", BrowseGallery1.Selected.LocationId)
It still shows select and i am using SQL database for the tables.
Please post a screen shot of the data card and the dropdown for the location column including the same fields I included in my screenshot so I can help you further.
First, the "Neutral" was specific to my example. Yours may be "-- Select -- " or something else.
Second, I notice you are using Location Name in the Items property (which I belive is the words like Field). However, you are using LocationID in your two default fields because I'm guessing you are storing only the LocationID in your saved record. So, you make have to do a Lookup in order to get the name instead of the ID. The fact that you are currently using ID is likely causing it to not find a match and default back to Select.
Depending on how often this will occur, it may be the most efficient to store the location name and ids in a collection and use it for both your Items property and for the lookup. But if you just want to do the lookup on the SQL table, try using this for the dropdown default:
If(EditForm1.Mode = FormMode.New, "-- Select --",
Lookup('dbo].[Locations]', LocationId = ThisItem.LocationId).Name)
and this for the Card default:
Lookup('dbo].[Locations]', LocationId = ThisItem.LocationId).Name
User | Count |
---|---|
252 | |
107 | |
88 | |
51 | |
44 |