cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Schroeter
Helper I
Helper I

If variable empty then write null otherwise the variable

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,

 

 
8 REPLIES 8
Expiscornovus
Super User
Super User

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')))

 

 

 



Happy to help out! 🙂

Interested in more #PowerAutomate #SharePointOnline or #PowerVirtualAgents content?
Visit my blog, Subscribe to my YouTube channel or Follow me on Twitter


Schroeter
Helper I
Helper I

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
Super User
Super User

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
Helper I
Helper I

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.

 

 

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
Super User
Super User

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

Hello,

Good:

Schroeter_0-1665684541058.png

 

Not Good:

Schroeter_1-1665684574319.pngSchroeter_2-1665684588635.png

 

thank you

 

 

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

Helpful resources

Announcements
Power Automate News & Announcements

Power Automate News & Announcements

Keep up to date with current events and community announcements in the Power Automate community.

Community Calls Conversations

Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

Power Automate Community Blog

Power Automate Community Blog

Check out the latest Community Blog from the community!

Users online (3,731)