cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Helper III
Helper III

conversion issue string to int

Hi,

 

I have a string value pulled from excel of '23'. 

I need to add this to a running total, but INT is not working. If I run int(variable.....) it fails with error :-

Unable to process template language expressions in action 'Increment_variable' inputs at line '1' and column '14474': 'The template language function 'int' was invoked with a parameter that is not valid. The value cannot be converted to the target type.'.

 

If I try with direct string it fails with :-

The variable 'mtest' of type 'Integer' cannot be initialized or updated with value '23' of type 'String'. The variable 'mtest' only supports values of types 'Integer'. (Did this as a sanity check)

 

Steps-

Read excel rows.

In apply all.

Move field to variable (MtestS) string variable.

inc variable (mtest) integer 

3 REPLIES 3
Highlighted
Super User III
Super User III

Re: conversion issue string to int

@MarkIreland 

I'm not sure why this is happening and I can't seem to replicate it.  However, try this - assign your string value to a Compose action.  Then, reference the Compose action when adding to your running total - you shouldn't need the int() expression as Flow should handle this for you automatically.

 

 

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

Scott
Highlighted
Helper III
Helper III

Re: conversion issue string to int

@ 

 

HI, I then get the same error :-

 

The variable 'mtest' of type 'Integer' cannot be initialized or updated with value '' of type 'String'. The variable 'mtest' only supports values of types 'Integer'.

 

If I int it. I get 

Unable to process template language expressions in action 'Increment_variable' inputs at line '1' and column '14474': 'The template language function 'int' was invoked with a parameter that is not valid. The value cannot be converted to the target type.'. 

 

Ideas please?

Highlighted
Helper III
Helper III

Re: conversion issue string to int

I have done an experiment, in that I created a brand new excel sheet. With just dummy data.

 

The flow then works!

 

I assign the excel field to a string variable

then increment the integer field using Int(....) 

 

Why is one sheet working but another does not? Can I resolve? what is the cause?

Helpful resources

Announcements
firstImage

Super User Program Update

Three Super User rank tiers have been launched!

firstImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

firstImage

New & Improved Power Automate Community Cookbook

We've updated and improved the layout and uploading format of the Power Automate Cookbook!

thirdimage

Power Automate Community User Group Member Badge

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

Top Solution Authors
Users online (4,271)