I am using a Datepicker to select a record to edit but the OnChange function only returns the first record in Sharepoint the list.
I proofed the concept using a table in my Onedrive but that will not work when i release the app to my team and so i need it to work with a Sharepoint list. I have formatted the Sharepoint list column that i want to use for the date as a date/time column when i imported the data and the formula is the same as I was using in the proof of concept (see below line of code) but it only returns the first entry in the list instead of the date i choose from the Datepicker.
Navigate(EditScreen1,ScreenTransition.None, {Date:DatePicker1.SelectedDate})
Is there something wrong with the formula or is there another way to get the Datepicker to select the record i want to edit?
Solved! Go to Solution.
Hi @Alexindistress ,
In your original post, the Date column seems to be Text type since it is a Label in EditForm, however, the "Due Date" column is supposed to be a Date and Time type column. If the column includes Time, even though you have set this column not include Time after the list be set up, data stored in the list is still a whole Date and Time value including time which could not be compared with the date selected in Date Picker Control.
If it is a DateTime column in SP list, you will need to modify the Formula in Item of EditForm to:
LookUp(SPlist, Text(Date) = varDate)
And OnChange of DatePicker need to be modified to:
Navigate(EditScreen1,ScreenTransition.None, {varDate:Text(DatePicker1.SelectedDate)})
Or you could try with below formula in Item of EditForm:
LookUp('Test List', Date < varDate+1 && Date >= varDate)
and below in OnChange of DatePicker:
Navigate(EditScreen1,ScreenTransition.None, {varDate:DatePicker1.SelectedDate})
Hope this helps.
Best regards,
Community Support Team _ Jeffer Ni
If this post helps, then please consider Accept it as the solution to help the other members find it.
Community Support Team _ Jeffer Ni
If this post helps, then please consider Accept it as the solution to help the other members find it.
Hi @Alexindistress ,
Could you please share more details about your App? What is the Item property of the EditForm?
Assuming that you would like to display the item in SP list filtered by the selected date, and Date is not a suitable name for variables, you'd better firstly modify the OnSelect of the DatePicker to:
Navigate(EditScreen1,ScreenTransition.None, {varDate:DatePicker1.SelectedDate})
Then you will need to set Item property of the EditForm to:
LookUp(SPlist, Date = varDate)
Hope this helps.
Best regards,
Community Support Team _ Jeffer Ni
If this post helps, then please consider Accept it as the solution to help the other members find it.
Community Support Team _ Jeffer Ni
If this post helps, then please consider Accept it as the solution to help the other members find it.
Hello @v-jefferni
Unfortunately the issue is not resolved by your suggestion above. I tried putting the Lookup in the DataSource field in the EditForm but this does not return any results and says that there is no data linked to the form.
I tried moving the formula you suggested to the OnSelect for the DatePicker1 and that stopped me picking a date and then sent me to the first record in the list.
Hopefully the screen shot below answers the question of what the property of the edit form is.
I am looking to go directly to to the record that relates to the date selected so that it can be edited. This is a weekly fire alarm test split over two edit screens. I have the rest of the app working, this is the last stumbling block prior to publishing it, which is a shame as i didn't notice it was a problem until i had fixed my other issues...
Hi @Alexindistress ,
You will need to put the LookUp formula into Item property of the Form.
Please notice that:
Datasource property defines which table is the data source, to know how many and what columns are in the table.
Item property defines from which record is the data in the Form retrieving or link to for updating.
Please follow the steps in my last post and try again.
Best regards,
Community Support Team _ Jeffer Ni
If this post helps, then please consider Accept it as the solution to help the other members find it.
Community Support Team _ Jeffer Ni
If this post helps, then please consider Accept it as the solution to help the other members find it.
Hello @v-jefferni
Thank you for the clarification.
I have now edited the code as per the above and have taken a screen shot of the properties. I have also included a screen shot of what happens when I try running the app and select a date.
I guessed that the OnSelect code should be in the OnChange field but other than that the code is exactly as it appears above but have also included a screen shot of that as well.
The app is however still not working. Any assistance at this point will be greatly appreciated.
Hi @Alexindistress ,
In your original post, the Date column seems to be Text type since it is a Label in EditForm, however, the "Due Date" column is supposed to be a Date and Time type column. If the column includes Time, even though you have set this column not include Time after the list be set up, data stored in the list is still a whole Date and Time value including time which could not be compared with the date selected in Date Picker Control.
If it is a DateTime column in SP list, you will need to modify the Formula in Item of EditForm to:
LookUp(SPlist, Text(Date) = varDate)
And OnChange of DatePicker need to be modified to:
Navigate(EditScreen1,ScreenTransition.None, {varDate:Text(DatePicker1.SelectedDate)})
Or you could try with below formula in Item of EditForm:
LookUp('Test List', Date < varDate+1 && Date >= varDate)
and below in OnChange of DatePicker:
Navigate(EditScreen1,ScreenTransition.None, {varDate:DatePicker1.SelectedDate})
Hope this helps.
Best regards,
Community Support Team _ Jeffer Ni
If this post helps, then please consider Accept it as the solution to help the other members find it.
Community Support Team _ Jeffer Ni
If this post helps, then please consider Accept it as the solution to help the other members find it.
Hello @v-jefferni
Many thanks for this. my hair line will receive no more abuse this morning!
Best regards,
Alex
User | Count |
---|---|
254 | |
106 | |
92 | |
47 | |
37 |