Using the SharePoint list template, I have an app with the generated BrowseScreen, DetailScreen, and EditScreen,
1: I want to de-clutter my edit screen by offloading the "comments" multi-line text boxes off to another page. So I have a comment icon that when OnSelected, it'll Navigate to the "EditComment" screen. I to pass in selected item's comment field as a context variable upon Navigate by identifying the associated column name that PowerApps has generated for me for the comments field on my sharepoint list.
Navigate(CommentScreen, ScreenTransition.Fade, {Comments: BrowseGallery1.Selected.Vehicle_x0020_Check_x002d_in_x00})
The problem is, if I edit the comments and then go back to the EditScreen, these are not saved/updated when I click the checkmark to save the record. What am I missing here?
2: On my DetailsScreen, how do I get it to automatically adjust the screen's height to accomodate the contents of a multiline text input? The DataCardValue doesn't seem to expand to show all that was entered.
Any help would be appreicated
Hi @flyte
I personally find that as soon as you need some flexibility, then it is better to abandon forms and create your own by using the single controls. You then submit the data via a Patch command that you can customise as you like. It is also much easier to implement business logic.
In your question for example, you would Patch the changes including the comments from the other screen, without even needing a context variable.
Let me be more specific. Say you have a few text inputs, date pickers, drop downs etc. on your first screen and text inputs (multiline) on your second screen. Then to save the changes you just have a button on the first screen something like this:
MySaveButton.OnSelect = Patch(MyDataSource, MyRecord, {ColumnA: TextInputFirstScreen1.Text, ColumnB: TextInputFirstScreen2.Text, ColumnC: DatePicker1.SelectedDate, ColumnD: TextInputSecondScreen1.Text etc. etc.})
Please let me know if this helps
Thanks @Meneghino - I agree, this approach is probably much easier. I find the DataCard / DataValue / DataKey stuff to be confusing! Although it is nice that the templates automatically create the Details and Edit screens for you. I think I can leave the details screen as is, but redo the edit screen from scratch and it should be all good.
How would I Patch a Person/Group column from a SharePoint list? In the DataForm way, the "Created By" column is not exposed as a field in a SharePoint list data source, however somehow that column is set with the proper user whnen SubmitForm() is called.
How do I do this manually via Patch? I don't even have access to that column to be able to set it?
Hi @flyte
The 'Created By' column should be read-only (as should the 'Created Date/Time', 'Modified By', 'Modified Date/Time' columns)
This is because these are system columns and SharePoint (and CDS) fills in the data automatically using the information of the user who is creating or modifying the records.
If you really want a customisable column, I suggest you create another person type column.
Hope this helps.
I now have another problem - on my EditScreen, an icon's color is determine by if(IsBlank(...)) of a TextInput that is on the EditComment screen. Now initially this works, but when I return to the EditScreen, the contents of the TextInput on the EditComment screen isn't reset. Using the approach @Meneghino mentioned in another thread by sending a Context variable to a page upon Navigation, I can reset the contents of my controls on the current page. But not on the EditComments page.
In otherwords, when my EditScreen becomes visible with a reset requested, how do I trigger a reset for a control on the EditComment screen such that my icon color is properly set?
Hi @flyte let me outline a general issue then come back to your specific issue at the end.
I suspect that your issue is related to the way context variables work in PowerApps.
If you continue to work with PowerApps it is important to really understand the above. I suggest you experiment by:
You will see that the two variable values in the two screens are independent. I am not sure that is how I would have designed PowerApps but this has some advantages (i.e. you can copy screens and not worry about having to rename variables)
Now to get back to your specific issue, if you want to reset controls on a screen as you leave it you can set the screen's OnHidden property to
UpdateContext({ResetControls: true}); UpdateContext({ResetControls: false})
If, on the other hand, you want to reset the controls as you navigate to a screen then you can set its OnVisible property to the above.
All this will work for any controls on that screen only, and whose Reset property is set to ResetControls
Please let me know if this helps
Here is another approach by @v-micsh-msft which could be better in some use cases:
Basically if you want to trigger the reset when one or more buttons are pressed then you can set the Reset property of any controls to ButtonA.Pressed || ButtonB.Pressed etc. etc.
Then it does not matter which screen the controls are in, since ButtonX.Pressed is a global variable!
The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.
This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.
User | Count |
---|---|
198 | |
53 | |
41 | |
41 | |
37 |
User | Count |
---|---|
263 | |
86 | |
71 | |
69 | |
66 |