26 (edited by ehwagner 2017-01-19 04:08:25)

Re: Reports

Adam.


For the sake of getting you the screenshots I used the Post Image site. But I really would prefer to place images directly into the post. I hope somebody can demonstrate how to do that. Hopefully this will help you understand the workaround for the Group Footer.


Click on the following thumbnails.
https://s24.postimg.org/78s43ls75/Group_Footer_Definitions.png


https://s24.postimg.org/5jj0vjcht/Group_Header_Markup.png


https://s24.postimg.org/8p3mlqv41/Group_Footer_Script.png


Also, in your database the second company (id=4) did not have the logo image loaded in the record. Your company tablegrid loaded the image into the grid through script, but the record did not have the image. That's why it showed in the tablegrid, but not in the report. I put the image in the record and it shows in the report now.

Re: Reports

Cool stuff EHW..........
Thank you very much for your patience and time...............................................


I see that for image object on Fast Reports, images must be stored in DB not linked.


I think your images provides very valuable information for beginners like me amongst MVD lovers. Therefore, I put together and hot linked your images so that others can see bigger image within allocated forum post width here:


https://s23.postimg.org/8gvqvxqh7/zzzz_Reports.png

Adam
God... please help me become the person my dog thinks I am.

Re: Reports

Thank you Adam for the full size images. I am certainly not an expert when it comes to record level images whether they are stored in the database or linked externally. I don't typically work with them. But for my own edification I did some research in the forum and found the following project from Dimitry where you can link an image in a report through a script. I went ahead and updated your project with the same type script.


http://myvisualdatabase.com/forum/misc. … download=1


Something I learned (at least I think I learned) when it comes to defining images externally (LinkFile).  Apparently, you still define the image in the table, but it is never loaded (null) and you define another field for the actual image file name. It's kind of awkward. The calculated field in the table kind of threw me.

Post's attachments

Attachment icon ReportTest 3b Fixed 3.zip 402.45 kb, 512 downloads since 2017-01-19 

Re: Reports

Nice one EHW..
Thanks a lot.......


Straight to preview works fine.. However going to report designer and clicking preview produces some error dialog.. Looking for coLogo_filename field.


With trial and error I found the way to display two fields together. In my case I wanted to display customer name and surname in one line without extra spaces. The following script seems to work:

[<Report."Name">] [<Report."Surname">]
Adam
God... please help me become the person my dog thinks I am.

Re: Reports

Sorry Adam, I could not replicate the error. It works fine for me.

Re: Reports

Hi EHW,


These are the steps causing the error message at my end:
https://s24.postimg.org/3s57rrmbp/zzz_Test6.png

Adam
God... please help me become the person my dog thinks I am.

Re: Reports

Adam,


The report was built using the "ReportSQL". I adjusted the "Report" to print the same invoice format. There are two reports 1) Invoice.fr3 and 2) InvoiceSql.fr3. Each report button will run it's respective report.

Post's attachments

Attachment icon ReportTest 3b Fixed 4.zip 404.91 kb, 483 downloads since 2017-01-20 

Re: Reports

Great stuff as usual EHW... Thanks a lot..................


I wanted to add inv notes (memo field) content to invoice group footer using same method you have used with inv totals.
Added notes field to group header
defined notes field on group header dataset to report, datafield to notes
added text object to group footer and defined onafterdata event


I tried the following script without success:

procedure Memo24OnAfterData(Sender: TfrxComponent);
begin
   Memo24.text := ReportNotes.value;       
end;
Adam
God... please help me become the person my dog thinks I am.

Re: Reports

Attach your project Adam and I'll take a look at it.

Re: Reports

ehwagner wrote:

Attach your project Adam and I'll take a look at it.


Thanks EHW...


Here is the sample project:

Post's attachments

Attachment icon ReportTest 4.zip 69.37 kb, 494 downloads since 2017-01-20 

Adam
God... please help me become the person my dog thinks I am.

Re: Reports

Adam, Fixed project is attached. In your project the notes memo field was memo20 not memo24. ReportNotes is a text field so ReportNotes.value should be ReportNotes.text.

Post's attachments

Attachment icon ReportTest 4 Fixed.zip 403.69 kb, 518 downloads since 2017-01-21 

Re: Reports

Looks like I made two simple mistake.


Thanks a lot EHW........................

Adam
God... please help me become the person my dog thinks I am.

Re: Reports

I'm having reports blues again......


This time I'm trying to create a report for "SaleTransHist"
On "SaleTransHist" repeating values are hidden or replaced with value zero for easier reading and avoiding incorrect sums on tGrid footer.
Unfortunately, fast reports gets repeating values, therefore having duplicates and wrong sums in the report.
I tried workaround by copying column tGrid footer values those applying to per invoice not InvItem (Discount, Delivery and Inv Totals) but couldn't get those values displayed in fast reports?


Please see images below for additional reference:
https://s31.postimg.org/8zpb6s5bv/zzz_Test.png
https://s8.postimg.org/foq9uobvp/zzz_Test2.png


Sample is project attached. FR file "SalesTransHist.fr3" in the reports folder:

Post's attachments

Attachment icon ReportTest 5.zip 74.28 kb, 478 downloads since 2017-02-12 

Adam
God... please help me become the person my dog thinks I am.

Re: Reports

Adam, See attached for fix. You do not need the three extra fields you defined in the SaleInv table. I used the fields already defined in that table for the report.

Post's attachments

Attachment icon ReportTest 5 Fixed.zip 408.83 kb, 528 downloads since 2017-02-12 

Re: Reports

Hi EHW,


Thank you very much...................


Your approach is much better than mine. Taking out repeating fields to group header makes reading clearer and easier. Nice one..... Appreciated.......

Adam
God... please help me become the person my dog thinks I am.

Re: Reports

No problem Adam.  Actually I learned something new in putting this together for you. You can declare global report variables in FastReport Code tab. These variables can be used/manipulated and printed anywhere in the report. A good example of this would be when you want to repeat or use group header data in a group footer.

Re: Reports

Another wall I hit on FR......


I have a memo field with multiple pages of text. On report designer, I cannot get it displayed beyond first page. Tried different bands, stretch, set clipped to false but no luck.


Please see the attached sample projects:

Post's attachments

Attachment icon Reports - Long Text.zip 12.31 kb, 499 downloads since 2017-02-17 

Adam
God... please help me become the person my dog thinks I am.

Re: Reports

AD1408 wrote:

I have a memo field with multiple pages of text. On report designer, I cannot get it displayed beyond first page. Tried different bands, stretch, set clipped to false but no luck.


I still couldn't find a solution. Help would be appreciated

Adam
God... please help me become the person my dog thinks I am.

Re: Reports

AD1408
Hello.


For component Reportnote set property StrechMode = smActualHeight


for MasterData1 set property Stretched = True

Dmitry.

Re: Reports

Thank you very much Dmitry..................

Adam
God... please help me become the person my dog thinks I am.

46 (edited by AD1408 2017-05-10 13:47:11)

Re: Reports

I have an Invoice report. I like to change color of two fields in Fast Reorts depending on field 1 value.


Field 1. DbCr with 2 values (ReportDbCrdbcr)
Sale
Refund


Field 2. Fast reports text field (Memo1)


In Fast reports script editor I need the following script please.
----------------------------------------------------------------------------------
If Field 1 value is  'Sale' then Field 1 and Field 2 text color =clBlue

If Field 1 value is  'Refund' then Field 1 and Field 2 text color =clRed


The following didn't work?

procedure ReportDbCrdbcrOnAfterData(Sender: TfrxComponent);
begin
  if DbCrdbcr.text := 'Sale' then
  begin              
  DbCrdbcr.textColor := clBlue;
  Memo1.text := clBlue
  else
  if DbCrdbcr.text := 'Refund' then      
    begin
    DbCrdbcr.textColor := clRede;
    Memo1.text := clRede
    end;              
end;
Adam
God... please help me become the person my dog thinks I am.

Re: Reports

You had several errors in your code. Also, text fields are padded with spaces in FastReport so they need to be trimmed in If statements. Try below.


if trim(ReportDbCrdbcr.text) = 'Sale' then
  begin              
    ReportDbCrdbcr.font.Color := clBlue;
    ReportMemo1.font.color := clBlue;
  end else    
    begin
     ReportDbCrdbcr.font.Color := clRed;
     ReportMemo1.font.color := clRed;
    end;

Re: Reports

Hi EHW,


Thank you very much...........
Truly appreciated........


I had to take out  Report word from ReportMemo1 to get it working. I guess it was because memo1 wasn't db field, just a label in Fast reports. The following worked for me thanks to your kind help:

if trim(ReportDbCrdbcr.text) = 'Sale' then
  begin              
    ReportDbCrdbcr.font.Color := clBlue;
    Memo1.font.color := clBlue;
  end else    
    begin
     ReportDbCrdbcr.font.Color := clRed;
     Memo1.font.color := clRed;
    end;
Adam
God... please help me become the person my dog thinks I am.

Re: Reports

You are right about the memo field. I wasn't sure if that was a DB field or a label and just  made the assumption it was a DB field. I meant to stipulate that in my post, but glad you figured it out. Good luck on the rest of your project.