this one might be a bit long, so I can kind of describe how I have things set up. I'm still fairly new to PowerApps so if I have something set up incorrectly, please let me know, open to all criticism haha.
So I am creating an expense report application that has multiple screens it goes through before submitting the data to a sharepoint datasource. I am using collections because I am creating multiple line items attached to a specific expense report, but for some reason when creating the line item it's not patching anything when I test locally.
On my home page, I have a Gallery that I have called Gallery3 that pulls the information from the sharepoint datasource to display the specified users expense reports. You have an option to create a new expense report, or go into the specified report that you want. When creating a new expense report, this is the following code I have for that:
Set(LastScreen, "Home Screen");NewForm(Form2);Navigate('Create Expense Report', ScreenTransition.Cover);ClearCollect(ExpenseReports, {ID: 0, Title: "", Date: Today(), Comment: "", UserName: "", ExpenseName: "", ExpenseType: "", PaymentMethod: "", ExpenseCost: "", Receipt: ""})
Once on the next screen, you're able to create a new expense report with the options of "Report Name", "Transaction Date", and "Requestor Comment" with the option to cancel or create the new report. When creating the new report, this is the following code I have for that:
Set(LastScreen, "Create Expense Report");SubmitForm(Form2);Collect(ExpenseReports, {ID: Gallery3.Selected.ID, Title: ReportNameInput.Text, Date: DateValue(DateValue3), Comment: RequestorComment.Text, UserName: Requestor.Text});Navigate('Expense Report Page', ScreenTransition.Cover)
On the next page is the actual expense report screen, you can get to this screen from the line item on the first screen or when you create a new report. On the top it had the details of the report obtained in a switch statement depending on which page you are coming from. Example:
Switch(LastScreen, "Home Screen", Gallery3.Selected.'Expense Report Number', "Create Expense Report", Form2.LastSubmit.'Expense Report Number', "New Line Item", Gallery3.Selected.'Expense Report Number')
At the bottom of the page is where it's supposed to display the specified expense attached to the whole report. I have a gallery that is attached to my collection with a button to create a new line item. In the new line item is where I seem to be having issues. In here it displays the Report Name, Requestor, and Transaction Date that was saved before, and then has the user input the Expense name, image of a receipt, Expense Type (Dropdown), Payment method used (Dropdown), and Expense Cost. Once all that information is all filled in there is a "Submit Expense" button down at the bottom that has the following code:
Set(LastScreen, "New Line Item");Navigate('Expense Report Page', ScreenTransition.Cover);Patch(ExpenseReports, LookUp(ExpenseReports, ID = Gallery3.Selected.ID), {ExpenseName: ExpenseNameInput, ExpenseType: ExpenseTypeInput, PaymentMethod: PaymentMethodInput, ExpenseCost: Value(ExpenseCostInput.Text), Receipt: UploadedImage1.Image});
This then takes you back to the Expense Report screen, but when there the line items aren't populating with the data from the collection and when checking the collection, all the fields are blank. This is the data in the line items that should be updated.
Subtitle - Text(ThisItem.ExpenseCost, "$#,###0.00")
Both of those are coming up blank as well as the data in the collection is empty. Once I got the line items to get data correctly, I was going to patch my sharepoint document with all the information in the collection and the multiple line items.
I'm sure I may have set some of this up incorrectly because I'm still pretty new to how PowerApps works, so any assistance would be helpful. Please let me know if you need anymore information about this.