cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Kosenurm
Super User
Super User

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

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

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

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

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
Power Apps News & Annoucements carousel

Power Apps News & Announcements

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

Community Call Conversations

Introducing the Community Calls Conversations

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

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Top Kudoed Authors
Users online (1,903)