UDTable duplicate current record into a new record

Hi customization gurus!

I have a few UDTables that I have built up and would like to add a button to the interface that duplicates the current record into a new record. I’m open to whatever the best or easiest solution is.

image

(For reference)
I thought I got fairly far on my own by setting a BPMDataField to the current ID, using the duplicate button to run the oTrans.GetNew() method. Then using a PostProcessing BPM on the GetaNewUD04 method , creating aFill Table by Query tile to fill the new record (using the BMPDataField to query the previous record). However, I ran into some odd errors where the record appears to duplicate in the interface, but after saving/closing/openign the record doesn’t exist.

You said you are calling a GetNew, which get’s your dataset, then updating it to what you need, which is good. Are you calling the update to write it to the database? The base functionality will only save the current record, not the one you are trying to create.

Investigating a little, thanks for the quick reply!

Alright, think I’m still stuck. I’m sure I wrote my BPM wrong, but I just don’t know which part of it.

The original record (0000060):
image
When duplicated, the new record (0000061) appears to work as expected.
I saved and refreshed with no issues to confirm.
image
But when I clear and reopen the new record, all the fields that should have been copied from the ‘Fill table by query’ tile are empty. The fields set via ‘Set field’ tiles keep their correct values though.
image

See below for my WIP BPM.
The condition checks to see whether to create a normal new record (False), or a duplicated record (True).
The 5 ‘Set Field’ tiles set values that are unique to every record, regardless of duplication.
The ‘Fill Table by Query’ is using ‘[ignore]’ on Key1 as Key1 is set by the next tile.

Try using Update Table by Query instead of Fill Table. GetNew will provide a valid row that can then be Updated. Fill Table is generally for use when you have an empty table and need to initialize.

1 Like

I’ll give that a shot.

It’s working!
Thank you Rich!

1 Like