Jump to content

Concatenated Key Field


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

Recommended Posts

  • Newbies

Hi - I have a table - call it main table - in which the key field is a calculated fields and is a concatenation of 3 text fields. I then have a sub table with the same structure. I am trying to add records to main table from subtable where they don't already exist in maintable. I do this by relating sub table to main table by the key field. My script loops through sub table and where get(lasterror)="101" (ie record is not in main table) I add the record to maintable. Trouble is I can't update fields in main table. The key field is a calculated field so i can't set field directly - but I can't set any of the 3 text fields because FM tells me i have to set the key field first.

Thanks for any help.

Max

Link to comment
Share on other sites

For one thing, you don't have to use the relationship in order to create a related record. You can load the required values into variables, go to a layout of the other table, create a new record and set the relevant fields to the values stored in the variables.

For another, I don't see why you couldn't (and probably should) switch the relationship to use the three text fields as the match fields, and get rid of the calculation field.

I am not sure where error 101 comes into this. Surely you can see if a related record exists by looking at IsEmpty ( RelatedTable::MatchField )?

Link to comment
Share on other sites

This topic is 2302 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
 Share

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.