cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
ejules
Advocate I
Advocate I

How to set a pre-populated default value of a Dropdown in EditScreen for a SharePoint Choice field?

Hi Everybody,

 

I'm currently trying to simply set the Default value of a Dropdown in an Edit Form (Form is opened and the Dropdown should have a pre-selection). Even though I did extensive research I couldn't find a solution for a Sharepoint choice field (as I don't know how to find the ID's of those choices and how to reference it?

I have the DropDown with the Selections from Sharepoint ("Inland", "Ausland") and would like to be the Default for a blank form to be "Inland".

  PowerApps1.JPGPowerApps2.JPG

 

Thank you so much for your help.

 

Regards,

ejules

76 REPLIES 76

Good news @vwyankee 
I had another go with your code today and it worked. The only think I can think of that I did differently was that previously I still had the old code at the bottom of OnStart. I didn't think this would affect it as it had different variable names.

Anyway, I'm back on track now.

Awesome, @GraemeNZ

Perhaps there wasn't a semi-colon to separate the previous code you had below it. Regardless, glad to hear it is working and it's not some MS super mysterious anomaly why it doesn't work for you but does anyone else. Those will come up. 😂

Hi @vwyankee 

I feel like I'm nearly there. Can you please help with one more thing? I want to slightly change your recommendation for the visibility of a datacard in FormMode.New based on whether the current user is a customer. In plain speak I want - If (Form Mode is new and if gvCustomer is not blank), then visible, else hidden)

On the Visible property I've tried this but it doesn't like it.
If(FormMfrEntry.Mode=FormMode.New && If(!IsBlank(gvCustomer),true,false))

Did I just solve it by removing that second If?
If(FormMfrEntry.Mode=FormMode.New && !IsBlank(gvCustomer),true,false)

You've got an unneeded if statement. Just make it:
If(FormMfrEntry.Mode=FormMode.New && !IsBlank(gvCustomer),true,false)

Haha - Looks like we both posted at the same time. Yes, that should be all it was.

@vwyankee You helped previously with adding a search box and a sort ascending/descending button on a gallery. How do I combine this with the functionality that if gvCurrentUser = "FIW Approver" then all items should be shown, but otherwise only the gvCustomer values should be shown?

@GraemeNZ - I didn't help with the search and sort, but you can combine them with the condition on what to show like this - note, I condensed the statement so the condition on what to filter is within one SortByColumns statement instead of having them split out into two full statements. I also added in some comments to help clarify what's happening.

 

//If current user is approver show all, else filter by gvCustomer
SortByColumns(
    Search(
        If(
            gvCurrentUser = "FIW Approver",
            'testManufacturers List',
            Filter(
                'testManufacturers List',
                Customer.Value = gvCustomer
            )
        ),
        //search from text input box on Title column
        tiSearchBox.Text,
        "Title"
    ),
    //sort by Title column
    "Title",
    //sort order
    If(
        SortDescending,
        Descending,
        Ascending
    )
)

 

If you want to have a sort for each column in your gallery you can do that with a variable as well. @WonderLaura does a great job with the step by step in this video from one of her Power Hour sessions that you can incorporate.

Thanks @vwyankee that worked just fine when I replaced the name of the search box with the name in my app.

Thanks also for the post to @WonderLaura - it turns out I've been watching that video to learn how to filter my gallery, and I've watched a few of her other very helpful videos also. Thanks Laura!

Hi @vwyankee - related to this is a Flow issue I'm having. I don't know how familiar you are with Flow, but I'd be interested in any insight you have. See: https://powerusers.microsoft.com/t5/Building-Flows/Check-if-a-date-is-blank-in-SharePoint-list/m-p/1... 

Helpful resources

Announcements
Power Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

Microsoft 365 Conference – December 6-8, 2022

Microsoft 365 Conference – December 6-8, 2022

Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Top Kudoed Authors
Users online (2,631)