web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Checking for invalid d...
Power Automate
Unanswered

Checking for invalid datatype and replace with null if invalid

(0) ShareShare
ReportReport
Posted on by 104

I am reading data from an excel table and writing to Dataverse.  I have a few fields in the excel table that should be numeric; but are sometimes empty or a user could mistakenly write a letter or word into, and cause it to have invalid data.  The target fields in Dataverse are set to type decimal.

 

When I run the flow the bad fields are causing an error.

David2831_0-1658250546467.png

 

The empty field is showing as value "" (two double quotes) which is not numeric and causes the error. 

 

David2831_1-1658250956567.png

 

I need a way to check for invalid values and replace with 'null' in those cases.  And I would like to do that with an expression if possible.  I am currently using an expression to map the excel fields to the Dataverse fields as shown above, for example, the AIRLINES0600 uses this = 

 

items('Apply_to_each_2')?['AIRLINES0600']

 

Would it be possible to add some additional logic to this line?  Test for numeric and if it fails use the value null instead?  I don't know the syntax enough to know how to do this.

 

Thank you.

Categories:
I have the same question (0)
  • Verified answer
    ScottShearer Profile Picture
    25,270 Most Valuable Professional on at

    @David2831 

    I don't know of a way to do this in a single expression but here is a link that shows a couple of techniques to validate that you have a number.  There is no built-in ability in Power Automate to use Regular Expressions at least without an additional license.

     

     

     

  • David2831 Profile Picture
    104 on at

    Sorry for the late response.

     

    We resolved this issue by using data validation in excel, requiring numeric values for these fields.  Now if the users type a letter or leave the field blank, excel will give an error, or fill in a zero, depending.

     

    Marking this resolved, thank you.

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 538 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 405 Moderator

#3
abm abm Profile Picture

abm abm 252 Most Valuable Professional

Last 30 days Overall leaderboard