Jump to content
  • 0

How to put records from one table into another table?



Hello everyone, I hope someone can help me with this. So, I have 2 tables I have connected: Resources and Team Members where Resources is parent table and Team Members is child table. When I add certain person that exists in Resources table to the Team Members table, I want to have their email, job title and some other fields automatically in this table without having to type them again. For example, when I have person XY in Resources table (and all data related to that person including the email, job title, etc.) I want those values to be copied in Team Members table when I select person's XY name from the dropdown. What would be the best way to do this? I tried to create inner join between email fields and job titles fields between those 2 tables but it seems this is not a solution. I've already created a relationship between those 2 tables (I connected ID fields). Thank you all in advance.

Link to comment
Share on other sites

6 answers to this question

Recommended Posts

  • 0

If you want to actually copy the email and other fields over to the Team Members table, you could use an Insert Trigger to set the value of the newly inserted record.

But you shouldn't have to do that if you already saved that data in the Resources table. 

Are you using an ID field in the Team Members table to link the 2 tables? If you save the Resource Table ID for the Team Member user field, you should be able to get the related data in your datapages. You can use cascading elements in the datapage wizard, cascading off of the chosen User and using the Resource table as the lookup. Match on the ID field and select whatever you need for value.  You can also join these together in Relationships to set the display value on your datapages, so it doesn't look like the ID but the display value. 



Link to comment
Share on other sites

  • 0

Hi @Aleksandra,

You can do this using triggered actions.

Your two tables should have a linking fields, the primary key and the foreign key. The Resources table holds the primary key, and the Team Members table holds the foreign key. Here's my table structure:

Resources table:



Team Members table:



Create the ff Trigger on the Team Members table:




When you add a new record on the Team Members table, the corresponding email, job title of that Resource from the Resource table would be grabbed and saved to the Team Members table


Link to comment
Share on other sites

  • 0

If you don't want to use triggered actions, you can pass parameters on exit and create an auto-submit datapage where your first form can redirect to. Have that datapage receive the parameters on load and use the script here for auto-submission:

However, this may look a little slow on your users' end depending on the number of  fields passed. You can then set the redirection of this datapage to another page where you originally want your users to be redirected to after submission.

The main disadvantage of this versus triggered actions is that, you can only pass the parameters using the feature of caspio if you have many fields as query strings (URL one) is only limited to 255 characters, I believe.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...