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
 WHAT’S NEXT AT MICROSOFT IGNITE 2022

WHAT’S NEXT AT MICROSOFT IGNITE 2022

Explore the latest innovations, learn from product experts and partners, level up your skillset, and create connections from around the world.

Register for a Free Workshop.png

Register for a Free Workshop

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

Users online (1,322)