Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

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

Recommended Posts

Posted

Can anyone help with a script to generate 10 new records. The records in 2 fields are to be a sequential increase in value by 1 from the previous record but the record in a third field is to be the same for all the new records.

Thanks

  • 1 month later...
Posted

SetField(g_n_counter, 10)

SetField(g_n_field1, 1)

SetField(g_n_field2, 1)

SetField(g_t_field1, ""data you want"")

Loop

NewRecordRequest

SetField(field1, g_n_field1)

SetField(field2, g_n_field2)

SetField(field3, g_t_field1)

SetField(g_n_field1, g_n_field1 + 1)

SetField(g_n_field2, g_n_field2 + 1)

SetField(g_n_counter, g_n_counter - 1)

ExitLoopIf(g_n_fcounter = 0)

EndLoop

My shorthand is as follows

g_n_... = global number

g_t_... = global text

Posted

'g_n_' just the naming convention I use. The field should be defined as a Global Number field under your field definitions. You may name the fields whatever suits you best.

Posted

beginner question

say you want to use the values stored somewhere else to start off your script. How does one "get" the value of a field in another table, and put it into the global variable to start?

Posted

Set up a a constant relationship. In the two files you want to relate together, create a constant key,... define a field as a calculation, = 1, defined as a number. Create the relationship in the file you want to push the information from. In the table where you have the stored data, set the stored value into the related global field. You now have the data at your disposal.

Note that there are several ways to get this info, but this should suffice your needs and shows one way to utilize a constant relationship.

Posted

In versions < 7, an invalid relationship (e.g. global to global) can work much faster than a constant to constant one, especially if there are hundreds or thousands of records in the related file, since the constant relationship has to get the ids of all related records first.

In version 7, global fields are accessible without a relationship. You simply Set Field [table::global, table1::field] or Set Field [table::global, value].

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