Walter,

Try this out! I created a job that enables searching for the fields
that are based on a certain extended data type. The dialog will ask
you for the extended data type you
are searching for. Then the program will go through all tables
searching for fields that are based on this type.

What I have not covered is when a field is based on an extended data
type which in turn is based on the extended data type you are
searching.

Give it ago and let me know whether it suits you!

static void QryTableFieldEDTName(Args _args)
{
    Dictionary dictionary = new Dictionary();
    DictTable dictTable;
    DictField dictField;
    DictType dictType;

    Dialog                  dialog              = new Dialog("Search
Fields based on EDT  ");
    DialogField             dialogEDTName     = dialog.addField
(typeid(Name),"EDT Name");

    Int cntDict;
    Int cntFlds;

    Str EDTName;
    ;

    /* retrieve user input */
    if (dialog.run())
    {
        EDTName = dialogEDTName.value();
    }

    dialog.close();

    /* check value entered is not blank */
    EDTName = (EDTName==""?"*":EDTName);

    /* set window width and height */
    window 50, 20 at 5, 5;

    /* print the number of tables in the database */
//    print "Nbr of tables: "  +   Int2Str(dictionary.tableCnt());

    /* start looping through tables */
    for (cntDict=1; cntDict<=dictionary.tableCnt();cntDict++)
    {
        /* instantiate dictTable */
        dictTable = new DictTable(dictionary.tableCnt2Id(cntDict));

        /* print number of fields in table */
//        print "Table Number:    " + Int2Str(dictionary.tableCnt2Id
(cntDict));
//        print "Table Name:      " + dictTable.name
();               //=dictionary.tableName(dictionary.tableCnt2Id
(cntDict))
//        print "Nbr of fields:   " + Int2Str(dictTable.fieldCnt());

        /* start looping through fields */
        for (cntFlds=1; cntFlds<=dictTable.fieldCnt();cntFlds++)
        {
            /* instantiate dictField */
            dictField = new DictField(dictTable.id(),
dictTable.fieldCnt2Id(cntFlds));

            /* instantiate dictType */
            dictType = new DictType(dictField.typeId());

            if (dictField.type()==Types::UserType && dictType.name()
like EDTName) 
            //types::UserType indicates field is an EDT
            {
                print "Field Name:  " + dictField.name();
                print "Base Type:   " + Enum2Str(dictField.baseType
());
                print "Type (UserType = NO Enum):  " + Enum2Str
(dictField.type());
                print "ArraySize (1 = NO array) : " + Int2Str
(dictField.arraySize());
                print "TypeId EDT (0 = NO EDT)  : " + Int2Str
(dictField.typeId());
                print "EnumId of base enum (0 = NOT an Enum): " +
Int2Str(dictField.enumId());

                print "EDT Type Name: " + dictType.name();
                print "Type extend:   " + Int2Str(dictType.extend());
                pause;
                print "";
            }
        }
//        pause;
//        print "";
    }
}


regards,
Danny

--- In [EMAIL PROTECTED], "Walter Becker" <[EMAIL PROTECTED]>
wrote:
> For example:
>       I must find all Tables with Fields who's ExtendedDataTypes
are 'ListCodeId'.
>
> How can I accomplish this search with Program Code?
> Is there perhaps already existing functionality in Axapta?
>
> Walter Becker
> DDT




Yahoo! Groups Links

Reply via email to