web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Power Apps - Building Power Apps
Suggested answer

Data not loading into local collection on app start

(0) ShareShare
ReportReport
Posted on by
Hi all, 
 
I am fairly new to Power Apps and I am currently trying to build an app to embed into a Power BI report. My current Screen1.OnVisible formula is as follows: 
 
With(
    {
        ctx: PowerBIIntegration.Data
    },
 
// Refresh SQL data
Refresh(fact_cbp_submission);
Refresh(dim_pipeline_type);
Refresh(dim_practice_area);
Refresh(dim_lever);
 
// Load and merge filtered records
    ClearCollect(
        colRows,
        AddColumns(
            fact_cbp_submission,
            PipelineTypeName,
                LookUp(
                    dim_pipeline_type,
                    Value(PipelineTypeID) = Value(ThisRecord.PipelineTypeID),
                    dim_pipeline_type.PipelineType
                ),
            PracticeAreaName,
                LookUp(
                    dim_practice_area,
                    Value(PracticeAreaID) = Value(ThisRecord.PracticeAreaID),
                    dim_practice_area.PracticeArea
                ),
            LeverCategoryName,
                LookUp(
                    dim_lever,
                    Value(LeverCategoryID) = Value(ThisRecord.LeverCategoryID),
                    dim_lever.LeverCategory
                ),
            IsNew, false,
            TempId, Text(Now(), "yyyymmddhhmmssfff")
        )
    )
);
 
but everytime  start the app colRows does not populate and I can't work out why. Can anyone give me some guidance here please? 
Categories:
I have the same question (0)
  • SebS Profile Picture
    4,452 Moderator on at
    Data not loading into local collection on app start
    My guess would be that this is the scoop fault / ThisRecord  try below finger cross it will work
     
    // Load and merge filtered records
        ClearCollect(
            colRows,
            AddColumns(
                fact_cbp_submission As R,
                PipelineTypeName,
                    LookUp(
                        dim_pipeline_type,
                        Value(PipelineTypeID) = Value(R.PipelineTypeID),
                        dim_pipeline_type.PipelineType
                    ),
                PracticeAreaName,
                    LookUp(
                        dim_practice_area,
                        Value(PracticeAreaID) = Value(R.PracticeAreaID),
                        dim_practice_area.PracticeArea
                    ),
                LeverCategoryName,
                    LookUp(
                        dim_lever,
                        Value(LeverCategoryID) = Value(R.LeverCategoryID),
                        dim_lever.LeverCategory
                    ),
                IsNew, false,
                TempId, Text(Now(), "yyyymmddhhmmssfff")
            )
        )
    );
  • WarrenBelz Profile Picture
    151,881 Most Valuable Professional on at
    Data not loading into local collection on app start
    I prepared a response and forgot to post and I see now that @SebS has provided what should be a valid solution (so please mark that). I headed the same direction with a couple of slight variations (the As disambiguation operator is on the "other side" and I also tend to use Lookup( . . . . ).FieldName rather than LookUp( . . . . .,FieldName) when adding columns).
     
    The other issue you may have here is Delegation with the Value() conversions - if they are already numbers, you do not need this (you do if they are Text).
     
    The main reason  (as @SebS pointed out) that ThisRecord may be an issue is that you have identically named fields in the list comparisons (hence the As  operator). Anyway, I might as well post this now I have done it.
    ClearCollect(
       colRows,
       AddColumns(
          fact_cbp_submission,
          PipelineTypeName,
          LookUp(
             dim_pipeline_type As _DPT,
             Value(_DPT.PipelineTypeID) = Value(PipelineTypeID)
          ).PipelineType,
          PracticeAreaName,
          LookUp(
             dim_practice_area As _DPA,
             Value(_DPA.PracticeAreaID) = Value(PracticeAreaID)
          ).PracticeArea,
          LeverCategoryName,
          LookUp(
             dim_lever As _DL,
             Value(_DL.LeverCategoryID) = Value(LeverCategoryID)
          ).LeverCategory,
          IsNew,
          false,
          TempId,
          Text(
             Now(),
             "yyyymmddhhmmssfff"
          )
       )
    );
     
  • Suggested answer
    Inogic Profile Picture
    1,122 Super User 2025 Season 2 on at
    Data not loading into local collection on app start
    Hi,
     
    Add your ClearCollect function in the App.OnStart property, and then select Run OnStart to generate the collection. It will load data into the local collection when the app starts.
     
    Hope this helps.
     
    Thanks!
    Inogic

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Chiara Carbone – Community Spotlight

We are honored to recognize Chiara Carbone as our Community Spotlight for November…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 766 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 419 Super User 2025 Season 2

#3
developerAJ Profile Picture

developerAJ 235

Last 30 days Overall leaderboard