Hello,
Module m = current
mod = edit(fullName(m), false, true, true) // Edit, invisible, silent, standard view
void DeleteAttributes(Module mod, Skip skpAttrNames)
{
string NameAttr, NameMod = name(mod)
for NameAttr in skpAttrNames do
{ AttrDef ad = find(mod, NameAttr)
print NameMod "\t" NameAttr "\t"
if (null ad) { print "No such attr\n" }
else
{
ErrMess = delete(mod, ad)
if (!null ErrMess) { "AttName Error Deleting: " ErrMess }
else { print "Deleted OK\n" }
AttrType CurrType = find(m, ad.typeName)
if canDelete(CurrType)
{
delete(CurrType, ErrMess)
if (!null ErrMess) { "AttType Error Deleting: " ErrMess }
else { print "Deleted OK\n" }
}
}
} // end for attrs to delete
} // end DeleteAttributes(mod)
// ========= MAIN =========
Skip skpAttrNames = createString // KEY and DATA both 'string' Name of attr to delete
put(skpAttrNames, "Object Type", "Object Type")
DeleteAttributes(mod, skpAttrNames)
delete(skpAttrNames)
SystemAdmin - Tue Dec 13 12:45:42 EST 2011 |
Re: CanDelete and attribute types to: if (canDelete(CurrType) ) |
Re: CanDelete and attribute types OurGuest - Tue Dec 13 12:59:15 EST 2011
Hello,
if (canDelete(CurrType))
{
delete(CurrType, ErrMess)
if (!null ErrMess) { "AttType Error Deleting: " ErrMess }
else { print "Deleted OK\n" }
}
|
Re: CanDelete and attribute types SystemAdmin - Tue Dec 13 13:18:27 EST 2011
Hello,
if (canDelete(CurrType))
{
delete(CurrType, ErrMess)
if (!null ErrMess) { "AttType Error Deleting: " ErrMess }
else { print "Deleted OK\n" }
}
-Louie |
Re: CanDelete and attribute types llandale - Tue Dec 13 14:18:10 EST 2011
-Louie
Hello,
Module m = current
mod = edit(fullName(m), false, true, true) // Edit, invisible, silent, standard view
void DeleteAttributes(Module mod, Skip skpAttrNames)
{
string NameAttr, err
print name(mod)
for NameAttr in skpAttrNames do
{
AttrDef ad = find(mod, NameAttr) //find Attribute from Skip list
print "\nAttrDef: (" NameAttr ")"
if (null ad)
{
print "\tNo such attr"
}
else
{
AttrType CurrType = find(m, ad.typeName)
string adType = ad.typeName
err = delete(mod, ad) //find data type from valid attribute
if (err !="") { ack err; print "\t" err " [System Attr("ad.system")]"}
else { print "\tDeleted OK" }
if (!isUsed(CurrType))
{
print "\nAttrType: (" adType
delete(CurrType, err)
if (err !="") { ack err; ")\tError Deleting: " err ""; }
else { print ")\tDeleted OK" }
}
}
} // end for attrs to delete
flushDeletions()
} // end DeleteAttributes(mod)
// ========= MAIN =========
Skip skpAttrNames = createString // KEY and DATA both 'string' Name of attr to delete
put(skpAttrNames, "Object Type", "Object Type")
put(skpAttrNames, "jim", "jim")
put(skpAttrNames, "Object", "Object")
put(skpAttrNames, "Object Text", "Object Text")
put(skpAttrNames, "kim", "kim")
put(skpAttrNames, "ll", "ll")
DeleteAttributes(mod, skpAttrNames)
delete(skpAttrNames)
|
Re: CanDelete and attribute types SystemAdmin - Tue Dec 13 18:18:28 EST 2011
Hello,
Module m = current
mod = edit(fullName(m), false, true, true) // Edit, invisible, silent, standard view
void DeleteAttributes(Module mod, Skip skpAttrNames)
{
string NameAttr, err
print name(mod)
for NameAttr in skpAttrNames do
{
AttrDef ad = find(mod, NameAttr) //find Attribute from Skip list
print "\nAttrDef: (" NameAttr ")"
if (null ad)
{
print "\tNo such attr"
}
else
{
AttrType CurrType = find(m, ad.typeName)
string adType = ad.typeName
err = delete(mod, ad) //find data type from valid attribute
if (err !="") { ack err; print "\t" err " [System Attr("ad.system")]"}
else { print "\tDeleted OK" }
if (!isUsed(CurrType))
{
print "\nAttrType: (" adType
delete(CurrType, err)
if (err !="") { ack err; ")\tError Deleting: " err ""; }
else { print ")\tDeleted OK" }
}
}
} // end for attrs to delete
flushDeletions()
} // end DeleteAttributes(mod)
// ========= MAIN =========
Skip skpAttrNames = createString // KEY and DATA both 'string' Name of attr to delete
put(skpAttrNames, "Object Type", "Object Type")
put(skpAttrNames, "jim", "jim")
put(skpAttrNames, "Object", "Object")
put(skpAttrNames, "Object Text", "Object Text")
put(skpAttrNames, "kim", "kim")
put(skpAttrNames, "ll", "ll")
DeleteAttributes(mod, skpAttrNames)
delete(skpAttrNames)
I see that system AttrType 'real' is not used by any system AttrDefs.
I'm pretty sure it means "Has permission to delete it", the "D" in RMCDA.
if (CurrType.canWrite and // Allowed: I have permission -
!(CurrType.system) and // Allowed: Its not a system type -
!isUsed(CurrType) and // Allowed: No AttrDef is using it -
canDelete(CurrType)) // Access right now: Module open Edit -
then I can expect no "delete(CurrType)" errors.
|