I have a label LabelCurrentDate which currently have Today(),
But while onSelect property of Submit Button,
I mentioned DATE: LabelCurrentDate.Text. Its gives in Type Error stating "This type of argument 'DATE' does not match expected type 'DateTime'. Found 'type error'.
How to submit only date in excel.
Solved! Go to Solution.
Hi @admin_ewbinc,
Could you please share more details about the formula within the OnSelect property of the "Submit" button?
Do you use LabelCurrentDate.Text formula as value for the DATE column (Date Time type) in your data source?
Based on the error message that you mentioned, I think there is something wrong with the value (LabelCurrentDate.Text) you provided for the DATE column in your data source.
The DATE column in your data source is required to provided a Date Time value, but the result the LabelCurrentDate.Text formula returned is a Text value.
I assume that you use Patch function to submit your data into your data source, please modify your formula as below:
Patch( 'YourDataSource', Defaults('YourDataSource'), { Column1: "xxxx", ... DATE: DateTimeValue(LabelCurrentDate.Text), /* <-- Modify here */ ... } )
In addition, I think it is not necessary to add a Label control to store the current date, and then reference it as value for the DATE column in your data source. Please also take a try with the following workaround:
Patch( 'YourDataSource', Defaults('YourDataSource'), { Column1: "xxxx", ... DATE: Now(), /* <-- Modify here */ ... } )
More details about DateTimeValue function, please check the following article:
Best regards,
Kris
Can you provide a sample of your code?
It appears that you are passing a Text type to something that is expecting a Date/Time type...
Hi @admin_ewbinc,
Could you please share more details about the formula within the OnSelect property of the "Submit" button?
Do you use LabelCurrentDate.Text formula as value for the DATE column (Date Time type) in your data source?
Based on the error message that you mentioned, I think there is something wrong with the value (LabelCurrentDate.Text) you provided for the DATE column in your data source.
The DATE column in your data source is required to provided a Date Time value, but the result the LabelCurrentDate.Text formula returned is a Text value.
I assume that you use Patch function to submit your data into your data source, please modify your formula as below:
Patch( 'YourDataSource', Defaults('YourDataSource'), { Column1: "xxxx", ... DATE: DateTimeValue(LabelCurrentDate.Text), /* <-- Modify here */ ... } )
In addition, I think it is not necessary to add a Label control to store the current date, and then reference it as value for the DATE column in your data source. Please also take a try with the following workaround:
Patch( 'YourDataSource', Defaults('YourDataSource'), { Column1: "xxxx", ... DATE: Now(), /* <-- Modify here */ ... } )
More details about DateTimeValue function, please check the following article:
Best regards,
Kris
Hi admin_ewbinc,
I believe Kris is correct in the changes needed for your code to work. In the DATE variable, you need to pass a DateTime value, not a Text value -- Kris's first example code shows you how to wrap the text value inside a DateTimevalue() function to get the result you need.
In addition, unless you need to use "LableCurrentDate" elsewhere on the screen, you could just pass the date using the the Now() function which Kris described in the second code example.
Stay up tp date on the latest blogs and activities in the community News & Announcements.
Mark your calendars and join us for the next Power Apps Community Call on January 20th, 8a PST
Dive into the Power Platform stack with hands-on sessions and labs, virtually delivered to you by experts and community leaders.
User | Count |
---|---|
203 | |
171 | |
63 | |
32 | |
31 |
User | Count |
---|---|
338 | |
271 | |
105 | |
71 | |
56 |