PC SOFT

FORUMS PROFESSIONNELS
WINDEVWEBDEV et WINDEV Mobile

Accueil → WINDEV 2024 → [WB19] Duplicate the Record
[WB19] Duplicate the Record
Débuté par Randall, 28 oct. 2014 17:15 - 5 réponses
Posté le 28 octobre 2014 - 17:15
Hi,

Is there a way to Duplicate a Record with a Unique Key from the Control Center... easier than adding a blank record and filling it in from scratch?

A popup shows the unique key outlined in Red, but changing it there doesn't help... apparently it's the original field value, and copying the record with the edited value still results in a duplicate key, and it won't allow it.

I tried to Create a Temporary table on the fly with SQL to copy it there, change it and copy it back... but the Control Center doesn't recognize the word "Temporary".

Thanks in Advance for any help on this...
Posté le 29 octobre 2014 - 12:00
Hi Randall,

if you mean the HFSQL Control Center, then right click on the record and in the context menu choose 'Duplicate the record'.
Posté le 29 octobre 2014 - 13:12
Hi Stefan,

It doesn't work when there's a unique key. I guess because copying the record would duplicate the key field, so there's a popup warning. Unfortunately, it doesn't appear to be editable. It's my thinking that the popup should give you the opportunity to change the field of the new record, but it appears it gives you the opportunity to change the field of the record being duplicated... then as it tries once again to duplicate it, the key is the same, and the popup warning is there again. It actually appears to grab the key value of the first record in the table...

It would be good if you could right click and at least duplicate everything on the record except the duplicate key, but there's no option to do that. I have to add a record from scratch and fill in everything myself because apparently it's all or nothing.

Thanks in Advance for any help on this...
Posté le 29 octobre 2014 - 14:05
Hi Randall,

indeed you got an popup, with the problem key-value in red. But when I duplicate a record (with a unique key) I can change the key value that is in the red area. After that I can save it by clicking on OK.
Posté le 29 octobre 2014 - 14:23
[attachment 1242 duplicatekey.png]

Yes the area in Red is editable, however... two things:

The record in the popup shows the first record in the file, not the one I'm trying to duplicate... refer to the circled Formno field.

Also, whenever I make a change to the value in Red and click Ok, it just redisplays the popup with the same notice.

Thanks in Advance for any help on this...
Posté le 29 octobre 2014 - 14:39
Hi,

I realize now, this Duplicate Record feature only works in the "Content" window, not the "SQL" window when there's a Unique Key to change. Unfortunately, that means I have to look through thousands of records, and when I find it and duplicate it... then I get thrown to the bottom of the file and have to look through thousands of records again to find the one I just added. Fortunately, my query was still in the SQL window, and when I reran the query the new record showed up... this is some relief, but it would have been much more convenient if I didn't have to hunt it down in the Content window in the first place.

Thanks...