Skip to main content

Hello,

We have a Repository Manager form.
When we try to delete a form, everything seem ok but the records are not erased.
The entities we try to delete are :
UXREGS
UXGROUP
UXFILED
USPEC
UFORM

Thank,

Best Regards


entry del_form
	params
		string OBJ_NAME : in
	endparams
	clear/e "UXREGS"
	U_FORMLIB.UXREGS/init = OBJ_NAME
	retrieve/e "UXREGS"
	if ( $status = 0 )
		setocc "UXREGS",-1
		erase/e "UXREGS"      ; special trigger DELE and LOCK !
		Call WriteLog("Deleting register for %%OBJ_NAME","INFO")
	else
    		Call WriteLog("No registers found for %%OBJ_NAME","ERROR")
	endif
	
	clear/e "UXFIELD"           ; delete fields before entites
	UFORM.UXFIELD/init = OBJ_NAME
	retrieve/e "UXFIELD"
	if ( $status = 0 )
		setocc "UXFIELD",-1
		erase/e "UXFIELD"      ; special trigger DELE and LOCK !
		Call WriteLog("Deleting fields for %%OBJ_NAME","INFO")
	else
		;        message/nobeep("No fields found for %%OBJ_NAME")
		Call WriteLog("No fields found for %%OBJ_NAME","ERROR")
	endif
	
	clear/e "UXGROUP"
	UFORM.UXGROUP/init = OBJ_NAME
	retrieve/e "UXGROUP"
	if ( $status = 0 )
		setocc "UXGROUP",-1
		erase/e "UXGROUP"      ; special trigger DELE and LOCK !
		;        message/nobeep("Deleted entities for %%OBJ_NAME")
		Call WriteLog("Deleting entities for %%OBJ_NAME","INFO")
	else
		;        message/nobeep("No entities found for %%OBJ_NAME")
		Call WriteLog("No entities found for %%OBJ_NAME","ERROR")
	endif

	clear/e "USSPEC"
	USPECNAM.USSPEC/init = OBJ_NAME
	retrieve/e "USSPEC"
	if ( $status = 0 )
		setocc "USSPEC",-1
        Call WriteLog("setocc  %%$status","INFO")
		erase/e "USSPEC"      ; special trigger DELE and LOCK !
        Call WriteLog("erase  %%$status","INFO")
        Call WriteLog("erase  %%$occdel","INFO")
		;        message/nobeep("Deleted form record for %%OBJ_NAME")
		Call WriteLog("Deleting form record for %%OBJ_NAME","INFO")
	else
		;        message/nobeep("No form found for %%OBJ_NAME")
		Call WriteLog("No form found for %%OBJ_NAME","ERROR")
	endif


	clear/e "UFORM"
	ULABEL.UFORM/init = OBJ_NAME
	retrieve/e "UFORM"
	if ( $status = 0 )
		setocc "UFORM",-1
        Call WriteLog("setocc  %%$status","INFO")
		erase/e "UFORM"      ; special trigger DELE and LOCK !
        Call WriteLog("erase  %%$status","INFO")
        Call WriteLog("erase  %%$occdel","INFO")
		;        message/nobeep("Deleted form record for %%OBJ_NAME")
		Call WriteLog("Deleting form record for %%OBJ_NAME","INFO")
	else
		;        message/nobeep("No form found for %%OBJ_NAME")
		Call WriteLog("No form found for %%OBJ_NAME","ERROR")
	endif
	
	Call WriteLog("Object %%OBJ_NAME successfully deleted","SUCCESS")
	commit
	Call WriteLog("commit  %%$status","INFO")
end

Hello,

We have a Repository Manager form.
When we try to delete a form, everything seem ok but the records are not erased.
The entities we try to delete are :
UXREGS
UXGROUP
UXFILED
USPEC
UFORM

Thank,

Best Regards


entry del_form
	params
		string OBJ_NAME : in
	endparams
	clear/e "UXREGS"
	U_FORMLIB.UXREGS/init = OBJ_NAME
	retrieve/e "UXREGS"
	if ( $status = 0 )
		setocc "UXREGS",-1
		erase/e "UXREGS"      ; special trigger DELE and LOCK !
		Call WriteLog("Deleting register for %%OBJ_NAME","INFO")
	else
    		Call WriteLog("No registers found for %%OBJ_NAME","ERROR")
	endif
	
	clear/e "UXFIELD"           ; delete fields before entites
	UFORM.UXFIELD/init = OBJ_NAME
	retrieve/e "UXFIELD"
	if ( $status = 0 )
		setocc "UXFIELD",-1
		erase/e "UXFIELD"      ; special trigger DELE and LOCK !
		Call WriteLog("Deleting fields for %%OBJ_NAME","INFO")
	else
		;        message/nobeep("No fields found for %%OBJ_NAME")
		Call WriteLog("No fields found for %%OBJ_NAME","ERROR")
	endif
	
	clear/e "UXGROUP"
	UFORM.UXGROUP/init = OBJ_NAME
	retrieve/e "UXGROUP"
	if ( $status = 0 )
		setocc "UXGROUP",-1
		erase/e "UXGROUP"      ; special trigger DELE and LOCK !
		;        message/nobeep("Deleted entities for %%OBJ_NAME")
		Call WriteLog("Deleting entities for %%OBJ_NAME","INFO")
	else
		;        message/nobeep("No entities found for %%OBJ_NAME")
		Call WriteLog("No entities found for %%OBJ_NAME","ERROR")
	endif

	clear/e "USSPEC"
	USPECNAM.USSPEC/init = OBJ_NAME
	retrieve/e "USSPEC"
	if ( $status = 0 )
		setocc "USSPEC",-1
        Call WriteLog("setocc  %%$status","INFO")
		erase/e "USSPEC"      ; special trigger DELE and LOCK !
        Call WriteLog("erase  %%$status","INFO")
        Call WriteLog("erase  %%$occdel","INFO")
		;        message/nobeep("Deleted form record for %%OBJ_NAME")
		Call WriteLog("Deleting form record for %%OBJ_NAME","INFO")
	else
		;        message/nobeep("No form found for %%OBJ_NAME")
		Call WriteLog("No form found for %%OBJ_NAME","ERROR")
	endif


	clear/e "UFORM"
	ULABEL.UFORM/init = OBJ_NAME
	retrieve/e "UFORM"
	if ( $status = 0 )
		setocc "UFORM",-1
        Call WriteLog("setocc  %%$status","INFO")
		erase/e "UFORM"      ; special trigger DELE and LOCK !
        Call WriteLog("erase  %%$status","INFO")
        Call WriteLog("erase  %%$occdel","INFO")
		;        message/nobeep("Deleted form record for %%OBJ_NAME")
		Call WriteLog("Deleting form record for %%OBJ_NAME","INFO")
	else
		;        message/nobeep("No form found for %%OBJ_NAME")
		Call WriteLog("No form found for %%OBJ_NAME","ERROR")
	endif
	
	Call WriteLog("Object %%OBJ_NAME successfully deleted","SUCCESS")
	commit
	Call WriteLog("commit  %%$status","INFO")
end

Hi Marie

Are you sure that the LOCK und DELETE trigger of each of this entities are filled with proper statements
And the form is not "limited" 🙂

Ingo


Hello,

We have a Repository Manager form.
When we try to delete a form, everything seem ok but the records are not erased.
The entities we try to delete are :
UXREGS
UXGROUP
UXFILED
USPEC
UFORM

Thank,

Best Regards


entry del_form
	params
		string OBJ_NAME : in
	endparams
	clear/e "UXREGS"
	U_FORMLIB.UXREGS/init = OBJ_NAME
	retrieve/e "UXREGS"
	if ( $status = 0 )
		setocc "UXREGS",-1
		erase/e "UXREGS"      ; special trigger DELE and LOCK !
		Call WriteLog("Deleting register for %%OBJ_NAME","INFO")
	else
    		Call WriteLog("No registers found for %%OBJ_NAME","ERROR")
	endif
	
	clear/e "UXFIELD"           ; delete fields before entites
	UFORM.UXFIELD/init = OBJ_NAME
	retrieve/e "UXFIELD"
	if ( $status = 0 )
		setocc "UXFIELD",-1
		erase/e "UXFIELD"      ; special trigger DELE and LOCK !
		Call WriteLog("Deleting fields for %%OBJ_NAME","INFO")
	else
		;        message/nobeep("No fields found for %%OBJ_NAME")
		Call WriteLog("No fields found for %%OBJ_NAME","ERROR")
	endif
	
	clear/e "UXGROUP"
	UFORM.UXGROUP/init = OBJ_NAME
	retrieve/e "UXGROUP"
	if ( $status = 0 )
		setocc "UXGROUP",-1
		erase/e "UXGROUP"      ; special trigger DELE and LOCK !
		;        message/nobeep("Deleted entities for %%OBJ_NAME")
		Call WriteLog("Deleting entities for %%OBJ_NAME","INFO")
	else
		;        message/nobeep("No entities found for %%OBJ_NAME")
		Call WriteLog("No entities found for %%OBJ_NAME","ERROR")
	endif

	clear/e "USSPEC"
	USPECNAM.USSPEC/init = OBJ_NAME
	retrieve/e "USSPEC"
	if ( $status = 0 )
		setocc "USSPEC",-1
        Call WriteLog("setocc  %%$status","INFO")
		erase/e "USSPEC"      ; special trigger DELE and LOCK !
        Call WriteLog("erase  %%$status","INFO")
        Call WriteLog("erase  %%$occdel","INFO")
		;        message/nobeep("Deleted form record for %%OBJ_NAME")
		Call WriteLog("Deleting form record for %%OBJ_NAME","INFO")
	else
		;        message/nobeep("No form found for %%OBJ_NAME")
		Call WriteLog("No form found for %%OBJ_NAME","ERROR")
	endif


	clear/e "UFORM"
	ULABEL.UFORM/init = OBJ_NAME
	retrieve/e "UFORM"
	if ( $status = 0 )
		setocc "UFORM",-1
        Call WriteLog("setocc  %%$status","INFO")
		erase/e "UFORM"      ; special trigger DELE and LOCK !
        Call WriteLog("erase  %%$status","INFO")
        Call WriteLog("erase  %%$occdel","INFO")
		;        message/nobeep("Deleted form record for %%OBJ_NAME")
		Call WriteLog("Deleting form record for %%OBJ_NAME","INFO")
	else
		;        message/nobeep("No form found for %%OBJ_NAME")
		Call WriteLog("No form found for %%OBJ_NAME","ERROR")
	endif
	
	Call WriteLog("Object %%OBJ_NAME successfully deleted","SUCCESS")
	commit
	Call WriteLog("commit  %%$status","INFO")
end

As it Ingo says, It sounds like the delete trigger has not been filled in.

Also (as a bit of an aside) - it would be possible to create the relevant relationships in the model and let Uniface deal with the cascading delete for you. This approach would mean not having to deal with each entity individually and simplify the code.



Hello,

We have a Repository Manager form.
When we try to delete a form, everything seem ok but the records are not erased.
The entities we try to delete are :
UXREGS
UXGROUP
UXFILED
USPEC
UFORM

Thank,

Best Regards


entry del_form
	params
		string OBJ_NAME : in
	endparams
	clear/e "UXREGS"
	U_FORMLIB.UXREGS/init = OBJ_NAME
	retrieve/e "UXREGS"
	if ( $status = 0 )
		setocc "UXREGS",-1
		erase/e "UXREGS"      ; special trigger DELE and LOCK !
		Call WriteLog("Deleting register for %%OBJ_NAME","INFO")
	else
    		Call WriteLog("No registers found for %%OBJ_NAME","ERROR")
	endif
	
	clear/e "UXFIELD"           ; delete fields before entites
	UFORM.UXFIELD/init = OBJ_NAME
	retrieve/e "UXFIELD"
	if ( $status = 0 )
		setocc "UXFIELD",-1
		erase/e "UXFIELD"      ; special trigger DELE and LOCK !
		Call WriteLog("Deleting fields for %%OBJ_NAME","INFO")
	else
		;        message/nobeep("No fields found for %%OBJ_NAME")
		Call WriteLog("No fields found for %%OBJ_NAME","ERROR")
	endif
	
	clear/e "UXGROUP"
	UFORM.UXGROUP/init = OBJ_NAME
	retrieve/e "UXGROUP"
	if ( $status = 0 )
		setocc "UXGROUP",-1
		erase/e "UXGROUP"      ; special trigger DELE and LOCK !
		;        message/nobeep("Deleted entities for %%OBJ_NAME")
		Call WriteLog("Deleting entities for %%OBJ_NAME","INFO")
	else
		;        message/nobeep("No entities found for %%OBJ_NAME")
		Call WriteLog("No entities found for %%OBJ_NAME","ERROR")
	endif

	clear/e "USSPEC"
	USPECNAM.USSPEC/init = OBJ_NAME
	retrieve/e "USSPEC"
	if ( $status = 0 )
		setocc "USSPEC",-1
        Call WriteLog("setocc  %%$status","INFO")
		erase/e "USSPEC"      ; special trigger DELE and LOCK !
        Call WriteLog("erase  %%$status","INFO")
        Call WriteLog("erase  %%$occdel","INFO")
		;        message/nobeep("Deleted form record for %%OBJ_NAME")
		Call WriteLog("Deleting form record for %%OBJ_NAME","INFO")
	else
		;        message/nobeep("No form found for %%OBJ_NAME")
		Call WriteLog("No form found for %%OBJ_NAME","ERROR")
	endif


	clear/e "UFORM"
	ULABEL.UFORM/init = OBJ_NAME
	retrieve/e "UFORM"
	if ( $status = 0 )
		setocc "UFORM",-1
        Call WriteLog("setocc  %%$status","INFO")
		erase/e "UFORM"      ; special trigger DELE and LOCK !
        Call WriteLog("erase  %%$status","INFO")
        Call WriteLog("erase  %%$occdel","INFO")
		;        message/nobeep("Deleted form record for %%OBJ_NAME")
		Call WriteLog("Deleting form record for %%OBJ_NAME","INFO")
	else
		;        message/nobeep("No form found for %%OBJ_NAME")
		Call WriteLog("No form found for %%OBJ_NAME","ERROR")
	endif
	
	Call WriteLog("Object %%OBJ_NAME successfully deleted","SUCCESS")
	commit
	Call WriteLog("commit  %%$status","INFO")
end
Thanks a lot for your help .
We will create relationships to simplify the code, as you advise.

Best Regards.

Hello,

We have a Repository Manager form.
When we try to delete a form, everything seem ok but the records are not erased.
The entities we try to delete are :
UXREGS
UXGROUP
UXFILED
USPEC
UFORM

Thank,

Best Regards


entry del_form
	params
		string OBJ_NAME : in
	endparams
	clear/e "UXREGS"
	U_FORMLIB.UXREGS/init = OBJ_NAME
	retrieve/e "UXREGS"
	if ( $status = 0 )
		setocc "UXREGS",-1
		erase/e "UXREGS"      ; special trigger DELE and LOCK !
		Call WriteLog("Deleting register for %%OBJ_NAME","INFO")
	else
    		Call WriteLog("No registers found for %%OBJ_NAME","ERROR")
	endif
	
	clear/e "UXFIELD"           ; delete fields before entites
	UFORM.UXFIELD/init = OBJ_NAME
	retrieve/e "UXFIELD"
	if ( $status = 0 )
		setocc "UXFIELD",-1
		erase/e "UXFIELD"      ; special trigger DELE and LOCK !
		Call WriteLog("Deleting fields for %%OBJ_NAME","INFO")
	else
		;        message/nobeep("No fields found for %%OBJ_NAME")
		Call WriteLog("No fields found for %%OBJ_NAME","ERROR")
	endif
	
	clear/e "UXGROUP"
	UFORM.UXGROUP/init = OBJ_NAME
	retrieve/e "UXGROUP"
	if ( $status = 0 )
		setocc "UXGROUP",-1
		erase/e "UXGROUP"      ; special trigger DELE and LOCK !
		;        message/nobeep("Deleted entities for %%OBJ_NAME")
		Call WriteLog("Deleting entities for %%OBJ_NAME","INFO")
	else
		;        message/nobeep("No entities found for %%OBJ_NAME")
		Call WriteLog("No entities found for %%OBJ_NAME","ERROR")
	endif

	clear/e "USSPEC"
	USPECNAM.USSPEC/init = OBJ_NAME
	retrieve/e "USSPEC"
	if ( $status = 0 )
		setocc "USSPEC",-1
        Call WriteLog("setocc  %%$status","INFO")
		erase/e "USSPEC"      ; special trigger DELE and LOCK !
        Call WriteLog("erase  %%$status","INFO")
        Call WriteLog("erase  %%$occdel","INFO")
		;        message/nobeep("Deleted form record for %%OBJ_NAME")
		Call WriteLog("Deleting form record for %%OBJ_NAME","INFO")
	else
		;        message/nobeep("No form found for %%OBJ_NAME")
		Call WriteLog("No form found for %%OBJ_NAME","ERROR")
	endif


	clear/e "UFORM"
	ULABEL.UFORM/init = OBJ_NAME
	retrieve/e "UFORM"
	if ( $status = 0 )
		setocc "UFORM",-1
        Call WriteLog("setocc  %%$status","INFO")
		erase/e "UFORM"      ; special trigger DELE and LOCK !
        Call WriteLog("erase  %%$status","INFO")
        Call WriteLog("erase  %%$occdel","INFO")
		;        message/nobeep("Deleted form record for %%OBJ_NAME")
		Call WriteLog("Deleting form record for %%OBJ_NAME","INFO")
	else
		;        message/nobeep("No form found for %%OBJ_NAME")
		Call WriteLog("No form found for %%OBJ_NAME","ERROR")
	endif
	
	Call WriteLog("Object %%OBJ_NAME successfully deleted","SUCCESS")
	commit
	Call WriteLog("commit  %%$status","INFO")
end

If you need the model 🙂
(okay, a least two tables are not from UnifAce)


Hello,

We have a Repository Manager form.
When we try to delete a form, everything seem ok but the records are not erased.
The entities we try to delete are :
UXREGS
UXGROUP
UXFILED
USPEC
UFORM

Thank,

Best Regards


entry del_form
	params
		string OBJ_NAME : in
	endparams
	clear/e "UXREGS"
	U_FORMLIB.UXREGS/init = OBJ_NAME
	retrieve/e "UXREGS"
	if ( $status = 0 )
		setocc "UXREGS",-1
		erase/e "UXREGS"      ; special trigger DELE and LOCK !
		Call WriteLog("Deleting register for %%OBJ_NAME","INFO")
	else
    		Call WriteLog("No registers found for %%OBJ_NAME","ERROR")
	endif
	
	clear/e "UXFIELD"           ; delete fields before entites
	UFORM.UXFIELD/init = OBJ_NAME
	retrieve/e "UXFIELD"
	if ( $status = 0 )
		setocc "UXFIELD",-1
		erase/e "UXFIELD"      ; special trigger DELE and LOCK !
		Call WriteLog("Deleting fields for %%OBJ_NAME","INFO")
	else
		;        message/nobeep("No fields found for %%OBJ_NAME")
		Call WriteLog("No fields found for %%OBJ_NAME","ERROR")
	endif
	
	clear/e "UXGROUP"
	UFORM.UXGROUP/init = OBJ_NAME
	retrieve/e "UXGROUP"
	if ( $status = 0 )
		setocc "UXGROUP",-1
		erase/e "UXGROUP"      ; special trigger DELE and LOCK !
		;        message/nobeep("Deleted entities for %%OBJ_NAME")
		Call WriteLog("Deleting entities for %%OBJ_NAME","INFO")
	else
		;        message/nobeep("No entities found for %%OBJ_NAME")
		Call WriteLog("No entities found for %%OBJ_NAME","ERROR")
	endif

	clear/e "USSPEC"
	USPECNAM.USSPEC/init = OBJ_NAME
	retrieve/e "USSPEC"
	if ( $status = 0 )
		setocc "USSPEC",-1
        Call WriteLog("setocc  %%$status","INFO")
		erase/e "USSPEC"      ; special trigger DELE and LOCK !
        Call WriteLog("erase  %%$status","INFO")
        Call WriteLog("erase  %%$occdel","INFO")
		;        message/nobeep("Deleted form record for %%OBJ_NAME")
		Call WriteLog("Deleting form record for %%OBJ_NAME","INFO")
	else
		;        message/nobeep("No form found for %%OBJ_NAME")
		Call WriteLog("No form found for %%OBJ_NAME","ERROR")
	endif


	clear/e "UFORM"
	ULABEL.UFORM/init = OBJ_NAME
	retrieve/e "UFORM"
	if ( $status = 0 )
		setocc "UFORM",-1
        Call WriteLog("setocc  %%$status","INFO")
		erase/e "UFORM"      ; special trigger DELE and LOCK !
        Call WriteLog("erase  %%$status","INFO")
        Call WriteLog("erase  %%$occdel","INFO")
		;        message/nobeep("Deleted form record for %%OBJ_NAME")
		Call WriteLog("Deleting form record for %%OBJ_NAME","INFO")
	else
		;        message/nobeep("No form found for %%OBJ_NAME")
		Call WriteLog("No form found for %%OBJ_NAME","ERROR")
	endif
	
	Call WriteLog("Object %%OBJ_NAME successfully deleted","SUCCESS")
	commit
	Call WriteLog("commit  %%$status","INFO")
end

BTW:

I did code a few SQL-Statemenst to delete all remains of a components and tables
LP_SQL_STM calls a component which knows where the databases are
You can replace it by just a sql v_SQL,"IDF"

Ingo


; Model
v_SQL = "delete from uctable where not exists (select 1 from ucsch B where B.u_vlab=uctable.u_vlab )"
call LP_SQL_STM("DICT","UCTABLE","IDF",v_SQL)
v_STATUS = $status
IF(v_STATUS<0) GOTO TAG_ENDE

v_SQL = "delete from ucgroup where not exists (select 1 from uctable B where B.u_vlab=ucgroup.u_vlab and B.u_tlab=ucgroup.u_tlab)"
call LP_SQL_STM("DICT","UCGROUP","IDF",v_SQL)
v_STATUS = $status
IF(v_STATUS<0) GOTO TAG_ENDE

v_SQL = "delete from ucfield where not exists (select 1 from ucgroup B where B.u_vlab=ucfield.u_vlab and B.u_glab=ucfield.u_tlab)"
call LP_SQL_STM("DICT","UCFIELD","IDF",v_SQL)
v_STATUS = $status
IF(v_STATUS<0) GOTO TAG_ENDE

v_SQL = "delete from uckey where not exists (select 1 from uctable B where B.u_vlab=uckey.u_vlab and B.u_tlab=uckey.u_tlab )"
call LP_SQL_STM("DICT","UCKEY","IDF",v_SQL)
v_STATUS = $status
IF(v_STATUS<0) GOTO TAG_ENDE

v_SQL = "delete from ucrelsh where not exists (select 1 from ucgroup B where B.u_vlab=ucrelsh.u_vlab and B.u_glab=ucrelsh.u_glab) and not exists (select 1 from ucgroup B where B.u_vlab=ucrelsh.u_rvlab and B.u_glab=ucrelsh.u_rglab)"
call LP_SQL_STM("DICT","UCRELSH","IDF",v_SQL)
v_STATUS = $status
IF(v_STATUS<0) GOTO TAG_ENDE





; Implementation
v_SQL = "delete from usimpl where substring(usimpl.uspecnam,1,1)!='U' and usimpl.upath in ('FRM','SVC','RPT','DSP','USP','SSV','ESV') and not exists (select 1 from uform B where B.ulabel=usimpl.uimplnam)"
call LP_SQL_STM("DICT","USIMPL","IDF",v_SQL)
v_STATUS = $status
IF(v_STATUS<0) GOTO TAG_ENDE

v_SQL = "delete from usioper where not exists (select 1 from usimpl B where B.uimplnam = usioper.uimplnam and B.upath=usioper.upath)"
call LP_SQL_STM("DICT","USIOPER","IDF",v_SQL)
v_STATUS = $status
IF(v_STATUS<0) GOTO TAG_ENDE

v_SQL = "delete from usiparm where not exists (select 1 from usioper B where B.uimplnam = usiparm.uimplnam and B.upath=usiparm.upath and B.uopernam=usiparm.uopernam)"
call LP_SQL_STM("DICT","USIPARM","IDF",v_SQL)
v_STATUS = $status
IF(v_STATUS<0) GOTO TAG_ENDE

v_SQL = "delete from usilink where not exists (select 1 from usimpl B where B.uimplnam = usilink.uimplnamcal) and not exists (select 1 from usspec B where B.uspecnam = usilink.uspecnamdes)"
call LP_SQL_STM("DICT","USILINK","IDF",v_SQL)
v_STATUS = $status
IF(v_STATUS<0) GOTO TAG_ENDE


; UX

v_SQL = "delete from uxgroup where not exists (select 1 from uform B where B.ulabel=uxgroup.uform)"
call LP_SQL_STM("DICT","UXGROUP","IDF",v_SQL)
v_STATUS = $status
IF(v_STATUS<0) GOTO TAG_ENDE


v_SQL = "delete from uxfield where not exists (select 1 from uxgroup B where B.ubase=uxfield.ubase and B.ulabel=uxfield.grp)"
call LP_SQL_STM("DICT","UXFIELD","IDF",v_SQL)
v_STATUS = $status
IF(v_STATUS<0) GOTO TAG_ENDE


v_SQL = "delete from uxregs where not exists (select 1 from uform B where B.ulabel=uxregs.u_formlib)"
call LP_SQL_STM("DICT","UXREGS","IDF",v_SQL)
v_STATUS = $status
IF(v_STATUS<0) GOTO TAG_ENDE




; Specification
v_SQL = "delete from usspec where substring(usspec.uspecnam,1,1)!='U' and usspec.udefpath in ('FRM','SVC','RPT','DSP','USP','SSV','ESV') and not exists (select 1 from uform B where B.ulabel=usspec.uspecnam)"
call LP_SQL_STM("DICT","USSPEC","IDF",v_SQL)
v_STATUS = $status
IF(v_STATUS<0) GOTO TAG_ENDE

v_SQL = "delete from usoper where not exists (select 1 from usspec B where b.uspecnam=usoper.uspecnam)"
call LP_SQL_STM("DICT","USOPER","IDF",v_SQL)
v_STATUS = $status
IF(v_STATUS<0) GOTO TAG_ENDE

v_SQL = "delete from usparm where not exists (select 1 from usoper B where B.uspecnam = usparm.uspecnam and B.uopernam=usparm.uopernam)"
call LP_SQL_STM("DICT","USPARM","IDF",v_SQL)
v_STATUS = $status
IF(v_STATUS<0) GOTO TAG_ENDE

v_SQL = "delete from uslink where not exists (select 1 from usspec B where b.uspecnam=uslink.uspecnamcal) and not exists (select 1 from usspec B where b.uspecnam=uslink.uspecnamdes)"
call LP_SQL_STM("DICT","USLINK","IDF",v_SQL)
v_STATUS = $status
IF(v_STATUS<0) GOTO TAG_ENDE




; X-Refs
v_SQL = "delete from uxcross where uobjtyp='CPT' and not exists(select 1 from uform B where B.ulabel=uxcross.uobjnam)"
call LP_SQL_STM("DICT","UXCROSS","IDF",v_SQL)
v_STATUS = $status
IF(v_STATUS<0) GOTO TAG_ENDE

v_SQL = "delete from uxcompmsg where uobjtyp='CPT' and not exists(select 1 from uform B where B.ulabel=uxcompmsg.uobjnam)"
call LP_SQL_STM("DICT","UXCOMPMSG","IDF",v_SQL)
v_STATUS = $status
IF(v_STATUS<0) GOTO TAG_ENDE

v_SQL = "delete from uxcompmsg2 where uobjtyp='CPT' and not exists(select 1 from uform B where B.ulabel=uxcompmsg2.uobjnam)"
call LP_SQL_STM("DICT","UXCOMPMSG2","IDF",v_SQL)
v_STATUS = $status
IF(v_STATUS<0) GOTO TAG_ENDE


v_SQL = "delete from uxlisting where uobjtyp='CPT' and not exists(select 1 from uform B where B.ulabel=uxlisting.uobjnam)"
call LP_SQL_STM("DICT","UXLISTING","IDF",v_SQL)
v_STATUS = $status
IF(v_STATUS<0) GOTO TAG_ENDE


; X-Refs
v_SQL = "delete from uxcross where uobjtyp='PRC' and not exists(select 1 from usource B where B.usub='P' and B.ulan='P' and B.uvar=uxcross.uobjlib and B.ulabel=uxcross.uobjnam)"
call LP_SQL_STM("DICT","UXCROSS","IDF",v_SQL)
v_STATUS = $status
IF(v_STATUS<0) GOTO TAG_ENDE


If you need the model 🙂
(okay, a least two tables are not from UnifAce)

Sorry, but the picture of the model is not displayed correctly :-(


Hello,

We have a Repository Manager form.
When we try to delete a form, everything seem ok but the records are not erased.
The entities we try to delete are :
UXREGS
UXGROUP
UXFILED
USPEC
UFORM

Thank,

Best Regards


entry del_form
	params
		string OBJ_NAME : in
	endparams
	clear/e "UXREGS"
	U_FORMLIB.UXREGS/init = OBJ_NAME
	retrieve/e "UXREGS"
	if ( $status = 0 )
		setocc "UXREGS",-1
		erase/e "UXREGS"      ; special trigger DELE and LOCK !
		Call WriteLog("Deleting register for %%OBJ_NAME","INFO")
	else
    		Call WriteLog("No registers found for %%OBJ_NAME","ERROR")
	endif
	
	clear/e "UXFIELD"           ; delete fields before entites
	UFORM.UXFIELD/init = OBJ_NAME
	retrieve/e "UXFIELD"
	if ( $status = 0 )
		setocc "UXFIELD",-1
		erase/e "UXFIELD"      ; special trigger DELE and LOCK !
		Call WriteLog("Deleting fields for %%OBJ_NAME","INFO")
	else
		;        message/nobeep("No fields found for %%OBJ_NAME")
		Call WriteLog("No fields found for %%OBJ_NAME","ERROR")
	endif
	
	clear/e "UXGROUP"
	UFORM.UXGROUP/init = OBJ_NAME
	retrieve/e "UXGROUP"
	if ( $status = 0 )
		setocc "UXGROUP",-1
		erase/e "UXGROUP"      ; special trigger DELE and LOCK !
		;        message/nobeep("Deleted entities for %%OBJ_NAME")
		Call WriteLog("Deleting entities for %%OBJ_NAME","INFO")
	else
		;        message/nobeep("No entities found for %%OBJ_NAME")
		Call WriteLog("No entities found for %%OBJ_NAME","ERROR")
	endif

	clear/e "USSPEC"
	USPECNAM.USSPEC/init = OBJ_NAME
	retrieve/e "USSPEC"
	if ( $status = 0 )
		setocc "USSPEC",-1
        Call WriteLog("setocc  %%$status","INFO")
		erase/e "USSPEC"      ; special trigger DELE and LOCK !
        Call WriteLog("erase  %%$status","INFO")
        Call WriteLog("erase  %%$occdel","INFO")
		;        message/nobeep("Deleted form record for %%OBJ_NAME")
		Call WriteLog("Deleting form record for %%OBJ_NAME","INFO")
	else
		;        message/nobeep("No form found for %%OBJ_NAME")
		Call WriteLog("No form found for %%OBJ_NAME","ERROR")
	endif


	clear/e "UFORM"
	ULABEL.UFORM/init = OBJ_NAME
	retrieve/e "UFORM"
	if ( $status = 0 )
		setocc "UFORM",-1
        Call WriteLog("setocc  %%$status","INFO")
		erase/e "UFORM"      ; special trigger DELE and LOCK !
        Call WriteLog("erase  %%$status","INFO")
        Call WriteLog("erase  %%$occdel","INFO")
		;        message/nobeep("Deleted form record for %%OBJ_NAME")
		Call WriteLog("Deleting form record for %%OBJ_NAME","INFO")
	else
		;        message/nobeep("No form found for %%OBJ_NAME")
		Call WriteLog("No form found for %%OBJ_NAME","ERROR")
	endif
	
	Call WriteLog("Object %%OBJ_NAME successfully deleted","SUCCESS")
	commit
	Call WriteLog("commit  %%$status","INFO")
end

lets try it as a JPEG


Hello,

We have a Repository Manager form.
When we try to delete a form, everything seem ok but the records are not erased.
The entities we try to delete are :
UXREGS
UXGROUP
UXFILED
USPEC
UFORM

Thank,

Best Regards


entry del_form
	params
		string OBJ_NAME : in
	endparams
	clear/e "UXREGS"
	U_FORMLIB.UXREGS/init = OBJ_NAME
	retrieve/e "UXREGS"
	if ( $status = 0 )
		setocc "UXREGS",-1
		erase/e "UXREGS"      ; special trigger DELE and LOCK !
		Call WriteLog("Deleting register for %%OBJ_NAME","INFO")
	else
    		Call WriteLog("No registers found for %%OBJ_NAME","ERROR")
	endif
	
	clear/e "UXFIELD"           ; delete fields before entites
	UFORM.UXFIELD/init = OBJ_NAME
	retrieve/e "UXFIELD"
	if ( $status = 0 )
		setocc "UXFIELD",-1
		erase/e "UXFIELD"      ; special trigger DELE and LOCK !
		Call WriteLog("Deleting fields for %%OBJ_NAME","INFO")
	else
		;        message/nobeep("No fields found for %%OBJ_NAME")
		Call WriteLog("No fields found for %%OBJ_NAME","ERROR")
	endif
	
	clear/e "UXGROUP"
	UFORM.UXGROUP/init = OBJ_NAME
	retrieve/e "UXGROUP"
	if ( $status = 0 )
		setocc "UXGROUP",-1
		erase/e "UXGROUP"      ; special trigger DELE and LOCK !
		;        message/nobeep("Deleted entities for %%OBJ_NAME")
		Call WriteLog("Deleting entities for %%OBJ_NAME","INFO")
	else
		;        message/nobeep("No entities found for %%OBJ_NAME")
		Call WriteLog("No entities found for %%OBJ_NAME","ERROR")
	endif

	clear/e "USSPEC"
	USPECNAM.USSPEC/init = OBJ_NAME
	retrieve/e "USSPEC"
	if ( $status = 0 )
		setocc "USSPEC",-1
        Call WriteLog("setocc  %%$status","INFO")
		erase/e "USSPEC"      ; special trigger DELE and LOCK !
        Call WriteLog("erase  %%$status","INFO")
        Call WriteLog("erase  %%$occdel","INFO")
		;        message/nobeep("Deleted form record for %%OBJ_NAME")
		Call WriteLog("Deleting form record for %%OBJ_NAME","INFO")
	else
		;        message/nobeep("No form found for %%OBJ_NAME")
		Call WriteLog("No form found for %%OBJ_NAME","ERROR")
	endif


	clear/e "UFORM"
	ULABEL.UFORM/init = OBJ_NAME
	retrieve/e "UFORM"
	if ( $status = 0 )
		setocc "UFORM",-1
        Call WriteLog("setocc  %%$status","INFO")
		erase/e "UFORM"      ; special trigger DELE and LOCK !
        Call WriteLog("erase  %%$status","INFO")
        Call WriteLog("erase  %%$occdel","INFO")
		;        message/nobeep("Deleted form record for %%OBJ_NAME")
		Call WriteLog("Deleting form record for %%OBJ_NAME","INFO")
	else
		;        message/nobeep("No form found for %%OBJ_NAME")
		Call WriteLog("No form found for %%OBJ_NAME","ERROR")
	endif
	
	Call WriteLog("Object %%OBJ_NAME successfully deleted","SUCCESS")
	commit
	Call WriteLog("commit  %%$status","INFO")
end

and now the way by "insert picture"


and now the way by "insert picture"

Thanks for the picture and the SQL statement...


As it Ingo says, It sounds like the delete trigger has not been filled in.

Also (as a bit of an aside) - it would be possible to create the relevant relationships in the model and let Uniface deal with the cascading delete for you. This approach would mean not having to deal with each entity individually and simplify the code.


Mike - tounge in cheek....

Sounds like that'd be a job for the lab.... 

I mean - IDE deletes the form - so why not the rest of the connected data??

Knut


As it Ingo says, It sounds like the delete trigger has not been filled in.

Also (as a bit of an aside) - it would be possible to create the relevant relationships in the model and let Uniface deal with the cascading delete for you. This approach would mean not having to deal with each entity individually and simplify the code.


Hi Knut - also tongue in cheek,

You are correct which is why we made sure deleting a component, or any other Main Development Object, using the Uniface 10 IDE does precisely that. 

Have a great weekend,

Mike