Create Screen1 and Screen2 in Screen1 add a button for example I added Add Expenses button and on select of the button I open newform and create an empty collection and navigate to screen2 where I added my form. the code on select of buttons looks like bellow:
NewForm(Form1);ClearCollect(ExpenseCollection, {LineItem: “”, LineCost: 0});Navigate(Screen2)
see image:
Create 2 list in SharePoint
List1 name: Expenselist with the following columns
List2 name: expenseDetails with the following columns
in screen2 I have the form and I added a gullery control and select the datasource expenseCollection datasource which I created with the Add Expenses button
select Form1 and onSuccess in formula bar past the following code or see image:
ForAll(ExpenseCollection, If(!IsBlank(LineItem), Patch(ExpenseDetails,Defaults(ExpenseDetails),{Title:LineItem,ItemCost:LineCost,ExpenseListID:Form1.LastSubmit.ID})))
one the save icon onSelect add the following code or see the image:
Patch(ExpenseCollection,ThisItem,{LineItem:InputItem.Text, LineCost: Value(InputCost.Text)}); Collect(ExpenseCollection,{LineItem:””,LineCost:0})
to show the totalexpenses in the totalexpense I changed it to display mode and in default added the following code to sum total expense:
Sum(ExpenseCollection, LineCost)
on the Orange colored save button in the OnSelect add the following code:
SubmitForm(Form1)