Hi. I have a feedback form that requires an email with submission of user feedback, which is stored in a new row. I would like to manipulate data from that new submission and then send an email to the user. How can I ensure that this gets done without operating on the whole data table, but just on the new submission row of data? What code enables me to only operate instantly on a submission (using pandas) and then send an email to the user right after?
Have you checked out this tutorial:
It does what you want except the manipulation of data before storing/sending the email…
If you’re not sure about the code snippets in the tutorial feel free to ask for clarification.
Yes, I went through that example and I learned several things about updating databases. However, I am not making the connection between how a new row of submitted data can be manipulated outside of the input table, and then sent to a different output table. By manipulated, I mean a function is applied to the feedback to parse it and store the results in output table. Any ideas?
@anvil.server.callable
def add_feedback_input(name, email, feedback):
app_tables.feedback.add_row(
name=name,
email=email,
feedback=feedback,
created=datetime.now()
)
@anvil.server.callable
def some_function (name, email, feedback):
manipulated_feedback = manipulate(feedback)
email = email
name = name
app.tables.feedback_output.add_row(output = manipulated_feedback, name = name, email = email)
it depends. Could you just get rid of the first function and call some_function from client code?
or just combine the logic into a single function instead of two separate functions…
@anvil.server.callable
def add_feedback_input(name, email, feedback):
app_tables.feedback.add_row(
name=name,
email=email,
feedback=feedback,
created=datetime.now()
)
manipulated_feedback = manipulate(feedback)
app.tables.feedback_output.add_row(output = manipulated_feedback, name = name, email = email)
Hi @Chantel,
just to clarify. The feedback is just a variable in your function. You can apply any manipulation to the content of that variable that you want before writing it to the database.
This worked out for me! After lots of trial and error, I was able to get the output that I was looking for. Thank you!!!
Hi yes. It took some trial and error but this eventually worked for me. Thanks!