I am having an issue where my code works correctly in Android phones and incorrectly in iPhone.
Here is my code:
*****************************************
Set(DateVar,DateValue(Left(AvlDatesListBox.Selected.DateNDay,Find("-",AvlDatesListBox.Selected.DateNDay))));
--A sample value for the DateNDay value is: 09/30/2019-Mon
*******************************************
This code works fine in Android phones and returns 9/30/2019 for DateVar value. But it does not work in iPhone and returns a blank value for DateVar
Any thoughts on what could be going wrong?
Solved! Go to Solution.
Hi @prasadvenkat ,
Based on the formula you provided, I found that there is something wrong with it. The Left(AvlDatesListBox.Selected.DateNDay,Find("-",AvlDatesListBox.Selected.DateNDay)) formula would return "09/30/2019-" (including '-' at the end) rather than "09/30/2019".
Please consider modify your formula as below:
Set(
DateVar,
DateValue(
Left(AvlDatesListBox.Selected.DateNDay, Find("-", AvlDatesListBox.Selected.DateNDay) - 1) /* <-- Modify formula here */
)
)
In additon, you could also consider take a try with the following formula:
Set( DateVar, DateValue( First(Split(AvlDatesListBox.Selected.DateNDay, "-")).Result /* <-- Modify formula here */ ) )
Please take a try with above solution, check if the issue is solved.
Best regards,
While I don't have access to both Android and iPhone, I wonder if you could use the Text() function to format the datetime so it appears correctly on both mobile phones. Try this:
Set(DateVar,Text(DateValue(Left(AvlDatesListBox.Selected.DateNDay,Find("-",AvlDatesListBox.Selected.DateNDay))),"m/d/yyyy");
The Text() function takes two arguments: the 1st is a date/number variable and the 2nd is formatting instructions in a text string format. I think the result of the formula will now be 9/30/2019 on both phones. Let me know
Hi @prasadvenkat ,
Based on the formula you provided, I found that there is something wrong with it. The Left(AvlDatesListBox.Selected.DateNDay,Find("-",AvlDatesListBox.Selected.DateNDay)) formula would return "09/30/2019-" (including '-' at the end) rather than "09/30/2019".
Please consider modify your formula as below:
Set(
DateVar,
DateValue(
Left(AvlDatesListBox.Selected.DateNDay, Find("-", AvlDatesListBox.Selected.DateNDay) - 1) /* <-- Modify formula here */
)
)
In additon, you could also consider take a try with the following formula:
Set( DateVar, DateValue( First(Split(AvlDatesListBox.Selected.DateNDay, "-")).Result /* <-- Modify formula here */ ) )
Please take a try with above solution, check if the issue is solved.
Best regards,
great..thx. worked perfect for me. I like the split function.. din't realize powerapps has a split like in traditional scripting languages
User | Count |
---|---|
175 | |
111 | |
86 | |
44 | |
42 |
User | Count |
---|---|
229 | |
118 | |
116 | |
74 | |
67 |