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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Apps
Answered

linking two tables

(0) ShareShare
ReportReport
Posted on by 3,284

Hi there, I have this silly question but I cannot figure out:

I have two tables in my MS Access database:

1. Main Table

2. Projects

 

Projects and main table are linked by AssetID

 

I have a Papp with all of the information for my main table, but I would like to include a new screen that show my projects based on the selected value in my gallery1.

 

BTW, my data is exported into an excel file, the file is in my one drive, and the excel file has two tabs, one for the main "TblMaan" and one for projects "TblProjects"

 

Can someone point me in the right direction?

 

Thanks in advance

 

 

 

Categories:
I have the same question (0)
  • v-micsh-msft Profile Picture
    Microsoft Employee on at

    Hi @sajarac,

     

    Basically you should do the following:

    1. Add those two table into PowerApps,

    2. create a collection for Projects table, (See example in this thread, If the lookup table has > 500 records

    3. Use Lookup or filter function to filter the collection created for Projects.

    For example:

    Filter(collection, AssetID=Gallery.selected.AssetID)

     

    Regards,

    Michael

     

  • Sajarac Profile Picture
    3,284 on at

    Thank toy very much for your prompt reply, unfortunatelly now I am getting totally lost. The other guy say this:

     

    Here is the best way to do what you want to do, assuming owners has 500 or fewer records:

    1. Have an initial screen in the app to welcome the user, with no functionality except a button to proceed
      This is so that you can cache any lookup tables, this improves performance tremendously
    2. Set the Disabled property of the button to be:
      IsEmpty('[Access].[Owners]')
      This is so that you give the PowerApp time to connect the data source

    Q/ so this mean my two tables will be here? 

     

    IsEmpty('[tblMain].[TblProjects]')

     

    1. Set the OnSelect property of the button to be:
      ClearCollect(CachedOwners, '[Access].[Owners]'); Navigate(MyFirstScreen, None)
      This is so that you cache the lookup data, may take a few seconds but it is worth it
    ClearCollect(CachedOwners, '[TblAMin].[TblProjects]'); Navigate(MyFirstScreen, None)

    What does it mean? CachedOwners?

     

     

    1. Then, anywhere you need to display the owner name, you can look up to the cached data instead of needing to call the server.  This is most effective in a gallery, where otherwise the server would be called for every line. For example a text box text property would be set to:
      LookUp(CachedOwners, ThisItem.OwnerLookupField, DisplayNameField)

     

     How this apply to mi sample?

     

    I am a heavy user of Access Web Apps and with a few tricks PowerApps can do great things with AWA as a back-end.

    Here are a few things you should keep in mind, which are true at the time of writing:

    1) It is far more efficient to cache lookup tables locally with a collection

    2) If the lookup table has > 500 records you can still cache it by using for example:

    ClearCollect(CachedInstruments, Sort('[Access].[Instruments]', ID, Ascending));
    UpdateContext({MaxID: Max(CachedInstruments, ID)});
    If(CountRows(CachedInstruments)=500,
    	Collect(CachedInstruments, Filter(Sort('[Access].[Instruments]', ID, Ascending), ID > MaxID))
    ;
    UpdateContext({MaxID: Max(CachedInstruments, ID)});
    If(CountRows(CachedInstruments)=1000,
    	Collect(CachedInstruments, Filter(Sort('[Access].[Instruments]', ID, Ascending), ID > MaxID))
    ;
    UpdateContext({MaxID: Max(CachedInstruments, ID)});
    If(CountRows(CachedInstruments)=1500,
    	Collect(CachedInstruments, Filter(Sort('[Access].[Instruments]', ID, Ascending), ID > MaxID))
    )))

     

    Yes my two tables has more than 500 records, so:

     

    CachedInstruments will be my data file, [Access].[Instruments] my two tables? tblmain and tblprojects?

     

    Sorry to be a pain, but I thought that this was easier.

     

    Regards

  • Meneghino Profile Picture
    6,949 on at

    Hi @sajarac

     

    I am the "other guy"

     

    Things have moved on a little bit since I wrote that post, but the principles are still valid.

    The basic idea is that if you have performance issues due to the large size of your tables or your connection quality or the shaping that you do, then you can address this by caching you table data locally in a collection, so that shaping, manipulation and lookups execute almost instantaneaously instead of having to wait for a remote query to execute for every row.

    I notice that you use Excel as the back-end (i.e. where you store your table data), so there may be performance issues.  But you should first try the simple approach and then cache if you need to.

     

    The simple approach would be to have in your second screen a gallery with the following Items property, or something like it:

     

    Filter(TblProjects, AssetID = Gallery1.Selected.ID)

    The details will depend on the exact names of your columns and controls, as well as the relationship between the tables.

     

    If this works but you have performance issues, then you can use the caching approach described in the post that @v-micsh-msft referred to.

  • Sajarac Profile Picture
    3,284 on at

    Thank you very much "the other guy" lol 

     

    Thank you very much Meneghino for your prompt reply. unfortunately it didn't work, after that I am getting an empty table

  • Meneghino Profile Picture
    6,949 on at

    Hi @sajarac

    Is that because of syntax or delegation?

    If the first, we need to fix it.  If the second, then we can use caching and other techniques.

    To check if it is syntax, please choose values that would return something in the first 500 rows of your data, better if in the first 100.

  • Sajarac Profile Picture
    3,284 on at

    Hi, and thanks again for your prompt reply, I have checked and now aI can see the fisrt Records in my table.

     

    Just FYI my "Main Table has 500+ records and my "tblprojects" has 748 records.

     

    But just to confirm, yes I am able to see the firts records which are Fiscal Year 2012, but nothing for FY14,15,16m,17,18

     

    and one more question.

     

    how I can add a calculated field to sum those filtered records?

     

    Capture.PNG

  • Meneghino Profile Picture
    6,949 on at

    OK, then at least we know what the problem is.

    When you say MS Access as a back-end, you mean an Access Web App?

    If so, then we can resolve all your issues, although you are aware that AWA is being phased out, right?

     

    Assuming we are talking about AWA, then you should see the first 500 records of your 748, so I am surprised that you have 500 projects for 2012 and 248 for the following 5 years.  Or maybe I misunderstand...

     

  • Sajarac Profile Picture
    3,284 on at

    Hi, no sorry.

     

    My data is an access database, and qith a couple of querys I export my two tables to excel, then I copy and paste into my data file in my one drive for business.

     

    My table main has 500+ records  "customers" and the table projects has 748 projects which is basically I have a single location per customer and sometimes customer has 2, 3 or even more locations.

     

    So the total 500+ records are for the fiscal years from 2012 up to 2018.

     

    And BTW what the mean AWA? sorry Man Frustrated

  • Meneghino Profile Picture
    6,949 on at

    Don't worry about AWA (Access Web Apps), it was a great technology (Access in the Cloud) but it is being phased out by MS.

     

    Unfortunately Excel as a data source is not currently delegable, so it means that only the first 500 records are queriable.

     

    Would you consider migrating the data to SharePoint lists or even CDS?

    Even better would be Azure SQL DB, and given your Access background it shoud be easy.  I now use Azure SQL DB and it is a cheap and great way to store data.

  • Sajarac Profile Picture
    3,284 on at

    I can migrate to share point list, but I never used share point before  , I can do it if you point me in the rigth direccion?

     

     

     

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 490

#2
WarrenBelz Profile Picture

WarrenBelz 427 Most Valuable Professional

#3
Vish WR Profile Picture

Vish WR 381

Last 30 days Overall leaderboard