Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Apps - Building Power Apps
Unanswered

Unable to fetch data correctly in collection

(0) ShareShare
ReportReport
Posted on by
Hello Experts,
 
I am unable to fetch data (one filed data) when callinga collection. It only happens when I click on a button that adds a row to the table and the nwhen I save the table it just takes data for that one colmn as blank and gets every other column perfectly. Please help me understand what is going wrong here. Here is the code for the plus button on the App:
 
//Collect(colRateCardInfoNew,{Units:0,internal:0,isExternal:0,OpexInt:0,Capex:0,RunPA:0,Remarks:"",dwcit_rowrder:""});
If(
    CountRows(
        Filter(
            'WebITCM RateCards Infos',
            'CS ID'.'CS ID' = cockpitsublevel.'CS ID'
        )
    ) <> galddsRateCard.AllItemsCount,
    UpdateContext({varPleaseWait: true});
    ForAll(
        galddsRateCard.AllItems As X,
        If(
            IsBlank(X.'RI ID'),
            Patch(
                'WebITCM RateCards Infos',
                Defaults('WebITCM RateCards Infos'),
                {
                    'Need Resouce': If(
                        "true" in X.tglddsRCIDtls.Value,
                        'Need Resouce (WebITCM RateCards Infos)'.Yes,
                        'Need Resouce (WebITCM RateCards Infos)'.No
                    ),
                    Domain: cockpitsublevel.'IT Domain',
                    SubDomain: cockpitsublevel.'IT SubDomain',
                    Product: cockpitsublevel.'IT Product',
                    'Category Counting': X.cbddsRCIDtls1.Selected.Value,
                    CeItem: X.ddlddsRCIDtls5.Selected.CeItem,
                    'Default Resource': X. ddlddsRCIDtls1.Selected.Value,
                    'Target Currency': X.ddlddsRCIDtls3.Selected.dwcit_targetcurrency,
                    Capitalizable: If(
                        X. ddlddsRCIDtls2.Selected.Value = "Yes",
                        'Capitalizable (WebITCM RateCards Infos)'.Yes,
                        'Capitalizable (WebITCM RateCards Infos)'.No
                    ),
                    'Unit Price Build': Coalesce(
                        Value(
                            Left(
                                X.lblddsRCIDtls2.Text,
                                Find(
                                    "/",
                                    X.lblddsRCIDtls2.Text
                                ) - 1
                            )
                        ),
                        0
                    ),
                    'Unit Price Run': Coalesce(
                        Value(
                            Right(
                                X.lblddsRCIDtls2.Text,
                                Len(X.lblddsRCIDtls2.Text) - Find(
                                    "/",
                                    X.lblddsRCIDtls2.Text
                                )
                            )
                        ),
                        0
                    ),
                    UnitsD: Value(X.txtddsRCIDtls1.Text),
                    Internal: Value(X.lblddsRCIDtls3t.Text),
                    External: Value(X.lblddsRCIDtls4t.Text),
                    OpexInt: Value(X.ddlddsRCIDtls3.Selected.dwcit_ceopexint),
                    Capex: Value(X.ddlddsRCIDtls3.Selected.dwcit_cecapex),
                    RunPA: Value(X.ddlddsRCIDtls3.Selected.dwcit_cerunpa),
                    OpexInc: Value(X.ddlddsRCIDtls3.Selected.dwcit_ceopexinc),
                    'Cost p.a': Round(
                        Text(
                            (Value(X.lblddsRCIDtls5t.Text + X.lblddsRCIDtls6t.Text) / If(
                                Or(
                                    IsBlank(Value(DataCardValue15_1.Text)),
                                    Value(DataCardValue15_1.Text) = 0
                                ),
                                1,
                                Value(DataCardValue15_1.Text) / 12
                            )) + Value(X.lblddsRCIDtls7t.Text),
                            "#,###0.##0"
                        ),
                        2
                    ),
                    OpexIntDC: Value(X.lblddsDTOpex.Text),
                    CapexDC: Value(X.lblddsDTCapex.Text),
                    RunPADC: Value(X.lblDTRunPA.Text),
                    CostPaDC: Value(X.lblddsCostPa.Text),
                    RowOrder: Value(X.txtddsOrder.Text),
                    'Asset Category': X.lblddsRCIDtlsAC.Text,
                    Remarks: X.txtddsRCIDtls2.Text,
                    'Owning Business Unit': LookUp(
                        'Business Units',
                        Name = comddsHeader.Country
                    ),
                    'CS ID': LookUp(
                        'WebITCM Cockpit SubLevels',
                        'CS ID' = cockpitsublevel.'CS ID'
                    ),
                    'CSCockpit Version Code': LookUp(
                        'WebITCM Cockpits',
                        'Cockpit Version Code' = varCockpitItem.cockpitversioncode
                    ),
                    'RIProject ID': LookUp(
                        'WebITCM Projects',
                        Code = varCockpitItem.projectcode
                    ),
                    'User Depending': If(
                        "Yes" in X.lblddsRCIDtls5t_UserDepending.Text,
                        'User Depending (WebITCM RateCards Infos)'.Yes,
                        'User Depending (WebITCM RateCards Infos)'.No
                    )
                }
            ),
            Patch(
                'WebITCM RateCards Infos',
                LookUp(
                    'WebITCM RateCards Infos',
                    'RI ID' = X.'RI ID'
                ),
                {
                    'Need Resouce': If(
                        "true" in X.tglddsRCIDtls.Value,
                        'Need Resouce (WebITCM RateCards Infos)'.Yes,
                        'Need Resouce (WebITCM RateCards Infos)'.No
                    ),
                    Domain: cockpitsublevel.'IT Domain',
                    SubDomain: cockpitsublevel.'IT SubDomain',
                    Product: cockpitsublevel.'IT Product',
                    'Category Counting': X.cbddsRCIDtls1.Selected.Value,
                    CeItem: X.lblddsRCIDtls1.Text,
                    'Default Resource': X.ddlddsRCIDtls1.Selected.Value,
                    'Target Currency': X.ddlddsRCIDtls3.Selected.dwcit_targetcurrency,
                    Capitalizable: If(
                        X.ddlddsRCIDtls2.Selected.Value = "Yes",
                        'Capitalizable (WebITCM RateCards Infos)'.Yes,
                        'Capitalizable (WebITCM RateCards Infos)'.No
                    ),
                    'Unit Price Build': Coalesce(
                        Value(
                            Left(
                                X.lblddsRCIDtls2.Text,
                                Find(
                                    "/",
                                    X.lblddsRCIDtls2.Text
                                ) - 1
                            )
                        ),
                        0
                    ),
                    'Unit Price Run': Coalesce(
                        Value(
                            Right(
                                X.lblddsRCIDtls2.Text,
                                Len(X.lblddsRCIDtls2.Text) - Find(
                                    "/",
                                    X.lblddsRCIDtls2.Text
                                )
                            )
                        ),
                        0
                    ),
                    'Asset Category': X.lblddsRCIDtlsAC.Text,
                    UnitsD: Value(X.txtddsRCIDtls1.Text),
                    Internal: Value(X.lblddsRCIDtls3t.Text),
                    External: Value(X.lblddsRCIDtls4t.Text),
                    OpexInt: Value(X.ddlddsRCIDtls3.Selected.dwcit_ceopexint),
                    Capex: Value(X.ddlddsRCIDtls3.Selected.dwcit_cecapex),
                    RunPA: Value(X.ddlddsRCIDtls3.Selected.dwcit_cerunpa),
                    OpexInc: Value(X.ddlddsRCIDtls3.Selected.dwcit_ceopexinc),
                    'Cost p.a': Round(
                        Text(
                            (Value(X.lblddsRCIDtls5t.Text + lblddsRCIDtls6t.Text) / If(
                                Or(
                                    IsBlank(Value(DataCardValue15_1.Text)),
                                    Value(DataCardValue15_1.Text) = 0
                                ),
                                1,
                                Value(DataCardValue15_1.Text) / 12
                            )) + Value(X.lblddsRCIDtls7t.Text),
                            "#,###0.##0"
                        ),
                        2
                    ),
                    OpexIntDC: Value(X.lblddsDTOpex.Text),
                    CapexDC: Value(X.lblddsDTCapex.Text),
                    RunPADC: Value(X.lblDTRunPA.Text),
                    CostPaDC: Value(X.lblddsCostPa.Text),
                    RowOrder: Value(X.txtddsOrder.Text),
                    Remarks: X.txtddsRCIDtls2.Text,
                    'Owning Business Unit': LookUp(
                        'Business Units',
                        Name = comddsHeader.Country
                    ),
                    'CS ID': LookUp(
                        'WebITCM Cockpit SubLevels',
                        'CS ID' = cockpitsublevel.'CS ID'
                    ),
                    'CSCockpit Version Code': LookUp(
                        'WebITCM Cockpits',
                        'Cockpit Version Code' = varCockpitItem.cockpitversioncode
                    ),
                    'RIProject ID': LookUp(
                        'WebITCM Projects',
                        Code = varCockpitItem.projectcode
                    ),
                    Default: If(
                        "Yes" in X.Default,
                        'Default (WebITCM RateCards Infos)'.Yes,
                        'Default (WebITCM RateCards Infos)'.No
                    ),
                    'User Depending': If(
                        "Yes" in X.lblddsRCIDtls5t_UserDepending.Text,
                        'User Depending (WebITCM RateCards Infos)'.Yes,
                        'User Depending (WebITCM RateCards Infos)'.No
                    )
                }
            )
        )
    );
    UpdateContext({varPleaseWait: false});
    Refresh('WebITCM RateCards Infos');
    ClearCollect(
        colRateCardInfoNew,
        Filter(
            'WebITCM RateCards Infos',
            'CS ID'.'CS ID' = cockpitsublevel.'CS ID'
        )
    );
    Collect(
        colRateCardInfoNew,
        {RowNo: galddsRateCard.AllItemsCount + 1}
    ),
    Collect(
        colRateCardInfoNew,
        {RowNo: galddsRateCard.AllItemsCount + 1}
    )
)
 
 
 
Am trying to get "Asset Category" correctly in the table but every time it fetches just blank data. Please ask me more questions if the data is not sufficient
  • Suggested answer
    Michael E. Gernaey Profile Picture
    41,385 Super User 2025 Season 1 on at
    Unable to fetch data correctly in collection
    Hi,
     
    I am not sure what you mean when you say Table. A picture if worth a 1000 words.
     
    Are you saying when you populate your Collection, which you use for your Table, the column is blank?
     
    Have you validated that the Collection itself, whether it is blank or not. I'm not asking you if you think your code is populating it, I am asking if you actually looked at the Collection, while your code is running and validating if it is or not.
     
    Is Asset Category a string or a Choice?
    Is the back end Dataverse or SharePoint?
     
    To me, my guess is
     
    1. The Text Label or Input you get the data from is blank
    2. It a choice field and you cannot patch a choice field like that.
     
     
     

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Understanding Microsoft Agents - Introductory Session

Confused about how agents work across the Microsoft ecosystem? Register today!

Markus Franz – Community Spotlight

We are honored to recognize Markus Franz as our April 2025 Community…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 146,702 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 66,017 Most Valuable Professional

Leaderboard