cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
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
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
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
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

News & Announcements

Community Blog

Stay up tp date on the latest blogs and activities in the community News & Announcements.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Community Highlights

Community Highlights

Check out the Power Platform Community Highlights

Top Solution Authors
Top Kudoed Authors
Users online (12,158)