Skip to main content
Solved

Creating a new record from an old record


Forum|alt.badge.img+2

I am reading a record from a SDE geodatabase and using that record to create a new record. What is happening though is that it is just overwriting the old record. I need to have two records at the end. I select it based on an id and essentially need to make a copy of the record and then overwrite some of the values. Any idea of how I can do that?

Best answer by koenterralytics

chris28 wrote:

My writer is set to insert. I select a record based on an id number in the table. I then update the attributes based on user parameters. However, it is updating the original record. I want to keep the original record and create a new record based on values in it. So essentially I want to copy the entire record and overwrite some of the attributes and give it a new id number. Does this make sense? I can use a tester to select the record. I just can't seem to find a transformer that would make a copy of it after it is selected.

Hi Chris,

I think the screenshot from my previous message should work. To make it more clear I added some more context:

imageHopefully this helps! If not, feel free to email the workspace to koen@terralytics.nl

View original
Did this help you find an answer to your question?

6 replies

koenterralytics
Contributor
Forum|alt.badge.img+8

@chris28​ , my first guess would be that your output contains an OBJECTID or GlobalID and your writer is set to Update (instead of Insert). To be sure, you are trying to add a new record to the same table?


Forum|alt.badge.img+2
  • Author
  • May 6, 2022
koenterralytics wrote:

@chris28​ , my first guess would be that your output contains an OBJECTID or GlobalID and your writer is set to Update (instead of Insert). To be sure, you are trying to add a new record to the same table?

My writer is set to insert. I select a record based on an id number in the table. I then update the attributes based on user parameters. However, it is updating the original record. I want to keep the original record and create a new record based on values in it. So essentially I want to copy the entire record and overwrite some of the attributes and give it a new id number. Does this make sense? I can use a tester to select the record. I just can't seem to find a transformer that would make a copy of it after it is selected.


koenterralytics
Contributor
Forum|alt.badge.img+8
chris28 wrote:

My writer is set to insert. I select a record based on an id number in the table. I then update the attributes based on user parameters. However, it is updating the original record. I want to keep the original record and create a new record based on values in it. So essentially I want to copy the entire record and overwrite some of the attributes and give it a new id number. Does this make sense? I can use a tester to select the record. I just can't seem to find a transformer that would make a copy of it after it is selected.

Why do you want to make a copy if the data is already available in the dataset?

I think you can just insert the new records, but first make sure that the field ObjectID and/or Globalid are removed before it enters the writer.

But if you are really looking for a copy within the workspace itself, consider using the Cloner. Or just split the workflow in two separate lines. But I think I'm still missing the whole picture.

image


Forum|alt.badge.img+2
  • Author
  • May 6, 2022
chris28 wrote:

My writer is set to insert. I select a record based on an id number in the table. I then update the attributes based on user parameters. However, it is updating the original record. I want to keep the original record and create a new record based on values in it. So essentially I want to copy the entire record and overwrite some of the attributes and give it a new id number. Does this make sense? I can use a tester to select the record. I just can't seem to find a transformer that would make a copy of it after it is selected.

The first record is for an invoice. The invoice is being cancelled so I need to keep the original record and update cancelled to 'YES" and then create a new record with a new invoice number based on the old record. A bunch of the fields with values will be set to negative based on the original invoice. (No idea how to sent a PM on here or I would. Total Newbie)


koenterralytics
Contributor
Forum|alt.badge.img+8
chris28 wrote:

My writer is set to insert. I select a record based on an id number in the table. I then update the attributes based on user parameters. However, it is updating the original record. I want to keep the original record and create a new record based on values in it. So essentially I want to copy the entire record and overwrite some of the attributes and give it a new id number. Does this make sense? I can use a tester to select the record. I just can't seem to find a transformer that would make a copy of it after it is selected.

Hi Chris,

I think the screenshot from my previous message should work. To make it more clear I added some more context:

imageHopefully this helps! If not, feel free to email the workspace to koen@terralytics.nl


Forum|alt.badge.img+2
  • Author
  • May 12, 2022
chris28 wrote:

My writer is set to insert. I select a record based on an id number in the table. I then update the attributes based on user parameters. However, it is updating the original record. I want to keep the original record and create a new record based on values in it. So essentially I want to copy the entire record and overwrite some of the attributes and give it a new id number. Does this make sense? I can use a tester to select the record. I just can't seem to find a transformer that would make a copy of it after it is selected.

Thanks! It worked to remove the objectID.


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings