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
Highlighted
Super User
Super User

Re: Data Restrction to Specific Records Only For SQL Linked Records

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
Highlighted
Super User
Super User

Re: Data Restrction to Specific Records Only For SQL Linked Records

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

Highlighted
Helper I
Helper I

Re: Data Restrction to Specific Records Only For SQL Linked Records

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

Highlighted
Super User
Super User

Re: Data Restrction to Specific Records Only For SQL Linked Records

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
secondImage

Demo-Extravaganza 2020

Check out these cool Power Apps & vote on your favorite!

secondImage

Robotic Process Automation

Let's talk about the solution provided by Microsoft for Robotic Process Automation (RPA)

secondImage

Community Highlights

Check out whats happening in Power Apps

secondImage

Community User Group Member Badges

FIll out a quick form to claim your community user group member badge today!

Top Solution Authors
Top Kudoed Authors
Users online (6,468)