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

Patching dropdown value from collection

Hi,

 

I'm having a problem with the value of my dropdown not being passed correctly to my collection.

 

I have a gallery that gets its items from my 'Template' table. Each 'template' contains some values that need to be passed to a new 'Checklist Item' along with user input. One of these inputs is a dropdown. 

 

Mikkiel_0-1594907152067.png

 

I'm not allowed to actually create any records unless everything is filled in, so my save button should collect everything from the gallery and then use patch to create new records.

 

This is the code that runs when I press save.

 

Patch(
    Inspectierapporten,
    Defaults(Inspectierapporten),
    {
        Project: SelectedProject,
        Categorie: SelectedCat
    }
);
Clear(ItemsToSubmit);
ForAll(
    NewReportItems.AllItems,
    Collect(
        ItemsToSubmit,
        {
            Rapport: Last(Inspectierapporten),
            Categorie: SelectedCat,
            Naam: ItemName.Text,
            Inspectieresultaat: [@ConclusionDropdown],
            Template: SelectedCat.Template
        }
    )
);
ForAll(
    ItemsToSubmit,
    Patch(
        'Inspectie onderdelen',
        Defaults('Inspectie onderdelen'),
        {
            Rapport: Rapport,
            Categorie: Categorie,
            Inspectieresultaat: Inspectieresultaat,
            Naam: Naam
        }
    )
)

 

 

Now this works for what I need, only the dropdown value is never passed. I'm sure its got something to do with how I save the dropdown in the collection, but I can't seem to figure it out on my own.

 

I've got two problems with the dropdown:

 

1). I have a custom option set, but cannot seem to populate the dropdown with the set unless I use this code as ThisItem does not refer to the entity that actually contains the option set field.

 

[
    [@Conclusie].'Niet geïnspecteerd',
    [@Conclusie].Goedgekeurd,
    [@Conclusie].Gebrek,
    [@Conclusie].Afgekeurd,
    [@Conclusie].'Niet van toepassing',
    [@Conclusie].'In backlog'
]

 

 

2). Passing the value to the collection and then successfully patching it to the CDS, which may be a direct result of 1)

 

 

I'm sure my code might make some people cringe when they read it, but I'm only just starting with powerapps and CDS in general and I'm very aware it's not elegant at all.

 

Thanks in advance,

 

M-

1 ACCEPTED SOLUTION

Accepted Solutions
Frequent Visitor

Absolutely bloody typical I'd struggle a day, make a post only to figure it out shortly after.

 

Turns out I was an idiot.

 

I needed to pass the ConclusionDropdown.Selected instead of the entire dropdown, and then patch the InspectieResultaatCol.Value. In hindsight, probably should've figured that out sooner.

View solution in original post

1 REPLY 1
Frequent Visitor

Absolutely bloody typical I'd struggle a day, make a post only to figure it out shortly after.

 

Turns out I was an idiot.

 

I needed to pass the ConclusionDropdown.Selected instead of the entire dropdown, and then patch the InspectieResultaatCol.Value. In hindsight, probably should've figured that out sooner.

View solution in original post

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

News & Announcements

Community Blog

Stay up tp date on the latest blogs and activities in the community News & Announcements.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Community Highlights

Community Highlights

Check out the Power Platform Community Highlights

Top Solution Authors
Top Kudoed Authors
Users online (10,180)