Attempting to lookup all records with similar email addresses, then take the Location field from each and combine into a new record. The formula is shown below. The error received is shown below.
Thanks
John
---------------------------Formula------------------
from collections import defaultdict
email_locations = defaultdict(list)
Iterate over each record
for record in Guest_List_Reminder_For_Email.lookupRecords():
# Add the location to the list of locations for the corresponding email address
email_locations[record.Email].append(record.Location)
Create a list to store the combined records
combined_records = []
Iterate over the email addresses and their corresponding locations
for email, locations in email_locations.items():
# Combine the locations into a single string separated by commas
combined_location = ', '.join(locations)
# Create a new record with the combined email address and location
combined_record = Guest_List_Reminder_For_Email(
Last_Name=$Last_Name,
First_Name=$First_Name,
Email=email,
Row=$Row,
Order_ID=$Order_ID,
Order_Date=$Order_Date,
Seat=$Seat,
Location=combined_location
)
# Add the combined record to the list
combined_records.append(combined_record)
combined_records
--------------------------------Error Received---------------------------------------------
TypeError : ‘UserTable’ object is not callable
A TypeError
is usually caused by trying
to combine two incompatible types of objects,
by calling a function with the wrong type of object,
or by trying to do an operation not allowed on a given type of object.
Python indicates that you have an object of type UserTable
,
followed by something surrounded by parentheses, (...)
,
which Python took as an indication of a function call.
Either the object of type UserTable
was meant to be a function,
or you forgot a comma before (...)
.