Darren Emery Posted November 22, 2010 Posted November 22, 2010 I would like to be able to create multiple new related records (letters) based upon a found set in (dwellings) using key field (license #.) I know how to do this one at a time with scripting (create new record and copy/paste the key field) - can this be done with many records at a time? Not sure how to get the right number of records created, and how to insert the key fields.... Any help - MUCH appreciated!
Darren Emery Posted November 22, 2010 Author Posted November 22, 2010 As in... export the found set, create new records, import the found set data?
comment Posted November 22, 2010 Posted November 22, 2010 No, as in create a found set in the source table (dwellings?), go to a layout of the target table (letters?) and import directly from the source table.
bruceR Posted November 22, 2010 Posted November 22, 2010 Copy/paste should pretty much always be avoided. There are several ways to gather a list into a variable and then process the list. Set variable [ $list; "A¶B¶C¶D"] Set variable [ $n; valueCount( $list}] Set variable [$k; 1] Loop Exit loop if ($k > $n) New record Set somefield; getValue( $list; $k) Set variable [ $k; $k + 1] End loop
Darren Emery Posted November 22, 2010 Author Posted November 22, 2010 (edited) Ok - I think I see how the variable and loop works. I'm not quite following the first portion of this script: Set variable [ $list; "A¶B¶C¶D"] Do I have to establish a repitition number for the variable? (this will vary, and could be in the 200-300 range at times) {EDIT: it looks to me like Get(FoundCount) would work here - am I on the right track??} {EDIT#2: so found count can get me the number of items in the found list. The loop can then create a new record, and set the key field to the next value in the list... How do I get the individual license numbers into my variable "list"? Edited November 22, 2010 by Guest still learning!
bruceR Posted November 23, 2010 Posted November 23, 2010 No, you do not need to use a repetition number. The example variable just shows how a variable can contain a list. You will have to use a loop to walk the records and collect the list of values. Set variable [ $list; "" ] Go to record [ first ] Loop Set variable [ $list; list ( $list; your::field) ] Go to next record, exit after last End loop
Darren Emery Posted November 23, 2010 Author Posted November 23, 2010 (edited) No, you do not need to use a repetition number. The example variable just shows how a variable can contain a list. You will have to use a loop to walk the records and collect the list of values. Set variable [ $list; "" ] Go to record [ first ] Loop Set variable [ $list; list ( $list; your::field) ] Go to next record, exit after last End loop Thanks - this makes more sense, especially after studying the LIST function and realizing it does not work across a found set, but on a record and related records. Regarding the loop above - can I really use "exit after last record" - or was this more of a shorthand way of saying write the script to advance one and compare, then leave when k>n?:( Edited November 23, 2010 by Guest clarification
Darren Emery Posted November 23, 2010 Author Posted November 23, 2010 Disregard - found the Next(exit after last) script step! Thanks - this makes more sense, especially after studying the LIST function and realizing it does not work across a found set, but on a record and related records. Regarding the loop above - can I really use "exit after last record" - or was this more of a shorthand way of saying write the script to advance one and compare, then leave when k>n?
Recommended Posts
This topic is 5504 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 accountSign in
Already have an account? Sign in here.
Sign In Now