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
MPA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

V3_PVA CAmpaign Carousel.png

Community Challenge - Giveaways!

Participate in the Power Virtual Agents Community Challenge

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

R2 (Green) 768 x 460px.png

Microsoft Dynamics 365 & Power Platform User Professionals

DynamicsCon is a FREE, 4 half-day virtual learning experience for 11,000+ Microsoft Business Application users and professionals.

Users online (1,259)