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

Initializing Integer Variable

Has anyone tried to initialize an integer variable from dynamic content? No matter what I do everything comes across as a string, even when using the int() function.  I'm trying to either convert an exisiting string variable OR set an integer variable from a microsoft form field.  Ideally I could convert this into an integer and leave it that way. 
@{int(substring(triggerBody()['raa1dad7fbf5d4bea93ffc74a658f7bd8'],0,3))}

 

When I try to initialize a int variable I get an error like this, even when using the int() function...
BadRequest. The variable 'vSchoolID' of type 'Integer' cannot be initialized or updated with value '26' of type 'String'. The variable 'vSchoolID' only supports values of types 'Integer'.

1 ACCEPTED SOLUTION

Accepted Solutions
v-micsh-msft
Community Support
Community Support

Hi @robertcaretta,

 

The issue here should not be the Variable, but the value you configured with this variable.

"The variable 'vSchoolID' of type 'Integer' cannot be initialized or updated with value '26' of type 'String'."

If you leave the following code into the value input, it will add double quotes automatically, which will then convert any value into a string.

@{int(substring(triggerBody()['raa1dad7fbf5d4bea93ffc74a658f7bd8'],0,3))}

To make it work, take a try to add a Compose Action, then under the Compose Input, copy and paste the following:

"@int(substring(triggerBody()['raa1dad7fbf5d4bea93ffc74a658f7bd8'],0,3))"

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

 

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

2 REPLIES 2
v-micsh-msft
Community Support
Community Support

Hi @robertcaretta,

 

The issue here should not be the Variable, but the value you configured with this variable.

"The variable 'vSchoolID' of type 'Integer' cannot be initialized or updated with value '26' of type 'String'."

If you leave the following code into the value input, it will add double quotes automatically, which will then convert any value into a string.

@{int(substring(triggerBody()['raa1dad7fbf5d4bea93ffc74a658f7bd8'],0,3))}

To make it work, take a try to add a Compose Action, then under the Compose Input, copy and paste the following:

"@int(substring(triggerBody()['raa1dad7fbf5d4bea93ffc74a658f7bd8'],0,3))"

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

 

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

That works, thanks. At least my JSON is properly formatted now.

Is there a reason why we can not initialize an integer variable with dynamic content?

Helpful resources

Announcements
Process Advisor

Introducing Process Advisor

Check out the new Process Advisor community forum board!

MPA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

MBAS Attendee Badge

Claim Your Badge & Digital Swag!

Check out how to claim yours today!

Users online (43,253)