PC SOFT

FOROS PROFESIONALES
WINDEVWEBDEV y WINDEV Mobile

Inicio → WINDEV 2024 → Delete All Data
Delete All Data
Iniciado por dan_dan477, 06,dic. 2019 03:02 - 2 respuestas
Publicado el 06,diciembre 2019 - 03:02
Hi, I made 4 databases A, B, C, D.
Relation A 0,1 - 0,N with B // In B I put in the analysis that A can erase B
Relation A 0,1 - 0,N with C // In C I put in the analysis that A can erase C
Relation A 0,N - 0,1 with D // Here I have integrity problems to erase the data.
Can you give me an example of how to proceed, when I delete A it deletes without problems B and C, but with D I have problems since the relationship is reversed and I need A to erase everything.

The code would be this.

IF YesNo(0,"Are you sure to delete the record?") = True THEN
HReadSeekFirst(A,A_ID,TABLE_CONS_A.COL_A_ID)
IF HFound = True THEN
HDelete(A) // Here it deletes A, B, C without problems
HReadSeekFirst(A,D_ID,TABLE_CONS_A.COL_D_ID)
IF HFound = True THEN
HDelete(D) // Here I have the problem since this reaction is A 0, N to 0.1
Info("The record was deleted successfully")
END
END
END
TableDisplay(TABLE_CONS_A,taReExecuteQuery)

I am learning, I appreciate any help...
Greetings from Argentina...
Publicado el 06,diciembre 2019 - 07:49
Hi,

you can disable integrity errors using HSetIntegrity(..) https://help.windev.com/en-US/… which will enable you to do the delete-job without fear of disruption.

Next, if you want to delete all of the records of a database then using HCreation(...) is recommended. It's faster than the deletion of each record.
Publicado el 06,diciembre 2019 - 13:55
Hi Guenter Predl.

I want to delete the records related to A, not the entire database, apart from the integrity problem, I delete records that are not related.
I have the problem here.
HReadSeekFirst(A,D_ID,TABLE_CONS_A.COL_D_ID)
IF HFound = True THEN
HDelete(D) // Here I have the problem since this reaction is A 0, N to 0.1
Info("The record was deleted successfully")
if you can try the code I would appreciate it and help me.
Greetings from Argentina...