cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
vffdd
Super User
Super User

TrimEnds or alternative

I am using the following as the items property in a gallery

 

Sort(Filter(CollNonRecurring,StartsWith(Text(Reference), TxtFinditem.Text)),PODate,Descending)

 

So it filters the gallery based on what you put in the TxtFinditem.Text box as a searchbox.    That works fine except !

 

Some of the items in the  Reference column have a leading space..and so they won't show when you put them in the search box  At the moment the users are using a workaround that if they can't find the item on first try they add a space in the search box before adding their text.  It's a bit messy some people forget to do it and then I get calls "I can't find this.. and I know it's there etc.."  and I would rather that all items show up even if they have a leading space 

 

What's  the best way to do this?  Can I use the TrimEnds function somewhere?  Have tried various ways but not getting it to work.  Should I trim the column when creating the collection or at the filter stage?

 

Any advice or ideas?

 

TIA

1 ACCEPTED SOLUTION

Accepted Solutions
v-yutliu-msft
Community Support
Community Support

Hi @vffdd .

Do you want to filter based a field that may has blank space at the beginning?

Could you tell me this field data type?

I suggest you use AddColumns function and TrimEnds function  to add new column and remove the blank spaces.

Try this formula:

Sort(
     Filter(
            AddColumns(CollNonRecurring,
                       "Reference1",TrimEnds(Text(Reference))
                       ),
            StartsWith(Reference1, TxtFinditem.Text)
            ),PODate,Descending)

 

 

Best regards,

Community Support Team _ Phoebe Liu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

4 REPLIES 4
eka24
Super User
Super User

You can use Trim at the Collection level or in the formula. Both should work.

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

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.

v-yutliu-msft
Community Support
Community Support

Hi @vffdd .

Do you want to filter based a field that may has blank space at the beginning?

Could you tell me this field data type?

I suggest you use AddColumns function and TrimEnds function  to add new column and remove the blank spaces.

Try this formula:

Sort(
     Filter(
            AddColumns(CollNonRecurring,
                       "Reference1",TrimEnds(Text(Reference))
                       ),
            StartsWith(Reference1, TxtFinditem.Text)
            ),PODate,Descending)

 

 

Best regards,

Community Support Team _ Phoebe Liu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

That works perfectly thanks a million

satishkumark
Helper I
Helper I

Hi,

Similar scenario:

I have collection(CatMater) in that one of the column(Tool) which is of type table. By using Concat function i have extracted data like Comma separated values and displayed in a gallery by using Label Control(ToolsLabel).

Formula: Concat(ThisItem.Tool,Value & ",")

satishkumark_0-1612550527475.png

Now I need to remove Comma(",") at Position in that Label and display result in the same label like below.

Tools
Adept ProBook,Azure DevOps

 

Any help would be greatly appreciated.

Thanks,

Satish.

 

 

Helpful resources

Announcements
Microsoft 365 Conference – December 6-8, 2022

Microsoft 365 Conference – December 6-8, 2022

Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.

Difinity Conference 2022

Difinity Conference 2022

Register today for two amazing days of learning, featuring intensive learning sessions across multiple tracks, led by engaging and dynamic experts.

European SharePoint Conference

European SharePoint Conference

The European SharePoint Conference returns live and in-person November 28-December 1 with 4 Microsoft Keynotes, 9 Tutorials, and 120 Sessions.

Power Apps Ideas

Changes to Ideas Coming

We are excited to announce a new way to share your ideas for Power Apps!

Top Solution Authors
Top Kudoed Authors
Users online (4,745)