cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
BenDonahue
Skilled Sharer
Skilled Sharer

Power apps is not recognizing my column headers

Power apps is not recognizing my column headers in my collection.
On Page1, I have this call:

 

Collect(
    colCovidTeamSavedItems,
    {
        StartTime: varStartTime, StreetAddress: {Value: DataCardValue48.Text}, 
        StreetAddress2:DataCardValue49.Text, City:DataCardValue50.Text, 
        State:DataCardValue2.Text, Zip:DataCardValue3.Text, DoorAnswer: {Value: 
        DataCardValue51.Selected.Value}
});

 

 

 This establishes, among other things, that StartTime is a column header in the collection, colCovidTeamSavedItems. On Page2, where I want to add some data to the same row started on Page2, I am trying to use this code:

 

 

Patch(
    colCovidTeamSavedItems, 
    Filter(
        colCovidTeamSavedItems, StartTime = varStartTime
    ), 
    {
        LanguageIssue: DataCardValue58.Selected.Value, LSSpanish:  LSSpanishCheckbox.Value, 
        LSCreole:  LSCreoleCheckbox.Value, LSMaam:  LSMaamCheckbox.Value, LSOtherMayan:  
        LSOtherMayanCheckbox.Value, LSEnglish: LSEnglishCheckbox.Value,LSOtherLanguage:  
        LSOtherLanguageCheckbox.Value
    }
);

 

 

And I tried it without a Filter(*), but with a simple StartTime = varStartTime:

BenDonahue_0-1606829119914.png

I should note that, when I view my collection, StartTime is listed as a column header:

BenDonahue_0-1606831447397.png

 

It looks to me like StartTime is not being recognized as a column header in my collection, colCovidTeamSavedItems.
Thank you for you help in this.

1 ACCEPTED SOLUTION

Accepted Solutions
timl
Super User III
Super User III

Hi @BenDonahue 

The second argument that you pass to the patch function should refer to a single record.

The filter function returns multiple rows, so this is the cause of the problem.

The way to resolve this would be to use the lookup function, rather than filter. The syntax would look like this:

Patch(
    colCovidTeamSavedItems, 
    Lookup(
        colCovidTeamSavedItems, StartTime = varStartTime
    ), 
    {
        LanguageIssue: DataCardValue58.Selected.Value, LSSpanish:  LSSpanishCheckbox.Value, 
        LSCreole:  LSCreoleCheckbox.Value, LSMaam:  LSMaamCheckbox.Value, LSOtherMayan:  
        LSOtherMayanCheckbox.Value, LSEnglish: LSEnglishCheckbox.Value,LSOtherLanguage:  
        LSOtherLanguageCheckbox.Value
    }
)

View solution in original post

2 REPLIES 2
timl
Super User III
Super User III

Hi @BenDonahue 

The second argument that you pass to the patch function should refer to a single record.

The filter function returns multiple rows, so this is the cause of the problem.

The way to resolve this would be to use the lookup function, rather than filter. The syntax would look like this:

Patch(
    colCovidTeamSavedItems, 
    Lookup(
        colCovidTeamSavedItems, StartTime = varStartTime
    ), 
    {
        LanguageIssue: DataCardValue58.Selected.Value, LSSpanish:  LSSpanishCheckbox.Value, 
        LSCreole:  LSCreoleCheckbox.Value, LSMaam:  LSMaamCheckbox.Value, LSOtherMayan:  
        LSOtherMayanCheckbox.Value, LSEnglish: LSEnglishCheckbox.Value,LSOtherLanguage:  
        LSOtherLanguageCheckbox.Value
    }
)

View solution in original post

BenDonahue
Skilled Sharer
Skilled Sharer

While I had the wrong formula, as @timl  was nice enough to take time to educate me on, implementing timl's fix exposed a second issue: The headers in my collection had not established themselves as headers at this point in the program. So, on Page1 I changed this code:

 

Collect(
    colCovidTeamSavedItems,
        {
            StartTime: varStartTime, StreetAddress: {Value: DataCardValue48.Text}, StreetAddress2:DataCardValue49.Text, City:DataCardValue50.Text, State:DataCardValue2.Text, Zip:DataCardValue3.Text, DoorAnswer: {Value: DataCardValue51.Selected.Value}
        }
    );

 

 

...to this code:

 

Collect(
    colCovidTeamSavedItems,
        {
            StartTime: varStartTime, StreetAddress: {Value: DataCardValue48.Text}, StreetAddress2:DataCardValue49.Text, City:DataCardValue50.Text, State:DataCardValue2.Text, Zip:DataCardValue3.Text, DoorAnswer: {Value: DataCardValue51.Selected.Value}, LanguageIssue:"", WillingToSpeak:"", CovidKnowledge:"", CurrentlyPositive:"", CurrentCOVIDIsolateSafely:"", PreviousCOVIDTestPositive:"", PreviousCOVIDIsolateSafely:"", TwoWeekCOVIDExposure:"", NumExposed:"", QuarantineSafely:"", CurrentConcernsOther:"", IfSickCanIsolate:"", PreExistingCondition:"", HasPCP:"", NumPeoplePreExistingCondition:"", NumAdults:"", NumChildren:"", HelpGrowKnowledge:"", CovidKnowledgeAfterVisit:"", HelpGrowKnowledgeOfResources:"", WillUseResourcesDescribed:"", MinutesSpent:"", CCFoodSecurity: false, CCRent: false, CCHealth: false, CCMeds: false, CCTransportation: false, CCNoConcerns: false, LSSpanish: false, LSCreole: false, LSMaam: false, LSOtherMayan: false, LSOtherLanguage: false, LSEnglish: false, RaceAfricanAmerican: false, RaceWhite: false, RaceNativeAmerican: false, RaceAsian: false, RaceNativeHawaiian: false, RaceOtherPacificIslander: false, RaceDecline: false, EthnicityHispanic: false, EthnicityNotHiospanic: false, EthnicityDecline: false, MatsMasks: false, MatsGloves: false, MatsEdMats: false, MatsFarmPackage: false, MatsNone: false, HPIntroductions: false, HPCOVID19Symptoms: false, HPCOVID19Transmission: false, HPCOVID19InImmokalee: false, HPPrevention: false, HPTesting: false, HPInHouseTestsPositive: false, HPResources: false
        }
    );

 

Which introduces all of my headers in my collection at once at the very beginning.
I just realized that this is much like initializing a variable.

Helpful resources

Announcements
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

Power Query PA Forum 768x460.png

Check it out!

Did you know that you can visit the Power Query Forum in Power BI and now Power Apps

V3_PVA CAmpaign Carousel.png

Community Challenge - Giveaways!

Participate in the Power Virtual Agents Community Challenge

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 (3,116)