0

Hi,
I need to Runexport from DB to specific file im my network, no problem.
When i search there is more than one post, so I get a list and export all searchhits, No problem.

BUT I need to name the pdf files to each specific invoice number.
Each post has a specific Invoice number.
Now the export only takes the post that I,m standing at.

When I export it set all document name to the same invoice number followed by _1, _2 .....

oReport:=application.getreport('reportname');
oReport.RunExport('test','\searchpath\financial\Invoice\'+ToSql(tablename.fieldnamer)+'.pdf',false);

HELP...

Edited by pritaeas: Moved

2
Contributors
9
Replies
11
Views
5 Years
Discussion Span
Last Post by pritaeas
0

Am a little unclear of what is happening. Are you looping a dataset, and outputting each row into a PDF ?

0

Well no..
I think I must do that in order to focus each row.
The result must be the same as the posts result and not only the first followed by_1 etc...
I could use some help...

0

You will have to generate a correct filename (based on the invoice), but without more information on what is happening it will be difficult to guide you.

0

Well what is happening is that the files are named to the first post.
ea.1000 (the correct name).
Then the next is named 1000_1, 1000_2 and so on.
I need to have the name from each posts.
The correct should have been 1000, 1001, 1002 (with data from the posts).

0
var
   oReport : object;   
   sSql, sFakturanr, sCond:string;
   iFaktnr : integer;

Begin
//sCond:=GetCondStr;
//sCond:='olh.foretagkod='+tosql(sy1.foretagkod)+' and olh.ftgnr='+tosql(olh.ftgnr);
//RunReport('rfaktful','faktura se',sCond,'');   //run a report with a certain template

  //Loop 
  SqlBegin('select distinct faktnr from olh where faktnr='+tosql(olh.faktnr)+' and foretagkod='+tosql(sy1.foretagkod));
  SqlBind(iFaktnr);
  if(SqlExecute) then begin
  while(SqlFetch) do begin

    oReport:=application.getreport('rfaktful' + '_' + sCond:='olh.faktnr='+tosql(olh.faktnr);
    oReport.RunExport('test','\\Linsql\jbs\EDM\Ekonomi\Faktura\'+ToSql(olh.faktnr)+'.pdf',false);
end;                                                                       
end;
end;
0

In RunExport, olh.faktnr is the same for all records (hence the _N postfixes on the filenames). Do you want to use a different column here?

0

No.
olh is the table and faktnr is where the invoice number is.
So it has to be this column!?

would a loop solve this with going to next post and getting that value from faktnr!?

0

SqlFetch should do just this (assuming from it's name). However, I am unfamilar with this function, or the tool you are using.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.