cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
dynamictiger
Helper I
Helper I

Data Restrction to Specific Records Only For SQL Linked Records

Hi

 

I am exploring my first adventure in bar code scanning I have set up a stock table in SQL consisting of four columns being StockID, Barcode, PartNumber and Description.

 

In power apps I have connected to this table and have sorted my browse gallery by part number as below:

SortByColumns(Search([@'[dbo].[ShentonStock]'], TextSearchBox1.Text, "Barcode","Description","PartNumber"), "PartNumber", If(SortDescending1, Descending, Ascending))

 

As this is a practical test, and use in anger for first time Monday, I would like to restrict the records to only part numbers commencing 05.   So part numbers like 0506CH1288 and 0512THC234 etc, no other records at this time (but want to revert later).

 

Do I do this in powerapps and if so at the browse gallery level or do I do this at SQL or something else?

 

Thanks

1 ACCEPTED SOLUTION

Accepted Solutions
PowerAddict
Super User II
Super User II

Hi @dynamictiger

You can filter the gallery in PowerApps with something like this:

SortByColumns(Search(Filter([@'[dbo].[ShentonStock]'], StartsWith(PartNumber, "05")), TextSearchBox1.Text, "Barcode","Description","PartNumber"), "PartNumber", If(SortDescending1, Descending, Ascending))

If PartNumber is not a string, you might have to convert it to a string within the Filter function itself. Let me know if this works.

If you like this reply, please give kudos. If this solves your problem, please accept this as the solution. Thanks!

Hardit (Haman)

View solution in original post

3 REPLIES 3
PowerAddict
Super User II
Super User II

Hi @dynamictiger

You can filter the gallery in PowerApps with something like this:

SortByColumns(Search(Filter([@'[dbo].[ShentonStock]'], StartsWith(PartNumber, "05")), TextSearchBox1.Text, "Barcode","Description","PartNumber"), "PartNumber", If(SortDescending1, Descending, Ascending))

If PartNumber is not a string, you might have to convert it to a string within the Filter function itself. Let me know if this works.

If you like this reply, please give kudos. If this solves your problem, please accept this as the solution. Thanks!

Hardit (Haman)

View solution in original post

Thanks worked perfectly.  

 

I tried to copy just the changed part but got tangled in brackets.  Is there a better way to edit these phrases of coding?

 

Thanks

Awesome, glad I could help.

If your expression/formula doesn't have any errors, that's a great opportunity to select "Format" just below the expression bar (where you type in the expression). Any changes to an expression after it is formatted, become relatively easier. Just know that the format option is disabled if the expression has errors. So get to a point where there are no errors (even if it's not complete) and then keep adding on to it. Let me know if this helps.

Helpful resources

Announcements
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

Power Query PA Forum 768x460.png

Check it out!

Did you know that you can visit the Power Query Forum in Power BI and now Power Apps

V3_PVA CAmpaign Carousel.png

Community Challenge - Giveaways!

Participate in the Power Virtual Agents Community Challenge

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Carousel April Dunnam Updated 768x460.jpg

Urdu Hindi D365 Bootcamp

Dont miss our very own April Dunnam’s The Developer Guide to the Galaxy! Find out what the Power Platform has to offer for the traditional developer.

Top Solution Authors
Top Kudoed Authors
Users online (2,470)