Collect('IT Resource booking',
ForAll(Resource,
{Class_Name: Class_In.Text,
Staff_Name: Book_Staff_In.Text,
Booked_Out: Value(DateTime_In.Text),
Resource: Description,
Resource_Code: Resource
}
)
)
@Mpowis
Well, in general, an EditForm is going to be your friend when it comes to doing these type of things. But, since you have put the effort into what you have, getting that to work would be good.
As you're trying to learn, avoid using collections and variables as much as you can. I know all the docs and examples and way too many videos and blogs use them, but they use them either to demonstrate a concept or just plan incorrectly. Think Excel! Which is what PowerApps is built around. You can read more about that from the program manager for PowerApps and the formula builder.
But looking at some of the formulas you did provide, this is a functional equivalent to what you were trying to do, but better performing and easier to maintain. Note, this is based completely on what you had before.
Collect('IT Resource booking',
ForAll(Resource,
{Class_Name: Class_In.Text,
Staff_Name: Book_Staff_In.Text,
Booked_Out: Value(DateTime_In.Text),
Resource: Description,
Resource_Code: Resource
}
)
)
NOW, the better approach is to have the correct column names and values in your collection (again, if you are going to use a collection - some cases need it, but don't overuse).
So, when you are collecting the value, make sure the columns names you use are EXACTLY the same as in your datasource.
Collect(Resources,
{Class_Name: Class_In.Text,
Staff_Name: Book_Staff_In.Text,
Booked_Out: Value(DateTime_In.Text),
Resource: Description.Text,
Resource_Code: Resource.Text
}
)
Above assumes that all of the column names are just as the real names are in your datasource.
Then your submit formula is simply this:
Collect('IT Resource booking', Resources)
All the rest will be done for you.
Hopefully that is helpful and clear.