cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
DonArnett
New Member

How to use a SharePoint file property (a page detail field) as a parameter to the trim() function

My flow is processing all pages found in a SharePoint folder. It's using two fields defined as "Page Details" for each page. I want to use the trim( ) function to remove extraneous spaces that my users tend to include. So I need to pass the "Page Detail" property named "Book Label" as the parameter to the trim( ) function.

 

So, as the first step after "Get file properties" in my loop, I created a "Set Variable" object. To enter the "Value", I select the Expression column on the "Add dynamic content" popup and selected the trim( ) function. I end up with "trim( )". I put the cursor between the two parentheses and select the "Dynamic content" column. Then I select the "Book Label" entry below "Get file Properties".

 

I end up with    trim(outputs('Get_file_properties')?['body/BookLabel'])   in the "fx" field of the Add dynamic content" popup. Then I select OK and the value is written back to the Set Variable value input box.

 

When I run this flow, it fails with the error message of:
Unable to process template language expressions in action 'Set_strBookLabelTrimmed' inputs at line '1' and column '20464': 'The provided parameters for template language function 'trim' are not valid.'.

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
NiloferA
Solution Supplier
Solution Supplier

Hello @DonArnett ,

trim function takes in string values, so if yo are using it correctly, the reasons that you may be getting this error are

  • The parameter you are passing is not a string value, to fix this you can encapsulate the parameter within string () function
  • The parameter value is null

You can check what value you are getting for this parameter in the outputs of Get File Properties

Please hit Kudos or Accept this Reply as Solution if it resolved your problem.

View solution in original post

2 REPLIES 2
NiloferA
Solution Supplier
Solution Supplier

Hello @DonArnett ,

trim function takes in string values, so if yo are using it correctly, the reasons that you may be getting this error are

  • The parameter you are passing is not a string value, to fix this you can encapsulate the parameter within string () function
  • The parameter value is null

You can check what value you are getting for this parameter in the outputs of Get File Properties

Please hit Kudos or Accept this Reply as Solution if it resolved your problem.

DonArnett
New Member

Thanks for the reply. The solution was to call the string( ) function. My expression ended up like:

 

trim( string( variables('strBookLabelFromPage') ) )

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

New Ideas Forum MPA.jpg

A new place to submit your Ideas for Power Automate

Announcing a new way to share your feedback with the Power Automate Team.

MPA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

Learn to digitize and optimize business processes and connect all your applications to share data in real time.

MPA Licensing.jpg

Ask your licensing questions at the Power Automate AMA!

Join Priya Kodukula and the licensing team, super users and MVPs to find answers to your questions on Power Automate licensing.

Users online (3,909)