Jump to content
Server Maintenance This Week. ×

Adding multiple records to one table upon creating a new record on another table


xykudyax

This topic is 2351 days old. Please don't post here. Open a new topic instead.

Recommended Posts

  • Newbies

Hi everyone good afternoon!!

I’m dueling with FileMaker trying to make the following:

I have 3 tables (this is for a game I’m developing):

Player (id, name)

PlayerStats (id, playerId, statId, value)

Stats (id, name)

The Player relates to PlayerStats with one to many. The Stats doesn’t relate to anything as I’m using it more like a list source for the “statId” field (or should I make a relation there?)

my question is how can I make it so that when I add a new player record it automatically creates all the PlayerStats entries (on for each entry in the Stats table for that Player) and when deleting a record from Stats table all the PlayerStats that refer to that Stat get removed also.

 

also I don’t know if this is the right forum to post this... but I don’t know where it should go... and I also don’t know if this was asked before as I don’t know what to search for in order to do this. :/ 😐 

Edited by xykudyax
Link to comment
Share on other sites

You will have to script record creation. You can either place a portal on the layout and go to that object or you can go to the native layout and create a records there.

I recommend learning about ERDs. You can use Google, there are tons of examples out there.

  • Like 1
Link to comment
Share on other sites

Here's a demo. However, there is no check to see if there already is a record with the stat for this player (that is, no check for duplicates). Also, what happens if you add a stat? You'd need a script to add that stat to the players_stats table for each player.

xydudyax.fmp12

  • Like 1
Link to comment
Share on other sites

  • Newbies

Thank you so much for your help ;) I'll give it a look!

13 hours ago, bcooney said:

Also, what happens if you add a stat? You'd need a script to add that stat to the players_stats table for each player.

 

That's exactly that!! It will need to be added automatically to every player_stats of each player!

Link to comment
Share on other sites

This topic is 2351 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.