cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
dennisb88
Responsive Resident
Responsive Resident

The template language function 'replace' expects its first parameter 'string' to be a string. The provided value is of type 'Null'

Hi all,

 

I'm try to import a lot of records from a Excel table to Dataverse. Some field I need to import to a currency column. Because my Excel have in one of the currency columns ' . ' as delimiter. Because dataverse is not accept that in my environment I add this expression to my flow: 

replace(items('Apply_to_each_|_Create_Project_Activities')?['As Sold Budget Amount'],'.',',')

Good to know, not all the records in my Excel table has values with decimals, so there is not a delimitter. Also some rows don't have a value (column is empty).

 

But my flow is not accepting this. It shows me the following error:

The template language function 'replace' expects its first parameter 'string' to be a string. The provided value is of type 'Null'

 

Does any one know how to fix this?

 

Thanks in advance.

 

1 ACCEPTED SOLUTION

Accepted Solutions

Just replace the empty string in the coalesce with a valid default value, like '0'

replace(coalesce(items('Apply_to_each_|_Create_Project_Activities')?['As Sold Budget Amount'],'0'),'.',',')


-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

View solution in original post

8 REPLIES 8
Pstork1
Dual Super User
Dual Super User

Replace 

'Apply_to_each_|_Create_Project_Activities')?['As Sold Budget Amount']

in your function with 

coalesce('Apply_to_each_|_Create_Project_Activities')?['As Sold Budget Amount'],'')

 That will replace any null values in the Excel sheet with a blank string.



-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.
dennisb88
Responsive Resident
Responsive Resident

Hi @Pstork1 ,

 

Thank you for your quick reply.

I just try that, but when I save my flow, it gives an error:

dennisb88_0-1656594414346.png

This is the complete (new) expression:

replace(items(coalesce('Apply_to_each_|_Create_Project_Activities')?['As Sold Budget Amount'],''),'.',',')

  

I think it's failed because the column where I try to add it is a currency column where a string is not possible, or is it something else?

Sorry, Cut and Paste error on my part.

replace(coalesce(items('Apply_to_each_|_Create_Project_Activities')?['As Sold Budget Amount'],''),'.',',')

Coalesce() in Power Automate goes through the arguments from left to right and returns the first non-null argument. So if the value in the row isn't null it will use that.  If the value is then it will replace it with a blank string.



-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.
dennisb88
Responsive Resident
Responsive Resident

Hi @Pstork1 ,

 

Thanks, that don't give me the error by saving the flow.

But now I got this issue when running the flow:

 

The 'inputs.parameters' of workflow operation 'Add_a_new_row' of type 'OpenApiConnection' is not valid. Error details: Input parameter 'item/vi_assoldbudgetamount' is required to be of type 'Number/currency'. The runtime value '""' to be converted doesn't have the expected format 'Number/double'.

Just replace the empty string in the coalesce with a valid default value, like '0'

replace(coalesce(items('Apply_to_each_|_Create_Project_Activities')?['As Sold Budget Amount'],'0'),'.',',')


-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.
dennisb88
Responsive Resident
Responsive Resident

Hi @Pstork1 ,

 

Thank you. That fixes my issue.

 

Thanks again and have a nice day.

dennisb88
Responsive Resident
Responsive Resident

Hi @Pstork1 ,

 

I was a little bit to quick. It seems to be that now every record has the value of €0.- but in my Excel table, not every record is empty. 

Do you know how that should be fixed?

Can you look at one of the runs and see what value is actually coming out of the replace function?  Also, currency columns in Dataverse are actually lookup columns.  So you may need to add the actual value to a different column.  Currency column explained here:  Column data types in Microsoft Dataverse (contains video) - Power Apps | Microsoft Docs



-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

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.

Users online (2,331)