I've created an app for a small library which allows staff to request up to four books at once. This is the code I have in for the request, which works fine:
Set(
varrecordid,
ForAll(
'Cart List'.AllItems,
Patch(
'Book Requests',
Defaults('Book Requests'),
{
Title: TextInput1_3.Text,
'Title(s)': ThisRecord.Title,
'Author(s)': ThisRecord.Author,
Delivery: Dropdown6_2.Selected.Value,
'CPFT Email Address': TextInput1_4.Text,
Address: Dropdown6_4.Selected.Value,
Team: TextInput1_5.Text,
'Due Date': DateValue(Label4_10),
'Selected Loan Period': Dropdown6_3.Selected.Value,
User: Text(varUserEmail),
'Loan Status': Text("On Loan"),
'Total Requesting': Value(TextInput1.Text)
}
).ID
)
);
but I'd also like the number of books available to decrease by one on the original sharepoint list (named 'Library App') when a book is requested. I can only work out how to do this if books were getting requested individually, but how would I update the inventory count for multiple records at once? I tried the below but it didn't like title=thisrecord.title (also this was from when I was testing to reset it to 0, when in reality I would like it to -1, but I couldn't quite work that out either!)
ForAll('Cart List'.AllItems, Patch('Library App', LookUp('Library App', Title=ThisRecord.Title), {'Copies available': 0}));