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 / If variable empty then...
Power Automate
Unanswered

If variable empty then write null otherwise the variable

(0) ShareShare
ReportReport
Posted on by 35
if(empty(variables('VariDouble7')),0,variables('VariDouble7'))
 

Hello everyone

once again I need your help with my import into a SharePoint list from Excel.
I have numerical values these I have now set a variable.

 

Schroeter_1-1665653439164.png

 

Schroeter_0-1665653415963.png
Now this value should be transferred to the SharePoint list.
First he always shows me an error
 
The 'inputs.parameters' of workflow operation 'Element_erstellen' of type 'OpenApiConnection' is not valid. Error details: Input parameter 'item/Duration_x0020__x0028_Days_x0029' is required to be of type 'Number/double'. The runtime value '""' to be converted doesn't have the expected format 'Number/double'.
 
There are about 10 such columns
Now I wanted to tinker in an if condition.
 
if(empty(variables('VariDouble3')),0,variables('VariDouble3'))
Schroeter_2-1665653641083.png

 

But now he puts zero everywhere. Have checked an example against. Where there is a number in it, it writes a 0.

I hope for your support.

Best regards,

 

 
Categories:
I have the same question (0)
  • Expiscornovus Profile Picture
    33,472 Most Valuable Professional on at

    Hi @Schroeter,

     

    Double is a floating point number/decimal. So, it seems your field expects that.

     

    I see you are using a string in your variable (zeichenfolge). You could turn it into a float with a float function.

     

    Try something like:

     

    if(empty(variables('VariDouble3')),0.0,float(variables('VariDouble3')))

     

     

     

  • Schroeter Profile Picture
    35 on at

    Hello Thanks for the method. Works perfectly.

    But I keep getting an error, but I can't find the column.

     

    Unable to process template language expressions in action 'Element_erstellen' inputs at line '0' and column '0': 'The template language function 'int' was invoked with a parameter that is not valid. The value cannot be converted to the target type.'.

     

    Can you tell me how to locate this error?

  • okeks Profile Picture
    802 Super User 2024 Season 1 on at

    I think the error might be in one of your other inputs to the action.

    I fear you need to show us all the functions you used in that action.

  • Schroeter Profile Picture
    35 on at

    Okay..

     

    Schroeter_0-1665662872344.pngSchroeter_1-1665662899843.pngSchroeter_2-1665662936437.png

    Schroeter_3-1665662965453.pngSchroeter_4-1665662983619.pngSchroeter_5-1665663004810.png

    addDays('1899-12-30',int(first(split(variables('varDate1'), '.'))),'yyyy-MM-dd')
     
    this is complete Script
    The process also runs through but simply stops in between.

     

  • Schroeter Profile Picture
    35 on at

     

    Okay..

     

    Schroeter_0-1665662872344.pngSchroeter_1-1665662899843.pngSchroeter_2-1665662936437.png

    Schroeter_3-1665662965453.pngSchroeter_4-1665662983619.pngSchroeter_5-1665663004810.png

    addDays('1899-12-30',int(first(split(variables('varDate1'), '.'))),'yyyy-MM-dd')
     
    this is complete Script
    The process also runs through but simply stops in between.

     

  • okeks Profile Picture
    802 Super User 2024 Season 1 on at

    If you look at the run log, which value does varDate1 have before the problematic action?

  • Schroeter Profile Picture
    35 on at

    Hello,

    Good:

    Schroeter_0-1665684541058.png

     

    Not Good:

    Schroeter_1-1665684574319.pngSchroeter_2-1665684588635.png

     

    thank you

     

     

  • Schroeter Profile Picture
    35 on at

    Maybe it's because I have date with time and some date without time.
    That the formula hangs on it?

     

    addDays('1899-12-30',int(first(split(variables('varDate1'), '.'))),'yyyy-MM-dd')

     

    best regards

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…

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Leaderboard > Power Automate

#1
trice602 Profile Picture

trice602 398 Super User 2025 Season 2

#2
David_MA Profile Picture

David_MA 323 Super User 2025 Season 2

#3
Expiscornovus Profile Picture

Expiscornovus 183 Most Valuable Professional

Last 30 days Overall leaderboard