Auto adding activities to a table with "Link to table" fields

Good day everyone,

I have two tables, one (Arrival follow up) with the following attributes (date, arrival time and list of activities) and the other one (activities) with the following attributes (Activity name, start time, end time and date [linked to the Arrival follow up table])

I want to add an activity using a snippet, but when I try to add a row to the activities table, it says that the date attribute is read only.

The snippet I am trying to use is this one:

{note}
{Today_Date={time: "YYYY-MM-DD"}}
{dbselect: SELECT rowid() AS Row ID, Date AS Date_id FROM Follow up WHERE Date == @Today_date; space=4fLbX6vrbd5h5SVrR8xEvA; menu=no; multiple=no}
Activity name: {formtext: name=Task}
Start time: {formtext: name=start_time1; default={time: DD/MM/YYYY HH:mm}} {start_time=datetimeparse(Start_time1, "DD/MM/YYYY HH:mm")}
End time: {formtext: name=End_time1; default={time: DD/MM/YYYY HH:mm}} {End_time=datetimeparse(End_tiome1, "DD/MM/YYYY HH:mm")}
{Date=["id":{=row id}, "Value":date_id ]}

{endnote}{dbinsert: INSERT INTO Actividades SET Task=@task, start_time=@start_time, end_time=@end_time, date=@date; space=4fLbX6vrbd5h5SVrR8xEvA; autoaddfields=no}

Thank you very uch for any insight.

Regards,

Hey @Diego_Alejandro
With linked fields, you want to set the value to be a list of row ids (just one row id in this case).
So you should set:

{Date=[{=row id}]}

Let me know if it works

I did the change suggested, but when I trigger the snippet, it gives me the following error:

textblaze

Hi, What type of field is "fecha"? Could you possibly share a screenshot of the your field list in your space?

Hi Scott,

Sure, thank you for the help, I am going to send the picture of the two tables and de details of the "fecha" field.

I tried to add a row with a form, and it allowed me without any issue.

Field Details


Hi @Diego_Alejandro,

It seems that you're trying to set linkrow field value which should be done using our special syntax described here.

Please share your snippet if you need additional help with the syntax.