cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Kosenurm
Helper V
Helper V

Converting date to text or text to date?

Hi,

 

I am building a desk booking app, and want to write back to the Dataverse table when someone has used the QR code to checkin to their desk. This is using First+Filter so that only the user who has booked the desk originally can update the Dataverse.

 

On the Confirm button's OnSelect property, I keep getting an error message of "Incompatible types for comparison. These types can't be compared: Date, Text"...    The column type of 'LDN_Desk_Reservation_Date' is Date Only. 

 

Here is the formula - the lblBookingDate just has a value of "Today()"  but it won't work due to the above error message...

 

Patch(
LDN_Desk_Reservations,
First(Filter(LDN_Desk_Reservations, 'Desk Reference'= QRValue.Text && 'LDN Desk Reserved For' = User().FullName && 'LDN Desk Reservation Date' = lblBookingDate))),
{'Check In Status': "Checked In"}
);

 

Any ideas?

 

Thanks

K.

1 ACCEPTED SOLUTION

Accepted Solutions
shoog
Solution Specialist
Solution Specialist

Assuming lblBookingDate is a label, you would have to use DateValue(lblBookingDate.Text) to get the date value from it.

View solution in original post

3 REPLIES 3
shoog
Solution Specialist
Solution Specialist

Assuming lblBookingDate is a label, you would have to use DateValue(lblBookingDate.Text) to get the date value from it.

View solution in original post

Drrickryp
Super User
Super User

@Kosenurm 

Why not use Today() in your formula instead of lblBookingDate or use a datepicker control instead of a textbox? 

Vikas_Sharma
Frequent Visitor

Hi @Kosenurm 

To convert the date value in the text  you can use Text(),

lblBookingDate is in text format and 'LDN_Desk_Reservation_Date' in date format so you can use 

Text('LDN_Desk_Reservation_Date') for comparison.

Hope this will work.

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Power Apps Community Call Jan. 2022 768x460.png

Power Apps Community Call

Please join us on Wednesday, January 19th, at 8a PDT. Come and learn from our amazing speakers!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Top Solution Authors
Top Kudoed Authors
Users online (2,082)