September 20, 200421 yr I may be the biggest dummy around but... I have more problems getting the set field script to work. Are there some special rules which I am not aware of which aren't listed in the manuals and tutorials? I know I have to have a relation between tables to use it between two tables, but my calculation never ever gets placed in the field it's supposed to set! They are both number fields, no other relations, no other validation. This is driving me crazy!
September 20, 200421 yr Perhaps you could elaborate and give some specific examples of your problem. The basic use of Set Field is fairly simple Set Field [fieldtoset; fieldorcalculationortext].
September 20, 200421 yr Author Ok..I have two different tables NewDesign & Rooms The new design table has an autoserialized field (designser_pk). I need to get the current # in that field and place it in the corresponding field (designser_fk) in a layout on the rooms table so that the rooms are tied to the serial number created in the other table. I made a script which Go to Layout-New system design Perform find sort records go to last record set field [rooms::designser_fk; Newdesign::designser_pk] go to layout room_layout based on my figuring that should place the last records value from newdesign designser_pk into the rooms designser_fk field shouldnt it?
September 20, 200421 yr Yes, but it will place it in the first related record's field, based on how rooms is related to Newdesign.
September 20, 200421 yr Author Thats just it, even when there is only 1 record it still won't show up.
September 20, 200421 yr If rooms is related to Newdesign based on pk to fk, then there would appear to be no related record when you're setting the fk. Usually what you want to do is set the parent key in a global. Then you go to the other table, create a new record, and set the foreign key with the global's data.
September 20, 200421 yr hi joe - instead of using a find in your script, try using the get related field step and choose the relationship you've specified between the two files. Set up a new script and test it first by just specifying that step, then checking the results in the other file. hth. Tony
September 21, 200421 yr Author Hey Tony. Thanks for the input but I don't have a get related field step in my scrpts. I have get related record but it doesn't seem to let me specify a certain field. Am I looking in the wrong area?
September 21, 200421 yr Go to Related Record is the step, but I don't see how it would help you in this situation. You are showing all records and then finding and setting the most recent one's data to a (currently) non-related table.
September 23, 200421 yr Hmm, I was getting from his first post that the tables were related. Is that right, Joe? Tony
September 23, 200421 yr <Reread thread> I see now what you meant - the first two tables ARE related and you're trying to relate the other table to that same key. You need to do what -Queue- said below. Usually what you want to do is set the parent key in a global. Then you go to the other table, create a new record, and set the foreign key with the global's data. Tony
Create an account or sign in to comment