Search This Blog

Thursday, September 8, 2011

Customized Elements in Multiple Layers

Following sample code is used to get the list of customized Table fields,Class objects in different layers.

static void krishh_listCustomizedObjects(Args _args)
{
    UtilElements    utilElements;
    Dialog          dialog              = new Dialog();
    DialogField     dlgFieldTableName   = dialog.addField(typeid(TableName));
    DialogField     dlgFieldClassName   = dialog.addField(typeid(ClassName));
    Name            tableName,
                    clsName;
    ;
    dialog.caption("List of Customized Objects");
    if (dialog.run())
    {
        tableName =  dlgFieldTableName.value();
        clsName   =  dlgFieldClassName.value();
        while select name, utilLevel
            from utilElements
            order by parentId, recordType
            where (utilElements.parentId    == tablename2Id(tableName)              ||
                   utilElements.parentId    == className2Id(clsName))               &&
                  (utilElements.recordType  == UtilElementType::TableField          ||
                   utilElements.recordType  == UtilElementType::TableFieldGroup     ||
                   utilElements.recordType  == utilelementType::TableInstanceMethod ||
                   utilElements.recordType  == UtilElementType::TableIndex          ||
                   utilElements.recordType  == UtilElementType::TableStaticMethod   ||
                   utilElements.recordType  == UtilElementType::TableRelation       ||
                   utilElements.recordType  == UtilElementType::ClassInstanceMethod ||
                   utilElements.recordType  == UtilElementType::ClassStaticMethod)  &&
                  (utilElements.utilLevel   == UtilEntryLevel::var                  ||
                   utilElements.utilLevel   == UtilEntryLevel::cus ||  utilElements.utilLevel   == UtilEntryLevel::usr)
        {
            switch(utilElements.recordType)
            {
                case UtilElementType::TableField :
                    info(strFmt("Field ID : %1 Layer : %2", utilElements.name, utilElements.utilLevel));
                break;
                case UtilElementType::TableFieldGroup :
                    info(strFmt("Field Group Name : %1 Layer : %2", utilElements.name, utilElements.utilLevel));
                break;
                case UtilElementType::TableInstanceMethod :
                    info(strFmt("Table Method name : %1 Layer : %2", utilElements.name, utilElements.utilLevel));
                break;
                case UtilElementType::TableIndex :
                    info(strFmt("Index name : %1 Layer : %2", utilElements.name, utilElements.utilLevel));
                break;
                case UtilElementType::TableStaticMethod :
                    info(strFmt("Table Static method Name : %1 Layer : %2", utilElements.name, utilElements.utilLevel));
                break;
                case UtilElementType::TableRelation :
                    info(strFmt("Relation name : %1 Layer : %2", utilElements.name, utilElements.utilLevel));
                break;
                case UtilElementType::ClassInstanceMethod :
                    info(strFmt("Class method Name : %1 Layer : %2", utilElements.name, utilElements.utilLevel));
                break;
                case UtilElementType::ClassStaticMethod :
                    info(strFmt("Class Static method Name : %1 Layer : %2", utilElements.name, utilElements.utilLevel));
                break;
            }
        }
    }
}

No comments:

Post a Comment

Thanks for visiting my blog,
I will reply for your comment within 48 hours.

Thanks,
krishna.