Home End User
New Blog Posts: Merging Reports - Part 1 and Part 2

Dictionary

edited July 2011 in End User
Hello,
I have a client that is asking can he change the field names on the
criteria window. I understand correctly the dictionary component should be
used for this pupose. Do you have to have entries for every field in the
database or only the fields that he requires to show the "end user" name.

regards

Steve

Comments

  • edited July 2011
    Hi Steve,

    Once you have all the proper tables created and connected to the
    DataDictionary and the database defined that you would like to define
    (see the help topic for TppDataDictionary), the DataDictionary will
    automatically generate entries for each table/field in the DB. Then you
    can go through and only change the tables/fields you need. See the main
    end-user demo for how this should be done (\Demos\3. End-User\1. Report
    Explorer\...).


    Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited July 2011
    A couple of options to using the Data Dictionary.

    1. From the Query Designer Fields page you can modify the Field Alias of
    selected fields. Use the mouse to select the field alias and then press the
    right button and select Rename.

    2. With RB 12 you can define Report.Parameters and configure the
    Parameter.AutoSearchSettings with a Field Alias value. Then use the Query
    Designer Search page to bind to the parameter.

    -
    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com

    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
  • edited August 2011
    Hi,
    I finally got round to attempting this,

    I have the tables datasources and pipelines for rbTable,rbField,rbJoin.

    I have a Data dictionary component linking to them.
    I have set ppDataDictionary1.Buildersettings.DatanaseName.

    I have linked the Designer.DataSettings.DataDictionary. to the dictionary
    component and set the UseDataDictionary =True.

    How do I get the program to populate the rbTable and rbField from the
    database?

    The tables remain empty and when I use the designer it now doesnt show any
    tables or fields to query because they are empty.

    Regards

    Steve




  • edited August 2011
    To add to this if I call

    ppDataDictionary1.AppendTableRecord('CoilTransactionTable','CoilTransactionTable');

    It adds an entry into rbTable and I can see the tablename from the
    designer.

    How do I get it to auto populate all tables in the database.

    regards

    Steve

  • edited August 2011
    You can use the DataDictionary Builder to generate the entries. There is a
    tutorial in the RB Developers Guide and there is also some excellent
    information in the RBuilder help topic for TppDataDictionary.

    -
    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com

    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
  • edited August 2011
    I have seen that and can see that I can generate the entries at design time.

    My application is not designed in a way that it is connected to the database
    at design time, also it would mean that I would have to populate the tables
    and then export the tables to the client's database.

    Is there a way I can get them populated at run time, also to add any new
    fields automatically.

    regards

    Steve


  • edited August 2011
    This is what I have now so far, It adds any fields in the database that do
    not exist in the dictionary tables.

    Have I created something that already exists?

    TableList := TStringList.Create;
    Database1.GetTableNames(TableList);
    for i := 0 to TableList.Count-1 do
    begin
    try
    if not
    rbTable.Locate('TableName',TableList.Strings[i],[loCaseInsensitive]) then
    ppDataDictionary1.AppendTableRecord(TableList.Strings[i],TableList.Strings[i]);
    with TempTable do
    begin
    DatabaseName := Database1.DatabaseName;
    TableName := TableList.Strings[i];
    FieldDefs.Update;
    for j := 0 to FieldDefs.Count-1 do
    begin
    if not
    rbField.Locate('TableName;FieldName',VarArrayOF([TableList.Strings[i],FieldDefs.Items[j].Name]),[loCaseInsensitive])
    then
    ppDataDictionary1.AppendFieldRecord(TableList.Strings[i],
    FieldDefs.Items[j].Name,
    FieldDefs.Items[j].Name,
    'T','T','T','F',
    daDataTypeToString(ppConvertFieldType(FieldDefs.Items[j].DataType)));
    end;
    end;
    except
    //TODO: Handle exceptions
    end;
    end;
    FreeAndNIL(TableList);


  • edited August 2011
    The code to the DataDictionaryBuilder resides in daDataDictionaryBuilder.pas
    if you want to check out how it works. Each page of the
    DataDictionaryBuilder is a separate class with some methods such as
    GenerateItems, SynchonrizeItems that I think would be helpful.


    -
    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com

    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
This discussion has been closed.