cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
crjwarre
Helper I
Helper I

Collection with DateValue

Hello,

 

I'm trying to create a collection that grabs a text value, a date value, a choice value, and then two number values. I am unable to get the DateValue to work appropriately with the Patch Statement.

 

Collection Creation:

NewForm(NewInsLot); ClearCollect(InspectionCollection, {InsLot: "", ShiftDate: 0, Shift: InputShift.Selected.Value, CompletedUnits: 0, UnitsRemain: 0});Navigate(CreateNewInspectionLot)

 

Patch:

Patch(InspectionCollection, ThisItem, {InsLot: InputInsLot.Text, ShiftDate: DateValue(InputShiftDate.Text), Shift: InputShift.Selected.Value, CompletedUnits: Value(InputCompleteUnits.Text), UnitsRemain: Value(InputUnitsRemain.Text)});

 Thanks for your input!

1 ACCEPTED SOLUTION

Accepted Solutions
rubin_boer
Super User
Super User

hi @crjwarre the input.text should work if the format complies.

 

all of the labels below use the function DateValue(TextInput1_1.Text,"en-US")

 

rubin_boer_0-1615539105101.png

if the format of the date is wrong it will give an error.

 
hey there if you liked the post give it a thumbs up, and if it solved your question please accept it as a solution.

View solution in original post

3 REPLIES 3
rubin_boer
Super User
Super User

hi @crjwarre in the collection the date is set as number, patching it will be a mismatch. you can get the collection to accet the date as a number and must convert it again to date or you can just change the Shiftdate to have a date as default in the collection as today() and all will be sorted 

{InsLot: "", ShiftDate: 0, Shift:

 

Hope it helps

 
hey there if you liked the post give it a thumbs up, and if it solved your question please accept it as a solution.

The Collection as today() worked, but how would that change my patch statement?

ShiftDate: DateValue(InputShiftDate)

this nor .Value or .Text worked.  

rubin_boer
Super User
Super User

hi @crjwarre the input.text should work if the format complies.

 

all of the labels below use the function DateValue(TextInput1_1.Text,"en-US")

 

rubin_boer_0-1615539105101.png

if the format of the date is wrong it will give an error.

 
hey there if you liked the post give it a thumbs up, and if it solved your question please accept it as a solution.

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.

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 (5,462)