Skip to main content

Notifications

Power Automate - General Discussion
Answered

Odata: Convert String to Integer, Integer to String

(0) ShareShare
ReportReport
Posted on by 930

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.

 

Categories:
  • Verified answer
    Expiscornovus Profile Picture
    Expiscornovus 31,118 on at
    Re: Odata: Convert String to Integer, Integer to String

    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.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Microsoft Kickstarter Events…

Register for Microsoft Kickstarter Events…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Announcing Forum Attachment Improvements!

We're excited to announce that attachments for replies in forums and improved…

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 145,508

#2
RandyHayes Profile Picture

RandyHayes 76,287

#3
Pstork1 Profile Picture

Pstork1 64,839

Leaderboard