funny looking table

stefquestefque Serbia
edited 11:56PM in FastReport 4.0
I apologise for my English in advance...
I have a table, which I don't know how to show on a report. Columns are ID, cash1, date1, cash2, date2, cash3, date3, cash4, date4, and so on till cash8. date8. It shows if someone can pay the whole amount from one time, or he can divide it in 8 parts, so cash1 and date1 always have data in them, but others can be empty.
For example, if a row in the table looks like this: 1, 200$, 21.11.2010, 300$, 23.12.2010, 500$, 15.01.2011, 0, 0, 0, 0....0, 0 I want to print in the report:
- 200$ until 21.11.2010 on account number xxxx
- 300$ until 23.12.2010 on account number xxxx
- 500$ until 15.01.2011 on account number xxxx

But, unfortunately I don't know how to make this work in FR and Delphi. I tried something, but it shows me that a column doesn't exist.

i:=1;
s:='cash'+IntToStr(i);
v:='';
begin
while ((i<9) or ((fizvestaj.frxReport1.FindComponent('MyDACQuery3') as TfrxMyDACQuery).Fields.FieldByName(s).Value<>0))
do
begin
v:=v+IntToStr((fizvestaj.frxReport1.FindComponent('MyDACQuery3') as TfrxMyDACQuery).Fields.FieldByName(s).Value)+'until'+....#13#10;
i:=i+1;
end;
end;
(fizvestaj.frxReport1.FindComponent('Memo65') as TfrxMemoView).memo.Strings[0]:='v';

I know it's not complete but the code breaks and shows that it can't find cash1. I thought that I could make a temp table that has columns cash and date and every row would represent a part of the payment. I don't know how to do that either so any help or any other idea would be helpful....

Comments

  • gordkgordk St.Catherines On. Canada.
    edited 11:56PM
    Your problem is the weird field arrangement of the table.
    you will need to fix it before anything else.
    columns should probably be
    accountnum date paymentamount

    you could then use a query with an orderby clause to supply data to fr and use a grouped report or
    you could use a crosstab
  • stefquestefque Serbia
    edited 11:56PM
    I understand what you mean, but the problem is that I am working with an old software that is already distributed, and I can not change the field arrangement in that table, that's why I am looking for a solution and help here...That's the reason I was looking for a way to maybe make a #tmp table and then fill it the way it would be easy to print it in the report, in some master band, or any other...
    Thank's any way....
  • gordkgordk St.Catherines On. Canada.
    edited 11:56PM
    look in the demos folder masterdetailuds demo it should give you some ideas on using the
    userdataset along with variables and the ongetvalue event.
    how you create your temp table is up to you and the tools you have available to you in delphi,





  • stefquestefque Serbia
    edited 11:56PM
    I've solved it with one master band and 7 children bands that are all connected and on every one I've put onbefourprint event so when the first one riches value of 0 the code breaks...

Leave a Comment

Rich Text Editor. To edit a paragraph's style, hit tab to get to the paragraph menu. From there you will be able to pick one style. Nothing defaults to paragraph. An inline formatting menu will show up when you select text. Hit tab to get into that menu. Some elements, such as rich link embeds, images, loading indicators, and error messages may get inserted into the editor. You may navigate to these using the arrow keys inside of the editor and delete them with the delete or backspace key.