How to Set Up Relationships in Power Apps

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
and i'm gonna run it look at this we have kindle selected and his lamborghini's there rabies selected there's this toyota darren's selected there's his cars and that's how you do one of many relationships how easy is that huh nice yeah as you know if you're setting up two sharepoint lists and you've got a let's see a primary key for a sharepoint list which is always the id right that's the primary key and that's the one into the relationship and you've got another sharepoint list over here that is the foreign key and let's say we got customer a customer table over here and then we've got let's say orders over here and an order list has got a column called the customer id and you just create a numeric uh column okay and whenever you've got a customer and they're going to place an order you grab the customer id and you put it into the column over here on this sharepoint list called customer id just drop it in there and that's how you do a relationship with sharepoint lists and what we could do is we can just create a completely new sharepoint for the these zoom calls let's just do that maybe powerapps okay very good i'm gonna click finish we'll have a fresh new uh sharepoint list so listen let's create two sharepoint lists so if you get the stuff over to sharepoint you could create um a lookup column and that's not how i would recommend doing it there's a northwind database access database that i worked with i left all those lookup columns intact but um and i learned why i don't like that which is you run a delegation issue so if you're gonna do it the right way let's just create two lists here so we'll create a list here and we'll call it customers so we have customers okay and with any sharepoint list you're gonna have an id so you've got an id and a title so i just created a new customers table id and title okay maybe we'll just throw the name of the customer in there and then back here i'll go in here and let's say yeah let's let's create a list called cars okay and for this car i want to see the id and we'll also add a number and this number will be called customer id and it's a number here okay so now over here in powerapps so let's add in a gallery where's my galleries at there it is all right so this will be customer [Music] and i'll give that a border you know what i might do would you guys be interested in learning about the patch function because i could put a form on here and and um but if you guys want to learn something new i could show you how to use a patchwork yes i've been using that a little bit at work okay very good and that's what i use for all my application i use use patch i don't use it yeah i don't mess with the galleries that much or the forms yeah i like to create my own forms all right very good all right so let's um tie into this sharepoint list okay so i'm going to go to the root of the sharepoint site i'm going to go into the data sources and add data connectors sharepoint there i am i'm gonna paste that in there customers and cars all right so here is cars i'm sorry i meant to say customers first select the customers on one side and the cars on the other okay now what i'd like to do for both of these i always like to give my galleries a nice dark gray color and then i go in here for template fill and i say if this item dot is selected light yellow voice white all right that's probably good enough all right let's add in a text box okay now for this text box we don't want anything in there but for the hint text we'll say customer name and you know what let's just make this as wide as that probably want the height to be 40 which it already is and then for the car actually let's make this more like 500 there you go and then over here for the vehicle or they say um car our name and let's add some buttons here and i'm going to zoom in a little on this add okay and i hit ctrl 0 to zoom out it's a little nifty little keyboard shortcut now what we'll do over here for this text box we'll say txt customer over here we'll say txt car and probably for our galleries it's probably a good idea to say gal customer and gal car okay and what we'll do this patch statement is we'll say patch and the first parameter is the data source so we will say customers and i'm going to copy the name of that data source because the second parameter if we're just inserting adding a new value which is what we're doing here we're just adding new values what we'll do is we'll say defaults it's a function here defaults and we'll give it the name of that data source and then the third parameter is all the data that we want to put into that record okay so what we have is a title and that title we want to take whatever was entered in the customer text box we'll just throw it in there now is there anything else in a customer that we want to provide i think the customer is really basic it only has a title i believe and that is true id will be automatically provided for us okay then um over here so that will okay let's let's enter a few records here okay i'm going to say darren boom there's darren all right let's enter in reby and uh kendall all right so now we've got uh three customers and then over here you know what let's just copy the code that we have here i'm gonna be doing almost the same thing over here on select instead of customers we're gonna say cars yeah cars doing this the same exact thing now the title that's going to be txt car but for a car we're going to add in one more value which is the customer id now the customer's id is going to be whatever is selected in the first gallery so gal customer dot selected which will give us the underlying record for whatever selected in that gallery we'll say dot id i'm going to put in here i don't have a mustang but i'd like to get a mustang so i'm going to add mustang there we go now let's let's do something here like i'm gonna copy this label and over here i'm gonna say customer id okay so it's gonna display the customer id and then i'm gonna copy and paste this and over here i'm gonna display the id there okay so we can see that it's actually working i would also like to have a dodge viper can you tell i'm in a muscle cars all right so raby you're muted so feel free to unmute yourself if you want to tell me what your dream car is so kendall tell me a dream car for you uh toyota okay toyota okay very good i'll add toyota for you so i have you selected here and look at that so your id is two what about you kendall um how about a lamborghini all right yeah i mean that sounds nice all right so i've got you selected kindle and i'll click on add okay there we go so we got one two three now what about this what if we only show so we we have a one in mini relationship right there but chances are you only want to show the cars on the right which whoever is associated with the cusp the customer on the other side right right okay so what we'll do is we will on this gallery for the data source it just says cars so what we want to do for cars is we want to filter this hey if you're getting anything helpful out of this a comment or even a like really helps the channel and that's people like you know this is good content much appreciated okay filter the cars where customer id this is like a kindle if you're familiar with uh sql statements this is like your where clause in a select statement customer id equals gal customers dot selected dot id and i'm gonna run it look at this we have kindle selected and his lamborghini's there raby is selected there's his toyota darren selected there's his cars and that's how you do one of many relationships how easy is that huh nice yeah do you have to have them on the same screen no we don't okay and in fact i mean let's do a new screen screen screen too and then we could have this gallery i'm going to copy that i'm going to paste it over here on the screen too and then what we could do a lot of times what people like to have are little drop downs so we'll add a drop down here for our customer so we can bind this this drop-down list to customers okay now we probably want to show their title okay so drop down one let's say drop down list and we'll call this customers okay and then for this gallery instead of looking at that that gallery on the first screen we'll say drop down list so look at this creepy kindle isn't that cool nice yeah it's a really simplified way of of doing one of many relationships that's how i that's how i do them in all my apps and because okay so why you don't want to use a lookup column within sharepoint is you see how easy this is this is a numeric and this this value over here is numeric well if this was a a lookup column it would be a complex column you see customer id then you have to say dot id and if you do that inside of a like the where clause the second parameter within the filter it has to pull over all the data to perform that where um that that filtering process if you write it this way where you're comparing a numeric to a numeric it doesn't have a a property dot you know object.property you have to drill into it it can delegate that stuff over to sharepoint which is what happens here notice that we get no delegation warnings at all okay so that in my opinion that's the best way of doing it if you're using dataverse you can get away with doing it's actually the recommended way actually doing the lookups so you're going to handle the situations a little differently based on the data source guys for some reason youtube thinks you're going to like this video next let's see if they're right or you can select this playlist which i've selected for you based on the content you're currently watching guys gotta hurry click one of them otherwise youtube's gonna auto play some other video which you probably don't want thanks
Info
Channel: PowerApps Tutorial
Views: 33,172
Rating: undefined out of 5
Keywords: sharepoint lists, sharepoint relationship, power apps, powerapps, powerapps tutorial, powerapps tutorial sharepoint, powerapps sharepoint list, sharepoint, microsoft powerapps, powerapps tutorial for beginners, learn powerapps, power platform, powerapps sharepoint, sharepoint list relationships, powerapps sharepoint lookup column, power apps: planning sharepoint lists relationships, powerapps sharepoint list form, sharepoint list, powerapps from sharepoint list
Id: c3Rb7wACap0
Channel Id: undefined
Length: 12min 34sec (754 seconds)
Published: Wed Jun 22 2022
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.