Jump to content
Server Maintenance This Week. ×

Create Related Records based on Value List


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

Recommended Posts

Hi,

I'm trying to write a script that will create several new records in one table based on crieria in another table. Here's the simplest explanation I can come up with:

Table has field (name) and field (type). The type field is a radio button set(pulls from value list ) with 2 options. I've made a button in Table Layout1 to create related records in Table Layout2 based on the value of . If the value is "1" then 3 new records will be created in Table . Each new record will 'copy' the data in and 'paste' into . In addition, each new record will get 1 of 3 values from value list to be placed in field . has a total of 11 values.

Still with me?

If the value of is "2" then 6 new records would be created in Table ; 3 would have the same values in as previous and 3 would have 1 of 3 additional values from .

I've attached a .pdf of the script I've written so far (the script is not working). Here's a key:

_TABLES_

Table X = "Master Games"

Table Y = "Shows"

_LAYOUTS_

Table X Layout1 = Form View Games

Table Y Layout2 = Form View Shows

_VALUE LISTS_

vx1 = adPackage

vy2 = Show Type

_FIELDS_

ax = Master Games::gameName

bx = Master Games::adPackage

cy = Shows::Show Name

dy = Shows::Show Type

I've probably made this more confusing than it needs to be. Thank you for any and all help!

-Gideon

NewPromoRecordsScript.pdf

Edited by Guest
Updated Attachment
Link to comment
Share on other sites

Ha! I guess I made it more confusing by substituting generic variables for my table and field names. The .pdf did have the fonts embedded, but I'm uploading it again.

Here's a version of my post without all the silly variables:

The 'Master Games' table has a 'name' field and an 'adPackage' field. The 'adPackage' field is a radio button set with 2 options, 'Promos Only' or 'Promos/Trailers'. I've made a button in the 'Form View Games' layout to create related records in the 'Shows' table ('Form View Shows' layout) based on the value of 'adPackage'. If the value is 'Promos Only' then 3 new records will be created in 'Shows'. Each new record will "copy" the name field from the record in 'Master Games' and "paste" it into the name field in 'Shows'. In additon, each new record will place 1 of 3 values in the 'Shows::Show Type' field. The values are 'Promo - Coming To', 'Promo - Now On', or 'Promo - Evergreen'. The 'Show Type' value list has a total of 11 values. These particular three are numbers 4-6 in the list.

Still with me?

If the value of 'adPackage' is 'Promos/Trailers' then 6 new records would be created in the 'Shows' table. 3 should have the same values in 'Show Type' as above and 3 would have 1 of 3 additional values from the 'Show Type' list- 'Trailer - Coming To', 'Trailer - Premiere', and 'Trailer - Evergreen'.

There is some other information that would copy directly from a 'Master Games' field to a field in other tables, but they are not script dependant. I should be able to figure those steps out based on whatever it takes to perform the steps I've described above.

I hope that makes my question/problem a little clearer.

Thanks!

G

Link to comment
Share on other sites

Interesting - I can see the pdf with Acrobat Reader, but I only get boxes in both Preview and the browser plugin.

I haven't yet re-read your description, but out of the bat I see that your If[] statements are wrong: GetValue() is not what you think it is (see the help on this).

Try something like:

If [ MasterGames::adPackage = "Promos Only" ]

... do something ...

Else If [ MasterGames::adPackage = "'Promos/Trailers" ]

... do something else ...

End If []

Link to comment
Share on other sites

The "create new record" is working, but none of the information I want auto-entered is appearing. I also need to create 3 or 6 similar but uniques records and I'm not sure if I can create a loop script to do this.

Thx/gideon

Link to comment
Share on other sites

This topic is 6566 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.