cancel
Showing results forย 
Search instead forย 
Did you mean:ย 

Error calculating input for field 'myField': wrong number of arguments (given 1, expected 0)

rpatrick_
Deputy Chef II
Deputy Chef II

Error calculating input for field 'myField': wrong number of arguments (given 1, expected 0)

I need help figuring out what this error means--why does it expect 0 arguments? How can I fix this? 

This is the formula that I have mapping to the field: [DATAPILL]&.to_date(format:"MM/DD/YYYY")

Please let me know if any additional info is needed. Any guidance is appreciated, thank you!

9 REPLIES 9

rajeshjanapati
Executive Chef I
Executive Chef I

Hi @rpatrick_,

your pill may be "now" or "today", which does not return a datetime input as a user-defined string by default, so  you need to add "strf" formula to make it user-defined string, because of that, it is throwing an error. Please check the below attached image and try it out once, if you face any error again, please do posted here.

Screenshot 2025-11-18 110900.png

Thanks & Regards,

J Rajesh Kumar.

shivakumara
Executive Chef III
Executive Chef III

Hi @rpatrick_ ,

After reviewing the requirement, it appears you are passing dateTime or date as input, which is causing the error:
Error calculating input for field 'myField': wrong number of arguments (given 1, expected 0)
This happens when using the to_date formula, which returns the format YYYY-MM-DD (Required response).

If you are passing a date or dateTime value to to_date, try converting it to a string first. (A sample example is provided below.)



Date_formulae fix.png
Thanks and Regards,
Shivakumara K A

Hello, 

I think you are correct about the type of input being the issue. I first tried with the formula as you've shown, but it still errored. I changed the formula to: &.to_s.to_date(format:"YYYY/MM/DD") - this time getting the nil input error. I then tried: &.to_s&.to_date(format:"YYYY/MM/DD"), and it no longer errors on empty inputs, but it does say invalid date for datapills that are not empty. I noticed that the trigger output has 0022 as the year instead of 2022, so I changed the formula format to be YY/MM/DD, but I still see invalid date. 

image.png

image.png

image.png

What do you think I am missing? 

Thanks for your help, 

Renee

If your Last Provision Date is "0022-05-15", you're kind of hosed because that's not a valid date whether it's a string type or date type. You need to fix that first -- which should probably be fixed upstream in the source application providing the data. The to_date method won't work with "22-05-15". The year needs to be a 4-digit year value.

You can do something wild like this. It assumes all years are 2000 or greater. If you have a year in the 1900s, you're hosed again.

["0022-05-15".split("-")[0].to_i + 2000, "0022-05-15"[5..-1]].smart_join("-").to_date

## output >> "2022-05-15" as date type