cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
dynamictiger
Level: Powered On

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
Level 8

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
PowerAddict
Level 8

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

dynamictiger
Level: Powered On

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

PowerAddict
Level 8

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
thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

Top Kudoed Authors
Users Online
Currently online: 142 members 5,444 guests
Please welcome our newest community members: