I build this app-based on a SharePoint List.
Here is my list with 3 columns:
my requirement: when the users open the records in the edit screen, they can change the Person Column. And this change will be created as a new record in the list. The original record will say intact.
On start of the App, I create a collection with this Code:
ClearCollect(
ColDemo,
ShowColumns(
Table(Defaults('Test')),
"Title",
"Column1",
"Column2"
)
);
Clear(ColDemo)
And on the On Select of the IconAccept on the Edit screen, I have this Code:
Collect(
ColDemo,
{
Title: txtTitle.Text,
Column1: txtColumn1.Text,
Person: txtPerson.Selected
}
)
I am actually following along with a youtube video, and maybe missing a few steps here. Currently, the application does nothing - no changes are saved to the list. Where do I need to look?
Solved! Go to Solution.
@Canadiansal
Rather than to worry about all those intermediary Collections, instead just
1) add the SharePoint List as a data source directly in your Canvas App, then
2) add a single Button Control to the app and finally
3) simply add this formula below in your OnSelect property of that Button:
Patch(TitleColumnPersonList,LookUp(TitleColumnPersonList,Title = "Test1"),{Person:TextInput1.Text})
and that is all. See if this works better for you.
The response above is presuming the following:
SharePoint List called TitleColumnPersonList (use the name of your SharePoint List instead).
Tested by us - actual result in SharePoint List after the button is clicked in Canvas App:
Notice - that only Person column was changed of only that first row / record!
See it in action below as well:
The example above also presumes:
One Text Input control called TextInput1 for the TextInput1.Text part of the Patch formula. This can just be something else entirely in your case, obviously - you can even just hard code a string value there instead first when practicing.
The Gallery1 being there and hooked to the SharePoint List data source in the visual example above is not presumed or required - it is only there to show it visually in action and that it is working to Patch only the one column in the one record from SharePoint List.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
PS: Just noticed you meant to create new record based on original record. So do it like this instead for that way:
Screen1 OnVisible:
Set(_BaseRecord,LookUp(TitleColumnPersonList,Title = "Test1"))
In this simple example we set one record to the variable on screen visible. You could easily instead adapt this example and Set that variable from another trigger, such as to select a specific record instead from a Gallery, and use the Lookup accordingly there in that property.
Button1 Patch:
Patch(TitleColumnPersonList
,
{Title: _BaseRecord.Title, Column1: _BaseRecord.Column1, Person: TextInput1.Text}
)
Version in action that we think you really wanted:
Check if the above helps you @Canadiansal .
@Canadiansal
Rather than to worry about all those intermediary Collections, instead just
1) add the SharePoint List as a data source directly in your Canvas App, then
2) add a single Button Control to the app and finally
3) simply add this formula below in your OnSelect property of that Button:
Patch(TitleColumnPersonList,LookUp(TitleColumnPersonList,Title = "Test1"),{Person:TextInput1.Text})
and that is all. See if this works better for you.
The response above is presuming the following:
SharePoint List called TitleColumnPersonList (use the name of your SharePoint List instead).
Tested by us - actual result in SharePoint List after the button is clicked in Canvas App:
Notice - that only Person column was changed of only that first row / record!
See it in action below as well:
The example above also presumes:
One Text Input control called TextInput1 for the TextInput1.Text part of the Patch formula. This can just be something else entirely in your case, obviously - you can even just hard code a string value there instead first when practicing.
The Gallery1 being there and hooked to the SharePoint List data source in the visual example above is not presumed or required - it is only there to show it visually in action and that it is working to Patch only the one column in the one record from SharePoint List.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
PS: Just noticed you meant to create new record based on original record. So do it like this instead for that way:
Screen1 OnVisible:
Set(_BaseRecord,LookUp(TitleColumnPersonList,Title = "Test1"))
In this simple example we set one record to the variable on screen visible. You could easily instead adapt this example and Set that variable from another trigger, such as to select a specific record instead from a Gallery, and use the Lookup accordingly there in that property.
Button1 Patch:
Patch(TitleColumnPersonList
,
{Title: _BaseRecord.Title, Column1: _BaseRecord.Column1, Person: TextInput1.Text}
)
Version in action that we think you really wanted:
Check if the above helps you @Canadiansal .
Thank you. This is very helpful!
User | Count |
---|---|
247 | |
106 | |
82 | |
51 | |
43 |