Team,
I am having text field in SharePoint list. In that the datetieme value is saved as string. For Ex. 7/22/2019 06:05.
I want to bind this value in date pciker control in power apps form.
I tried the below approach but it is not working properly if the time is less than 12 hours.
If(EditFormShiftDetails.Mode=FormMode.New,Hour(Now()),Text(Hour(DateTimeValue(DateText)),"[$-en-US]00"))
DateText is the internal field in SharePoint list. Please help me.
Thanks
Philip
Solved! Go to Solution.
Hi @Anonymous
What values are pre populated in the dropdown. e.g Is the "Items" property of the dropdown has values as: ["00","01","02","03","04","05"...]
To set default value, Text(DateTimeValue("7/22/2019 05:05"),"[$-en-US]hh") which would set the value to "05".
Please note that if the value does not exist in the dropdown the first value is set
The below values are pre-populated in the items property.
["00","01","02","03","04","05","06","07","08","09","10","11","12","13","14","15","16","17","18","19","20","21","22","23"]
Hi @Anonymous
set default value of the dropdown control to:
Text(DateTimeValue("7/22/2019 05:05"),"[$-en-US]hh") // consider only hh part of the datetime
Thanks.
Hi Shilendra,
It is not working any more for drop down controls.
Kindly let me know how can I use the split function to get the hour value.
I have used the below formula, but I get only minute value.
Last(LastN(Split(Datetext, ":"),1)).Result
How can I get the hour value?
Thanks
Philip
Hi @Anonymous
First(Split(Last(Split("7/22/2019 05:05", " ")).Result, ":")).Result
Thanks.
Hi Shilendra,
The formula which you have given is working if we didn't check the condition whether the form mode is new or edit.
Please find the screenshot below and share me your inputs to resolve this issue.
Resulted ScreenShot
UnResulted Screenshot
Same scenario even before this formula applied.
I am in very much trouble. Please help me.
Hi @Anonymous
You are setting the default value of dropdown with the same control default value. The data should be based on the SharePoint List Column. check what is the datafield of the data card and you should consider Parent.Default or the column name itself.
Thanks.
Hi Shilendra,
Even I tried the SharePoint List Column (Internal name of the field is "DateText"), but it is not working.
Please give me an idea. Thanks a lot for your support from morning onwards.
Hi Shilendra,
I just swap the if condition and it started working.
If(EditFormShiftDetails.Mode=FormMode.Edit, Text(Minute(DateTimeValue(DateText)),"[$-en-US]00"), Minute(Now()))
With Split function
If(EditFormShiftDetails.Mode=FormMode.Edit,Last(Split(Last(Split(DateText, " ")).Result, ":")).Result, Minute(Now()))
Thanks for your support.
Thanks
Philip
This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.
Come together to explore latest innovations in code and application development—and gain insights from experts from around the world.
User | Count |
---|---|
200 | |
69 | |
50 | |
46 | |
20 |
User | Count |
---|---|
258 | |
121 | |
84 | |
79 | |
69 |