Hello
I am facing an issue with a form in my app.
The problem is when i open the form in view mode, it keeps on showing the data of the previously opened item for one second.
Then displays the data of the currently selected item.
I have a gallery wich displays Sharepoint list items.
On each row i have an icon to view the item in the form.
The OnSelect property of the icon in the gallery is:
Set(
varSelectedItemID;
ThisItem.ID
);;
ResetForm(FormGeneric);;
ViewForm(FormGeneric);;
Navigate(Screen_Form_Generic)
The Item property of the form is set as below :
LookUp(SPList;ID=varSelectedItemID)
As i reset the form i don't understand why the form shows for one second the previous data.
To test the ResetForm function i added a button on the form screen.
When in View Mode this button resets the form fields correctly and the form becomes a New form.
So i think there is no problem with the ResetForm method.
Just to give all information related to this form, on the home screen i have an "Add" button to create an item in the list.
The form default Mode is New.
The OnSelect property of the Add button is :
ResetForm(FormGeneric);;NewForm(FormGeneric);; Navigate(Screen_Form_Generic)
I am not sure if it is relevant to the problem.
Thank you for your help.
If you need additional info let me know.
Solved! Go to Solution.
I use the method you have described and it normally works quickly enough that the previous record is not displayed in the form.
You could try adding the selected record on the gallery button and using this to populate the form item. This way it should be loaded up before navigating to the screen.
Set(
varSelectedRecord;
ThisItem
);;
ResetForm(FormGeneric);;
ViewForm(FormGeneric);;
Navigate(Screen_Form_Generic)
With this method be aware you aren't looking up the data source directly. If your gallery is populated by a local collection you may not be seeing the most up-to-date version of the record.
You can set the record to the latest version by using FormGeneric.LastSubmit() in the form OnSuccess property.
Set(varSelectedRecord, FormGeneric.LastSubmit())
I use the method you have described and it normally works quickly enough that the previous record is not displayed in the form.
You could try adding the selected record on the gallery button and using this to populate the form item. This way it should be loaded up before navigating to the screen.
Set(
varSelectedRecord;
ThisItem
);;
ResetForm(FormGeneric);;
ViewForm(FormGeneric);;
Navigate(Screen_Form_Generic)
With this method be aware you aren't looking up the data source directly. If your gallery is populated by a local collection you may not be seeing the most up-to-date version of the record.
You can set the record to the latest version by using FormGeneric.LastSubmit() in the form OnSuccess property.
Set(varSelectedRecord, FormGeneric.LastSubmit())
Hi Digital, thanks for your help.
I tried what you adviced and it works fine, no delay occurs anymore.
However i had to delete a solution i found in this video to alternate row colors in the gallery :
https://www.youtube.com/watch?v=v66-rwPkVvA
Here is the Items property of my gallery based on the video above :
With(
{records:
SPList
};
ForAll(
Sequence(CountRows(records));
Patch(
Last(
FirstN(
records;
Value
)
);
{rowNumber: Value}
)
)
)
The RowNumber property is used to alternate colors.
If i keep the alternating row colors feature technique i can no longer set the variable 'varSelectedRecord' as the item property of the form.
The error i get is "Expected a value compatible with DataSource"
I think it is because the property "RowNumber" is added to the item.
The form does not recognize it as a valid property of SPList datasource.
Any idea how i can use the varSelectedRecord and the alternating rows colors.
How can i remove this property 'RowNumber' from the item when setting the variable varSelectedRecord ?
I finally get the alternate rows to work.with your solution.
Just had to fetch the listItem based on the ID and assigned it to the variable.
Thanks for your help !
User | Count |
---|---|
253 | |
106 | |
94 | |
50 | |
39 |