cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
BenDonahue
Skilled Sharer
Skilled Sharer

Odata: Convert String to Integer, Integer to String

I need to convert a value from string to integer.

 

outputs('C-DatesForYearKey') eq item()?['cr508_yearkey']

 

where outputs('C-DatesForYearKey') is a one data type and item()?['cr508_yearkey']is another

 

Please,

 - how can I convert the string into an integer?

 - how can I convert the integer into a string?

 

This would be a short integer.

 

Thank you for your assistance.

 

(Suuuuuper simple task. Suuuuuper tough to find the answer, either in the docs or on the web)

 

Failed Solution

I really thought I had a workaround by converting the data first in a Compose, where it is posted hot to convert string to int and int to string (int() and string(), conveniently enough; looking at you, OData). But, no. The OData operation seems to convert integers to strings, if they come from certain sources, but not if they come from a List Rows block, like so:

 

CONVERTING TO STRING IN COMPOSE BEFORE COMPARISON:

BenDonahue_0-1635257807230.png

PRODUCES THIS ERROR:

"Found operand types 'Edm.String' and 'Edm.Int32' for operator kind 'Equal'."

BenDonahue_0-1635258185380.png

 

...so I converted to int(), which, spoiler alert, produced the exact same error:

BenDonahue_2-1635257904780.png

And the error:

"Found operand types 'Edm.String' and 'Edm.Int32' for operator kind 'Equal'."

BenDonahue_4-1635257940776.png

 

As OData seems to selectively convert data types, I need an OData command to convert string to int and int to string, which is bizarrely difficult to find/do.

 

Thank you, again, for your assistance. Learning (and posting) this will go a long way to making Power Automate usable for me, and others, I am sure.

 

1 ACCEPTED SOLUTION

Accepted Solutions
Expiscornovus
Dual Super User
Dual Super User

Hi @BenDonahue,

 

It looks like the first part of your Odata filter is a string and the second part is of data type integer.

 

So, I think your filter expects this:

cr508_rosterkey eq '10001'

 

I would convert C-DatesForYearKey to a string and put it between single quote characters in your filter.

View solution in original post

1 REPLY 1
Expiscornovus
Dual Super User
Dual Super User

Hi @BenDonahue,

 

It looks like the first part of your Odata filter is a string and the second part is of data type integer.

 

So, I think your filter expects this:

cr508_rosterkey eq '10001'

 

I would convert C-DatesForYearKey to a string and put it between single quote characters in your filter.

Helpful resources

Announcements
MPA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

Learn to digitize and optimize business processes and connect all your applications to share data in real time.

Power automate tips 768x460 v2.png

Restore a Deleted Flow

Did you know that you could restore a deleted flow? Check out this helpful article.

Microsoft Build 768x460.png

Microsoft Build is May 24-26. Have you registered yet?

Come together to explore latest innovations in code and application development—and gain insights from experts from around the world.

Users online (2,551)