cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Mickell2030
Advocate I
Advocate I

Syntax for joining tables

I am having a heck of a time trying to understand the syntax of powerapps.

 

I have a background in SQL and I am very comfortable with it. This is not SQL :(.

 

I have an SQL database. My SQL database was built correctly, with the min amount of repeating data. It seems like Powerapps wants me to have 1 giant table with everything on it instead of multiple tables that are related and joined.

 

Here is what I need to understand:

 

Example - I have 3 tables with information I need from each in a gallery.

 

Table 1 - UPC_Details

Columns (UID) UPC_ID, Brand_ID, Cost, Created_Date

 

Table 2 - Brand_ID

Coulmns (need to join to UPC_Details Brand_ID) (UID) Brand_ID, Brand_Name, Company_Contact_ID...

 

Table 3 - UPC_received

Columns (UID) UPC_Received_ID, (need to join to table UPC_Details so users know what item they are looking at when the UPC is scanned) UPC_ID, Cases_received, Date_received...

 

 

I am sure you can see where this is going.

I need my users to be able to see specific data that I normally would use a join to reference. I do not know if I should be building a collection onvisble, or something else entire. Nor do I undertand the syntax Powerapps uses. I am extremely dissapointed with the resources for Powerapps, as I do not feel these questions are well answered and I am sure I am not the only user with this problem.

 

Thank you in advance to anyone willing to help me out with this.

16 REPLIES 16
Delid4ve
Impactful Individual
Impactful Individual

I hardly ever use lookup.
First(Filter(Table,Expression)).Column
Or
Last(Filter(Table,Expression)).Column
You can also add a sortbycolumns in there if you want say the first date column etc
It’s faster than lookup aswell
Anonymous
Not applicable

Hi All,  I'm working on a similar issue.  I am trying to join two data sources together using the card number in both tables to show which loyalty program name that card number is associated to.  I have been using filter and the lookup function but I'm still having no luck.  I am trying to display the field "loyaltyprogramname" in a label box.

 

Below are the two tables.

 

RetailLoyaltycards: Card Number

RetailLoyaltyCardTiers: Card Number , Loyalty Program Name 

 

Any help would be greatly appreciated!

Anonymous
Not applicable

I have used the expression to populate the Data Table and I am successful in doing it for 2 tables ( 1 Main Table and 1 Look u Table). There is one more column in main table which i want to lookup in another secondary table.

 

How to do that? Pls guide.

Ben-M
New Member

You can create a View in SQL and use that view in PowerApps as a data source just like you use SQL Tables.

@CarlosFigueira Same scenario in my case, I want 2 field from 2 MSD365 F&O Table. 

 

Where I add this formula? Can I add this on form Item property? Or It's Just only for DataTable control.

 

Thanks in advance!

 

Bansari Pandya.

abhishja
Frequent Visitor

hi,

 

How about Right Table in Join?  I am able use Left Table in Join. However I am using Addcolumns(filter (Table1, XXX = "XXX"), "ZZZ", Lookup(Table2, ID= Table1[@ID]).

 

Regards,

Abhishek

 

cjwere
New Member

Hi,

 

I've been struggling to make this work all day.  I followed the threads here and elsewhere re using LookUp to effectively JOIN tables.  My situation I am trying out a Canvas app to talk to an old on-premise MySQL database, containing sugarCRM tables.  Its working surpisingly well apart from not being able to JOIN.

 

There's an accounts table, and an extra table of custom columns i've added accounts_cstm, and they are inner joined 1-1 on  accounts_cstm.id_c = accounts.id, where the id prmary and foreign keys are GUIDs.

 

This should add a "Custom" record containing all the matching subrecords in the accounts_cstm table to my composite "table" (collection) AccountDetails. 

 

It appears to work, ie syntax is happy and runs,  but the custom is empty when I look at the collection. I am getting delegation warnings which do not surprise me, but I cnt see any way around it.  The row count is about 600 so not huge. 

ClearCollect(
    AccountDetails,
    AddColumns(
        Filter(
        [@'[sweet5_5].[accounts]'],
        !deleted
        ),
    "Custom",
    LookUp('sweet5_5.accounts_cstm', id_c='[sweet5_5].[accounts]'[@id])
    )
)    

 

My gallery then uses a sorted and searched derivative AccountDetails as its Items.  I am only needing readonly access; I'd just create views in MySQL, but the MySQL connector is only letting me connect to tables.

 

I have also tried explicitly looking up just the columns I need 

eg

..."TestAccount", LookUp('sweet5_5.accounts_cstm', id_c='[sweet5_5].[accounts]'[@id], testaccountonly_c)

and

... "TestAccount", LookUp('sweet5_5.accounts_cstm', id_c='[sweet5_5].[accounts]'[@id]).testaccountonly_c

 

(testaccountonly_c is a column I'd like to use to grey out or even hide some rows, but the other columns in the custom table are also useful once i get to the details pane.

 

For some reasonwhen i first created the application, the wizard named the datasource as '[sweet5_5].[accounts]'  (including square brackets and single quotes).  When I add other MySQL tables it adds them still quoted, but without square brackets. eg 'sweet5_5.accounts_cstm' for my table i am joing to.

 

Thanks

Chris

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

Power Platform Call June 2022 768x460.png

Power Platform Community Call

Join us for the next call on June 15, 2022 at 8am PDT.

PA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.

PA.JPG

New Release Planning Portal (Preview)

Check out our new release planning portal, an interactive way to plan and prepare for upcoming features in Power Platform.

Top Solution Authors
Top Kudoed Authors
Users online (3,756)