cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
efialtes
Kudo Kingpin
Kudo Kingpin

Error when initializing an integer variable with an WDL function

Hi all

I have a string variable called 'HTMLtable' already initialized.

I initialize a second variable, type int, called 'AppsLength'.

I get an error stating the result is a String when I set the initial value to the following 

@sub(length(variables('HTMLTable')),3)

I get the same error when I try the following

@int(sub(int(length(variables('HTMLTable'))),3))

 

 

 

The error message is in Spanish:

La variable "AppsLength" del tipo "Integer" no se puede inicializar ni actualizar con el valor "@int(sub(int(length(variables('HTMLTable'))),3))" del tipo "String". La variable "AppsLength" solo admite valores de los tipos "Integer".

1 ACCEPTED SOLUTION

Accepted Solutions
v-micsh-msft
Community Support
Community Support

Hi @efialtes,

 

Could you please share the flow configuration screenshot about where you are trying to put the formula with?

Based on what I know, variables is still not supported under Microsoft Flow, would you please share more details about the steps you are working with?

If you would like to put the formula directly into the Value input of some Action, then no matter how you format the value with WDL function, it will results in a string.

To make it work, please add a Compose Action, then Copy and paste the following:

"@int(sub(length(variables('HTMLTable')),3))"

After that, use the Compose output as the value input.

 

Regards,

Michael

Community Support Team _ Michael Shao
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

3 REPLIES 3
v-micsh-msft
Community Support
Community Support

Hi @efialtes,

 

Could you please share the flow configuration screenshot about where you are trying to put the formula with?

Based on what I know, variables is still not supported under Microsoft Flow, would you please share more details about the steps you are working with?

If you would like to put the formula directly into the Value input of some Action, then no matter how you format the value with WDL function, it will results in a string.

To make it work, please add a Compose Action, then Copy and paste the following:

"@int(sub(length(variables('HTMLTable')),3))"

After that, use the Compose output as the value input.

 

Regards,

Michael

Community Support Team _ Michael Shao
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

THank you for your fast response, @v-micsh-msft !

 

I've switched into American English and tried to simplify the formula a bit, tested so far

@length(variables('HTMLTable'))

@int(sub(8,3))

 

The error message is the same:

BadRequest. The variable 'AppsLength' of type 'Integer' cannot be initialized or updated with value '@int(length(variables('HTMLTable')))' of type 'String'. The variable 'AppsLength' only supports values of types 'Integer'.

BadRequest. The variable 'AppsLength' of type 'Integer' cannot be initialized or updated with value '@int(sub(8,3))' of type 'String'. The variable 'AppsLength' only supports values of types 'Integer'.

 

Variables are already supported in Microsoft Flow, as per this screenshot. I also include in it the "initialize variable" action block with the last expression I tested:

 

variables.png

I'm having the exact same problem. Crazy.

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.

Users online (3,830)