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

Minor bug/irritation

edited February 2003 in General
We want to provide clients with the ability to create their own reports and
add them to the main application menu.

The easiest way for us to do this is to let the create reports in a certain
RBExplorer folder and pick these up when building the application menu.

Have got all this working with no problem...

The problem lies in trying to load a chosen report from RBITEM and running
it.

The logical way to do this is to use the Template.LoadFromDatabase method,
setting the Template.DataSettings.Name to the RBITEM key field and setting
the Template.DataSettings.NameField appropriately.

Unfortunately this does not work!!

The problem is because the key field in RBITEM is an integer. The
LoadFromDatabase checks to make sure Name is not longer than the maximum
length
allowed for NameField but, because it's an integer, returns a size of 0 so
does not pass the Name value through...(although everything worked fine when
size check temporarily disabled).

It seems ironic that we can't therefore load templates from RB's own
ReportExplorer without having to write code to get around it!!

It's only a very minor irritation but thought you ought to be aware of it!!

Have tried with RB6.03 but not with RB7 so don't know if now fixed.

Regards,

Pete Colson

Comments

  • edited February 2003
    What database are you using for this app? We have not run into this problem.
    Did you use the SQL script we provide in the installation in the end user
    databases directory to build the end user tables? The key field should be
    ItemID, an integer. Name should not be an integer type in the table
    definition, but rather a string type. See our end user databases demos
    directory for an example of your database specific description of the table
    structure that should be used for the RB End User tables.


    Cheers,

    Jim Bennett
    Digital Metaphors


  • edited February 2003
    Jim,

    We are using MSSQL and the file structures and indexes are as per your SQL
    scripts. The ItemID field is an integer and Name is a string (although we
    have used different field names)...

    The issue here is that the unique ID for a record in RBItem is ItemID (an
    integer) and not Name - there may be a number of records with the same name
    but with different FolderID's ...

    To ensure we access the right record in RBItem, we must use the ItemID and
    not Name.

    The problem lies in the TppDBPipeline.Locate function in ppDBPipe. The issue
    is that, if I specify ItemID as the NameField, the Locate function checks
    lField.Size and truncates the value to that length if shorter than the
    KeyValue (there's a comment there to the effect that it does this to avoid a
    possible BDE error).

    When connected to a MSSQL db, lField.Size returns a 0 value for ItemID,
    truncates the value we have passed to it to 0 bytes, and therefore does not
    work!
    Haven't tried with Paradox db...

    If lField.Size did not return a value of 0 for an integer field, it would
    work OK...

    The irritation is therefore that I cannot load a template, created with
    RB's ReportExplorer, using RB's LoadFromDatabase function without:

    1. Create a filter on the table assigned to my plItem pipeline which filters
    the one record I want e.g. where ItemID = keyvalue of the one I want
    2. Open the dataset
    3. set the Template.DataSettings.Name to the value of the Name field in the
    one record in the plItem pipeline

    I cannot use the LoadFromDatabase method with the unique key field (as I
    would expect to) - I have to filter the dataset to get the one I want
    before using the Name field instead - at least when connected to a MS SQL db
    ...

    Not a big issue, admittedly, but it took me a while to find what was going
    wrong and it wouldn't be difficult for DM to fix!!

    Hope this helps ...

    Pete Colson



This discussion has been closed.