Hello All,
Hope i may be able to get some help.
I am moving data from excel to a sharepoint list and have two date fields
I am using the below formula to convert the date
addDays('1899-12-30',int(variables('ETDVar')),'yyyy-MM-dd')
it works fine but i need to factor in when the date field is blank and i tried below
if(equals(items('Apply_to_each')?['ETDVar'],''),'',addDays('1899-12-30',int(variables('ETDVar')),'yyyy-MM-dd'))
It fails because of the ETD field being blank for some entries so the above formula must be incorrect.
Unable to process template language expressions in action 'Create_item' inputs at line '1' and column '25038': 'The template language function 'int' was invoked with a parameter that is not valid. The value cannot be converted to the target type.'.
Thanks for your time.
Hi @egornua1 ,
If you go to the run history and go through your loop, are you able to isolate which rows are causing the error?
You can either fix up the values in your excel or implement some sort of exception handling which will skip those rows here.
--------------------------------------------------------------------------
If I have answered your question, please mark my post as a solution
If you have found my response helpful, please give it a thumbs up
Try something like the following to test if ETD is empty or not:
if(empty(item()['Value']),'Empty!', 'Not empty!')
Ellis
@eric-cheng - hi Eric, yes its definitely the rows were the date field is blank so the formula must be incorrect.
I added a date to one of those rows and it populated the list.
Thanks for the reply
@ekarim2020 - thanks for the reply.
It won't do the create action when the date is blank.
when i populate a date it creates in the list
thank you
Hello All,
Anyone with any other ideas on this?
the transfer between excel and sharepoint works fine with the exception of if a date field is blank
In the input dataset some dates are blank so really need to factor that in
thank you
Hi @egornua1 ,
I tried the below and it should ignore your date formula if the value from Excel is blank.
As I mentioned before, are you sure there aren't other values in your Date column which is not blank but is not a valid date either?
--------------------------------------------------------------------------
If I have answered your question, please mark my post as a solution
If you have found my response helpful, please give it a thumbs up
@eric-cheng - Thanks for taking the time to respond.
So i checked the output for the list rows in table output and it looks fine.
In the example below, i took a row where one date field was blank and other was populated.
I do not see anything additional in the blank date fields.
"Vessel ETD_x002e_":"","Vessel ETA_x002e_":"44392"
when both dates are populated in excel this entry goes through no problem.
Hi @egornua1 ,
Here is an Excel with a date formatted column
When I run List rows in table
[{"@odata.etag":"","ItemInternalId":"4a590d9a-f161-476b-8c89-79d8bde2d877","Status":"NEW","Tester Name":"Bob","Vessel ETD":"44393"},{"@odata.etag":"","ItemInternalId":"53c47fb7-3343-4aa8-bc96-e0880e9c02af","Status":"","Tester Name":"Sally","Vessel ETD":""},{"@odata.etag":"","ItemInternalId":"63beeac5-d9d9-406d-915e-b5f16706280c","Status":"NEW","Tester Name":"John","Vessel ETD":"44393"}]}}
Flow with the below formula. It will check the value of Vessel ETD and write empty if it is blank, otherwise it will write the date value
SharePoint list
If you pasted your original formula into an IF function, it will not work. You need to use a formatDateTime function to cast your date to a 'yyyy-MM-dd' format
--------------------------------------------------------------------------
If I have answered your question, please mark my post as a solution
If you have found my response helpful, please give it a thumbs up