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

New Rapper

edited December 2006 in RAP
Hello,
I 'm sorry but I am real new to this and I have what will seem a
very simple question I was hoping to get help with. I was comparing 2 sets
of data and wanted the output to be a list of only those items that do not
match. I had no problem comparing , using "if" dbtext1 <> dbtext2 (of course
including the data sets name etc, but what would you write after the "then"?
At the minute I turned the font either black or white depending which gave
me the full list with the offending info standing out in black, but the
report is tooo long, I just want a list of only those items that <> match.

Thx,
For any help,
Chris

Comments

  • edited December 2006
    Hi Chris,

    Ideally you would want to do this type of processing inside the dataset with
    SQL, then use a single DBText in your report. How do you have your report
    designed? Are DBText1 and DBText2 next to eachother horizontally or
    vertically? If they are the same value, what exactly would you like to
    happen? One option would be to place the DBText components inside a Region
    with Stretch set to True, then inside the DetailBand.BeforePrint event,
    toggle the visibility of the DBText components if they are the same value.

    DBText1.Visible := Dataset['MyField1'] <> Dataset['MyField2'];
    DBText2.Visible := Dataset['MyField1'] <> Dataset['MyField2'];

    --
    Regards,

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

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited December 2006
    try setting the Detail band's visible property. Set it explicitly, i.e.:

    if Value1 <> Value2 then
    Detail.Visible := True
    else
    Detail.Visible := False;

    it use to be that
    Detail.Visible := (Value1 <> Value2);

    may not work in certain situaions.

    --
    Ed Dressel
    Team DM
  • edited December 2006
    > Hello & thanks for the reply.
  • edited December 2006
    Thanks ,
    I will try this & see if it works.So "visible" is always something
    recognized by RAP? If so could I say DBText3.visible := True etc? That way
    only the items that meet the criteria will show?

    Appreciate the help.

    Chris

  • edited December 2006
    Hi Chris,

    If you place these DBTexts inside a dynamic height (detail) band, then the
    band should snap to a smaller size if the two DBTexts are not visible. Ed's
    suggestion is also a good one to set the visibility of the entire band.

    --
    Regards,

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

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited December 2006
    Hello & Thanks for your on going help.
    I tried setting the visibility of the DBTexts, but go a blank report as once
    the test was satisfied that some of the fields did contain the same info it
    allowed no item to appear. .You see I only want to see those that do not
    match, so it may not be possible to use the same DBTexts to print some info
    if the test is true & block those that are false?

    Chris
  • edited December 2006
    Hi Chris,

    What does your code look like? Are you certain you are setting the
    visibility of the DBText's or detail band back to True if the values are not
    the same? Which event are you placing this code?

    --
    Regards,

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

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited December 2006
    Hello Nico,
    Well I got it to work at last using your original idea.. I
    put the DBText's in a region and set it to stretch, then I used

    Detail.Visible := (Value1 <> Value2); for each DBText in the Detail band.
    The mistake I was making was omitting the other DBTexts, which gave me a
    report with some big gaps of blank info, once they were all listed only the
    desired info went into the report. Thank you all for your ideas. There may
    be a more efficient way, but I'm glad to get the results needed.

    Where can I get a list of the various "commands". That's probably not the
    right word but I'm talking about thing like "visible" . There must be many
    of these conditions that can be set for all type of situation. For example
    if I wanted to do calculations like adding the value of a given data set
    etc.

    Thanks again

    Chris



  • edited December 2006
    Hi Chris,

    Most of the published properties and routines in Delphi are available in
    RAP. You can see these either using the Code Toolbox in RAP or the RBuilder
    help file.

    --
    Regards,

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

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
This discussion has been closed.