Jump to content

Set Field Problems


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

Recommended Posts

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! confused.gifconfused.gif

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

<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

Link to comment
Share on other sites

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