cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Kosenurm
Post Partisan
Post Partisan

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
Super User
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
Super User
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
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
Power Platform Call June 2022 768x460.png

Power Platform Community Call

Join us for the next call on August 17, 2022 at 8am PDT.

Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

Users online (4,204)