aharown07 Posted October 17, 2006 Posted October 17, 2006 I've got a bunch of tables I have to import records to on a regular basis. Each table has a numeric ID auto enter serial field. After importing, the next serial increment in each table is wrong... a number already used. So after the importing I need to go to each ID field and tell it to use a "next" serial value that is after the last record I imported. What I want to do is run a script that grabs the hightest IDserial value in each table and plugs it into a field (Global) so I can use it for reference. Now I've got a feeling there are 10 better ways to do this... but anyway, what I find myself wanting to do in this script is make a loop that goes from layout#1, grabs the MAX for it's ID field, does a Set to put that value in my Global, then go to Get(LayoutNumber)+1 and repeat. Of course, the hitch is the id field. They are all the same ("_ID") only w/diff. table names... table:_ID. So I figured I could construct the field name and get the MAX function to use that. Max(Get(LayoutTableName)&":_ID") Won't do it. Wants a field there plain and simple. Is there any way to get it to do that? Or some other way to get the data I want together in one place quickly? I also tried Max(GetField("GlobalWithFieldNameInIt")) and Max($fieldname)but these don't work either. Apparently Max is fussy about how it gets its field name.
aharown07 Posted October 19, 2006 Author Posted October 19, 2006 Eureka! Thanks. I had long forgotten that there was a script step that did this. # DELETE ALL RECORDS # IMPORT Sort Records [ Specified Sort Order: Transactions::Transaction ID ; ascending ] Go to Record/Request/Page [ Last ] [color:red]Set Next Serial Value [ Transactions::Transaction ID ; Transactions::Transaction ID + 1] Of course, I still wish there was a way to use a constructed field name in MAX or GO TO FIELD, etc. That could sure eliminate alot of lines of script.
Recommended Posts
This topic is 6959 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