camste
11th April 2013, 14:33
Hello,
We have a report which is mainly used for exporting to Excel. The problem is now that we're running out of space on the row (we've reached the limit of 255), and we want to add some fields. But since it's used in Excel we don't care about keeping the report width narrow enough to fit on one page, and want to add more columns to the same row so that it's not split when exporting. I've read that if using a script with spooling you can get a width up to 512 characters. But where do you put this spooling? In the session script or the report script? And how can you do this with the report layout? Can you actually use one? But then I guess you would have to distribute the information over two lines and somehow merge it into one since the layouts can have maximum 255 characters? Or do you have to enter the row manually into a string variable and then feed that one to the spool.buf function?

Thank you

Camilla

Eddie Monster
11th April 2013, 17:43
We have done this using commands listed here (http://www.baanboard.com/programmers_manual_baanerp_help_functions_directory_file_operations_synopsis) (specifically the seq.open, seq.puts, and seq.close).

The basic flow we used was (with corresponding command):

Open a file (seq.open)
Gather your data and write using a pipe delimiter (seq.puts)
Close the file (seq.close)
Copy file to user's local machine (server2client)
Open file (app.start)


There are plenty of posts in the forum to use if you search.

I've done this in a session script if the data returned is simple. I have done this in a report script when the natural flow of the sorting or need for totals (or other calculations) lend itself to be better served by the structure of using a report.

mark_h
11th April 2013, 17:44
If I needed something with more than 255 characters I would use the session and just create a file using the seq.* commands. Of course I am on 4c4 and do not know if it is different for LN. I could also use a report with multiple detail layouts - and then an excel macro to combine the lines or manipulate the data however it was needed. Those are the two methods I would use.

zardoz
16th April 2013, 10:37
If the report has to be opened with excel, the better is to use seq.* commands instead of the traditional report. If you use the ; delimiter and give the file the extension ".csv" you can double click directly on the file from the client side and run automatically excel. I've used so much to send files thru email that can be read from the receipient in excel.

camste
17th April 2013, 09:11
The thing is that we are using the web client in LN. Does this work in that case?