cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Anonymous
Not applicable

gallery with a list from SQL based on ID

Hello,

I am working on a app and it is to register the fish that were caught. But they all go into one table and their ID is based on the project that's active. So in the table you have multiple rows of caught fish that need to be displayed. But not all the fish from the table. Just the fish that come from the one active project. Here is an example

1fishKindlength
2fishKindlength
2fishKindlength
2fishKindlength
3fishKind

length

So in the app I want a gallery that only displays the fish with the ID of 2. So the middle three. Can anyone help me? Thanks in advance.

1 ACCEPTED SOLUTION

Accepted Solutions
timl
Super User
Super User

@Anonymous 

I'm confused as to what you're doing here. Are you trying to add a new record into [dbo].[Traject], and to retrieve the primary key value of the record that you've just inserted?

I suspect this is the formula that you're looking to use in your gallery.

Filter('[dbo].[Vangst]'; trajectID = varTrajectId.trajectID)

View solution in original post

8 REPLIES 8
eka24
Super User
Super User

You can use Filter function to achieve that.

On the Items property of Gallery:

Filter (SQLtable,ID=2)

 

------------

If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.

Anonymous
Not applicable

Earlier in the app the "trajectId" is set. So in the gallery I use 

Filter('[dbo].[Vangst]', trajectID = trajectId) and i get a error. It says invalid argument type

timl
Super User
Super User

Hi @Anonymous 

If trajectId is also the name of the column that you want to filter by in your table, I would name the variable something else (for example, varTrajectId) to avoid any conflict in naming.

Also, can you confirm the language that you're using? If for example, you're using Dutch, you should use a semi-comma to separate the arguments in your calls to Set and Filter.

Call to Set...

Set(varTrajectId; 2)

Call to Filter...

 

Filter('[dbo].[Vangst]'; trajectID = varTrajectId)

 

 

Anonymous
Not applicable

yes it's dutch but we got an update so we also use commas. but let me try the variable thing

 

Can you show your variable code?

------------

If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.

Anonymous
Not applicable

This is what i used to set that variable

Set(varTrajectId, Patch('[dbo].[Traject]', Defaults('[dbo].[Traject]'), {projectID: projectID, trajectNummer: trajectNummer}));
timl
Super User
Super User

@Anonymous 

I'm confused as to what you're doing here. Are you trying to add a new record into [dbo].[Traject], and to retrieve the primary key value of the record that you've just inserted?

I suspect this is the formula that you're looking to use in your gallery.

Filter('[dbo].[Vangst]'; trajectID = varTrajectId.trajectID)

View solution in original post

Anonymous
Not applicable

So when i set varTrajectId it retrieves the ID of the row. So i can link other table to it. I am going to try it

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.

Top Solution Authors
Top Kudoed Authors
Users online (1,583)