How to generate reports in text file without totals
Hi!!!
Does anybody knows how can I generate a report in text file
(separated by |), but without the lines with totalizations ?
In my application, the user can choose if he wants the output
in HTML,PDF or a text file. So, the solution to this question
must be implemented in code.
Thanks a lot,
Anderson.
If you put a formatting trigger on any item or frame and return FALSE, it will disappear.
So the totals need to be within a frame which has a trigger which returns false if text file is chosen.
Similar Messages
-
How to generate a second csv file with different report columns selected?
Hi. Everybody:
How to generate a second csv file with different report columns selected?
The first csv file is easy (report attributes -> report export -> enable CSV output Yes). However, our users demand 2 csv files with different report columns selected to meet their different needs.
(The users don't want to have one csv file with all report columns included. They just want to get whatever they need directly, no extra columns)
Thank you for any help!
MZHello,
I'm doing it usually. Typically example would be in the report only the column "FIRST_NAME" and "LAST_NAME" displayed whereas
in the csv exported with the UTL_FILE the complete address (street, housenumber, additions, zip, town, state ... ) is written, these things are needed e.g. the form letters.
You do not need another page, just an additional button named e.g. "export_to_csv" on your report page.
The csv export itself is handled from a plsql procedure "stored procedure" ( I like to have business logic outside of apex) which is invoked by pressing the button "export_to_csv". Of course the stored procedure can handle also parameters
An example code would be something like
PROCEDURE srn_brief_mitglieder (
p_start_mg_nr IN NUMBER,
p_ende_mg_nr IN NUMBER
AS
export_file UTL_FILE.FILE_TYPE;
l_line VARCHAR2(20000);
l_lfd NUMBER;
l_dateiname VARCHAR2(100);
l_datum VARCHAR2(20);
l_hilfe VARCHAR2(20);
CURSOR c1 IS
SELECT
MG_NR
,TO_CHAR(MG_BEITRITT,'dd.mm.yyyy') AS MG_BEITRITT ,TO_CHAR(MG_AUFNAHME,'dd.mm.yyyy') AS MG_AUFNAHME
,MG_ANREDE ,MG_TITEL ,MG_NACHNAME ,MG_VORNAME
,MG_STRASSE ,MG_HNR ,MG_ZUSATZ ,MG_PLZ ,MG_ORT
FROM MITGLIEDER
WHERE MG_NR >= p_start_mg_nr
AND MG_NR <= p_ende_mg_nr
--WHERE ROWNUM < 10
ORDER BY MG_NR;
BEGIN
SELECT TO_CHAR(SYSDATE, 'yyyy_mm_dd' ) INTO l_datum FROM DUAL;
SELECT TO_CHAR(SYSDATE, 'hh24miss' ) INTO l_hilfe FROM DUAL;
l_datum := l_datum||'_'||l_hilfe;
--DBMS_OUTPUT.PUT_LINE ( l_datum);
l_dateiname := 'SRNBRIEF_MITGLIEDER_'||l_datum||'.CSV';
--DBMS_OUTPUT.PUT_LINE ( l_dateiname);
export_file := UTL_FILE.FOPEN('EXPORTDIR', l_dateiname, 'W');
l_line := '';
--HEADER
l_line := '"NR"|"BEITRITT"|"AUFNAHME"|"ANREDE"|"TITEL"|"NACHNAME"|"VORNAME"';
l_line := l_line||'|"STRASSE"|"HNR"|"ZUSATZ"|"PLZ"|"ORT"';
UTL_FILE.PUT_LINE(export_file, l_line);
FOR rec IN c1
LOOP
l_line := '"'||rec.MG_NR||'"';
l_line := l_line||'|"'||rec.MG_BEITRITT||'"|"' ||rec.MG_AUFNAHME||'"';
l_line := l_line||'|"'||rec.MG_ANREDE||'"|"'||rec.MG_TITEL||'"|"'||rec.MG_NACHNAME||'"|"'||rec.MG_VORNAME||'"';
l_line := l_line||'|"'||rec.MG_STRASSE||'"|"'||rec.MG_HNR||'"|"'||rec.MG_ZUSATZ||'"|"'||rec.MG_PLZ||'"|"'||rec.MG_ORT||'"';
-- DBMS_OUTPUT.PUT_LINE (l_line);
-- in datei schreiben
UTL_FILE.PUT_LINE(export_file, l_line);
END LOOP;
UTL_FILE.FCLOSE(export_file);
END srn_brief_mitglieder;Edited by: wucis on Nov 6, 2011 9:09 AM -
Is it possible to read/write to text file without deleting it?
I know how to read from a text file and how to write to a text file. The problem that i have is i need to use a text file to store data for my application to read and also for my application to write. I would like it if i could write two programs really, one reads, the other is used to update the text file. This file is a list of verbs. I thought about using databases but i couldn't get them to work. I downloaded MySQL server 5.0 and installed it. I then downloaded the driver from http://www.mysql.com/products/driver and ran the auto installer. it said everything worked out perfectly but when i try these lines:
Class.forName("com.mysql.jdbc.Driver");
I get a SQLException that says no suitible driver
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
( I thought this driver came with the JDK but i guess not, i just read about it in a java book)
I get a ClassNotFoundException
that just says sun.jdbc.odbc.JdbcOdbcDriver
So yeah, SQL is pretty much not working. I need a solution to my problem, either by using text files, or a different type of database. I heard you could use excel to create a database but i have no idea how and i hear microsoft access could also do this, however i don't have microsoft access and i don't intend on paying for it. So, here are my questions:
1st, is there a tutorial on using excel databases in java programs
(if not)
2nd is there a way to read/write/update a text file without deleting it?
(if not)
3rd is there a way to get SQL working, i have windows vista this could be the problem
(if not)
4th what could i do to store information on the hd for reading and modifying later?
thanks, lateralusA database might be overkill just for a list of words.
Thoughts:
<ul>
<li>What is the extent of your "file updating"? If you are just appending to the file, opening it in append mode will keep the file from being clobbered.</li>
<li>Otherwise, why not create new files instead of editting them? The file names could include a version number or timestamp, allowing the reader to select the newest one.
</li>
</ul> -
Apex 3.0: export a report as .csv file without any Enclosed By character?
In Apex "Report Attributes page/Report Export" is possible to define the Enclosed By field.
The default Enclosed By by characters are a double quotation marks (" ").
Is there a way to export the report as .csv file without any Enclosed By character?
Example line format:
a) using default Enclosed By
"value1";"value2";"value3"
b) using ('') as Enclosed By
'value1';'value2';'value3'
c) using blank space as Enclosed By
value1 ; value2 ; value
d) without any Enclosed By character
value1;value2;value3
What can we do in Apex to export a report as .csv file with the line format example d)?
Thanks for your help.Hi,
There is no Out of the box feature in Apex to achieve this functionality. But what you can do is write a page process to generate the CSV that you want.
For this what I will do is on the first page where you press the Button it will call a PL/SQL page process which actually generates the csv. You can keep the existing report only for display purposes. Find the below process which generate the csv that you require.
begin
-- Set the MIME type
owa_util.mime_header( 'application/octet', FALSE );
-- Set the name of the file
htp.p('Content-Disposition: attachment; filename="filename.csv"');
-- Close the HTTP Header
owa_util.http_header_close;
htp.prn('columnHeader1,ColumnHeader2,ColumnHeader3'||chr(13));
-- Loop through all rows
for x in (
Select column1,column2,column3 from table;
loop
-- Print out a portion of a row,
-- separated by commas and ended by a CR
htp.prn(x."column1"||','||x."column2"||','||x."column3"||chr(13));
end loop;
-- Send an error code so that the
-- rest of the HTML does not render
htmldb_application.g_unrecoverable_error := true; --You can leave out this line if you still want to display the existing HTML report.
end;
This will show a download box, so you can download the csv file. The page process should be called before header and the condition should be the button press. -
How do I get a text file from Photoshop to work in the main sequence in pp?
How do I get a text file to work properly in the master sequence. I moved it from Photoshop, which I learned to do from a tutorial, but when I move the animated text sequence to the master, it either isnt running, or it is scaled way too big. How do I get it to run in the main sequence?
"Wont Work Here" ! Does not mean much.
Are you having an audio or a video issue?
Looks like no video clip on the video layer above that section of audio.
I am teaching myself this stuff completely on the fly
I suggest you do the Basic Tutorials ( Adobe TV for example) in both Premiere Pro and PhotoShop.
You need to be competent in the basics and fundamentals of these apps and that will also help you describe and discuss the issues. Check the 'Products on this site....
Adobe TV -
How to read a whole text file into a pl/sql variable?
Hi, I need to read an entire text file--which actually contains an email message extracted from a content management system-- into a variable in a pl/sql package, so I can insert some information from the database and then send the email. I want to read the whole text file in one shot, not just one line at a time. Shoud I use Utl_File.Get_Raw or is there another more appropriate way to do this?
how to read a whole text file into a pl/sql variable?
your_clob_variable := dbms_xslprocessor.read2clob('YOUR_DIRECTORY','YOUR_FILE');
.... -
How to read the whole text file lines using FTP adapter
Hi all,
How to read the whole text file lines when error occured middle of the text file reading.
after it is not reading the remaining lines . how to read the whole text file using FTP adapter
pls can you help meYes there is you need to use the uniqueMessageSeparator property. Have a look at the following link for its implementation.
http://download-west.oracle.com/docs/cd/B31017_01/integrate.1013/b28994/adptr_file.htm#CIACDAAC
cheers
James -
How to scan/ read a text file, pick up only lines you wanted.
I'm new to Labview, I trying to wire a VI which can read a text file
example below:
Example: My Text File:
1 abcd
2 efgh
8 aaaa
1 uuuu
and pick out only any line which start with number 1 (i.e 1 abcd)
then output these 2 lines out to a a new text file?
Thanks,
PalmtreeHi,
How do you creat your text files? Depending on the programm, there is added characters in the beginning and at the and of the file. So here you will find a VI to creat "raw" text files.
To debug your VIs, use the probs and breakpoints, so you can solve the problem by your self or give an more accurate description of it.
There is also the VI that read a integer and two strings (%d %s %s)
Attachments:
creat text file.vi 9 KB
read_from_file.vi 14 KB -
How can I open a PDF file without first saving the file?
How can I open a PDF file without first having to save the file?
How can I open a PDF file without first having to save the file?
-
How so i report my ipod stolen without having the serial number?
how so i report my ipod stolen without having the serial number?
The easiest way to find your serial number is this Open Itunes...click help... run diagnostics.....(tick or untick as necessary) so that you just have ticked the last two, device connectivity and device sync. run these tests. it will say no ipod/ipad found but will give results of test....scroll down to bottom of results... here you will find the serial number of your last attached devices.
-
How do I open a text file to sort using bubble sort?
Hi,
I have a text file, which is a list of #'s.. ex)
0.001121
0.313313
0.001334
how do you open a text file and read a list? I have the bubble sort code which sorts.. thanksI wrote this, but am getting a couple errors:
import java.util.*;
import java.io.*;
public class sort
public static void main(String[] args)
String fileName = "numsRandom1024.txt";
Scanner fromFile = null;
int index = 0;
double[] a = new double[1024];Don't use double. You should use something that implements Comparable, like java.lang.Double.
try
fromFile = new Scanner(new File(fileName));
catch (FileNotFoundException e)
System.out.println("Error opening the file " +
" + fileName);
System.exit(0);
while (fromFile.hasNextLine())
String line = fromFile.nextLine();
a[index] = Double.parseDouble(line);Don't parse to a double, create a java.lang.Double instead.
System.out.println(a[index]);
index++;
fromFile.close();
bubbleSort( a, 0, a.length-1 );No. Don't use a.length-1: from index to a.length-1 all values will be null (if you use Double's). Call it like this:bubbleSort(a, 0, index);
public static <T extends Comparable<? super T>> void
d bubbleSort( T[] a, int first, int last )
for(int counter = 0 ; counter < 1024 ; counter++)
for(int counter2 = 1 ; counter2 < (1024-counter) ;
) ; counter2++)Don't let those counter loop to 1024. The max should be last .
if(a[counter2-1] > a[counter2])No. Use the compareTo(...) method:if(a[counter2-1].compareTo(a[counter2]) > 0) {
double temp = a[counter2];No, your array contains Comparable's of type T, use that type then:T temp = a[counter2];
// ...Good luck. -
How to generate report with dynamic variable number of columns?
How to generate report with dynamic variable number of columns?
I need to generate a report with varying column names (state names) as follows:
SELECT AK, AL, AR,... FROM States ;
I get these column names from the result of another query.
In order to clarify my question, Please consider following table:
CREATE TABLE TIME_PERIODS (
PERIOD VARCHAR2 (50) PRIMARY KEY
CREATE TABLE STATE_INCOME (
NAME VARCHAR2 (2),
PERIOD VARCHAR2 (50) REFERENCES TIME_PERIODS (PERIOD) ,
INCOME NUMBER (12, 2)
I like to generate a report as follows:
AK CA DE FL ...
PERIOD1 1222.23 2423.20 232.33 345.21
PERIOD2
PERIOD3
Total 433242.23 56744.34 8872.21 2324.23 ...
The TIME_PERIODS.Period and State.Name could change dynamically.
So I can't specify the state name in Select query like
SELECT AK, AL, AR,... FROM
What is the best way to generate this report?SQL> -- test tables and test data:
SQL> CREATE TABLE states
2 (state VARCHAR2 (2))
3 /
Table created.
SQL> INSERT INTO states
2 VALUES ('AK')
3 /
1 row created.
SQL> INSERT INTO states
2 VALUES ('AL')
3 /
1 row created.
SQL> INSERT INTO states
2 VALUES ('AR')
3 /
1 row created.
SQL> INSERT INTO states
2 VALUES ('CA')
3 /
1 row created.
SQL> INSERT INTO states
2 VALUES ('DE')
3 /
1 row created.
SQL> INSERT INTO states
2 VALUES ('FL')
3 /
1 row created.
SQL> CREATE TABLE TIME_PERIODS
2 (PERIOD VARCHAR2 (50) PRIMARY KEY)
3 /
Table created.
SQL> INSERT INTO time_periods
2 VALUES ('PERIOD1')
3 /
1 row created.
SQL> INSERT INTO time_periods
2 VALUES ('PERIOD2')
3 /
1 row created.
SQL> INSERT INTO time_periods
2 VALUES ('PERIOD3')
3 /
1 row created.
SQL> INSERT INTO time_periods
2 VALUES ('PERIOD4')
3 /
1 row created.
SQL> CREATE TABLE STATE_INCOME
2 (NAME VARCHAR2 (2),
3 PERIOD VARCHAR2 (50) REFERENCES TIME_PERIODS (PERIOD),
4 INCOME NUMBER (12, 2))
5 /
Table created.
SQL> INSERT INTO state_income
2 VALUES ('AK', 'PERIOD1', 1222.23)
3 /
1 row created.
SQL> INSERT INTO state_income
2 VALUES ('CA', 'PERIOD1', 2423.20)
3 /
1 row created.
SQL> INSERT INTO state_income
2 VALUES ('DE', 'PERIOD1', 232.33)
3 /
1 row created.
SQL> INSERT INTO state_income
2 VALUES ('FL', 'PERIOD1', 345.21)
3 /
1 row created.
SQL> -- the basic query:
SQL> SELECT SUBSTR (time_periods.period, 1, 10) period,
2 SUM (DECODE (name, 'AK', income)) "AK",
3 SUM (DECODE (name, 'CA', income)) "CA",
4 SUM (DECODE (name, 'DE', income)) "DE",
5 SUM (DECODE (name, 'FL', income)) "FL"
6 FROM state_income, time_periods
7 WHERE time_periods.period = state_income.period (+)
8 AND time_periods.period IN ('PERIOD1','PERIOD2','PERIOD3')
9 GROUP BY ROLLUP (time_periods.period)
10 /
PERIOD AK CA DE FL
PERIOD1 1222.23 2423.2 232.33 345.21
PERIOD2
PERIOD3
1222.23 2423.2 232.33 345.21
SQL> -- package that dynamically executes the query
SQL> -- given variable numbers and values
SQL> -- of states and periods:
SQL> CREATE OR REPLACE PACKAGE package_name
2 AS
3 TYPE cursor_type IS REF CURSOR;
4 PROCEDURE procedure_name
5 (p_periods IN VARCHAR2,
6 p_states IN VARCHAR2,
7 cursor_name IN OUT cursor_type);
8 END package_name;
9 /
Package created.
SQL> CREATE OR REPLACE PACKAGE BODY package_name
2 AS
3 PROCEDURE procedure_name
4 (p_periods IN VARCHAR2,
5 p_states IN VARCHAR2,
6 cursor_name IN OUT cursor_type)
7 IS
8 v_periods VARCHAR2 (1000);
9 v_sql VARCHAR2 (4000);
10 v_states VARCHAR2 (1000) := p_states;
11 BEGIN
12 v_periods := REPLACE (p_periods, ',', ''',''');
13 v_sql := 'SELECT SUBSTR(time_periods.period,1,10) period';
14 WHILE LENGTH (v_states) > 1
15 LOOP
16 v_sql := v_sql
17 || ',SUM(DECODE(name,'''
18 || SUBSTR (v_states,1,2) || ''',income)) "' || SUBSTR (v_states,1,2)
19 || '"';
20 v_states := LTRIM (SUBSTR (v_states, 3), ',');
21 END LOOP;
22 v_sql := v_sql
23 || 'FROM state_income, time_periods
24 WHERE time_periods.period = state_income.period (+)
25 AND time_periods.period IN (''' || v_periods || ''')
26 GROUP BY ROLLUP (time_periods.period)';
27 OPEN cursor_name FOR v_sql;
28 END procedure_name;
29 END package_name;
30 /
Package body created.
SQL> -- sample executions from SQL:
SQL> VARIABLE g_ref REFCURSOR
SQL> EXEC package_name.procedure_name ('PERIOD1,PERIOD2,PERIOD3','AK,CA,DE,FL', :g_ref)
PL/SQL procedure successfully completed.
SQL> PRINT g_ref
PERIOD AK CA DE FL
PERIOD1 1222.23 2423.2 232.33 345.21
PERIOD2
PERIOD3
1222.23 2423.2 232.33 345.21
SQL> EXEC package_name.procedure_name ('PERIOD1,PERIOD2','AK,AL,AR', :g_ref)
PL/SQL procedure successfully completed.
SQL> PRINT g_ref
PERIOD AK AL AR
PERIOD1 1222.23
PERIOD2
1222.23
SQL> -- sample execution from PL/SQL block
SQL> -- using parameters derived from processing
SQL> -- cursors containing results of other queries:
SQL> DECLARE
2 CURSOR c_period
3 IS
4 SELECT period
5 FROM time_periods;
6 v_periods VARCHAR2 (1000);
7 v_delimiter VARCHAR2 (1) := NULL;
8 CURSOR c_states
9 IS
10 SELECT state
11 FROM states;
12 v_states VARCHAR2 (1000);
13 BEGIN
14 FOR r_period IN c_period
15 LOOP
16 v_periods := v_periods || v_delimiter || r_period.period;
17 v_delimiter := ',';
18 END LOOP;
19 v_delimiter := NULL;
20 FOR r_states IN c_states
21 LOOP
22 v_states := v_states || v_delimiter || r_states.state;
23 v_delimiter := ',';
24 END LOOP;
25 package_name.procedure_name (v_periods, v_states, :g_ref);
26 END;
27 /
PL/SQL procedure successfully completed.
SQL> PRINT g_ref
PERIOD AK AL AR CA DE FL
PERIOD1 1222.23 2423.2 232.33 345.21
PERIOD2
PERIOD3
PERIOD4
1222.23 2423.2 232.33 345.21 -
How to generate all index creation scripts without it's storage clause?
How to generate all index creation scripts without it's storage clause?
Execute this before running the actual dbms_metadata.get_ddl
exec dbms_metadata.set_transform_param(dbms_metadata.session_transform, 'STORAGE', FALSE);
SELECT DBMS_METADATA.GET_DDL('INDEX',a.index_name) FROM USER_INDEXES A;-Anantha
Edited by: Anantha R on Sep 30, 2009 11:40 AM -
How to write data to text file using external tables
can anybody tell how to write data to text file using external tables concept?
Hi,
Using external table u can load the data in your local table in database,
then using your local db table and UTL_FILE pacakge u can wrrite data to text file
external table
~~~~~~~~~~~
http://download-east.oracle.com/docs/cd/B19306_01/server.102/b14200/statements_7002.htm#i2153251
UTL_FILE
~~~~~~~~~
http://download-east.oracle.com/docs/cd/B19306_01/appdev.102/b14258/u_file.htm#sthref14093
Message was edited by:
Nicloei W
Message was edited by:
Nicloei W -
How to append paragraph in text file of TextEdit application using applescript
how to append paragraph in text file of TextEdit application using applescript and how do i save as different location.
christian erlinger wrote:
When you want to print out an escape character in java (java is doing the work in client_text_io ), you'd need to escape it.
client_text_io.put_line(out_file, replace('your_path', '\','\\'));cheersI tried replacing \ with double slash but it just printed double slash in the bat file. again the path was broken into two lines.
file output
chdir C:\\DOCUME~1\
195969\\LOCALS~1\\Temp\
Edited by: rivas on Mar 21, 2011 6:03 AM
Maybe you are looking for
-
Can't add any more music to iTunes
Help! I was going along great adding music to iTunes 11.0.0.163, then it just stopped. Tried adding files and folders (like I had been doing) and nothing more happened. Nothing new shows up in the Recently Added list. I have a Sony Vaio, Windows
-
How can i get the answers of security question
how can i get the answers of the questions for mt apple id
-
LMS4.1 user tracking not sortable
in LMS 4.1, under Monitor->Identity Dashboard, i have "user tracking summary" as a portlet, which tells me i have ~ 17,000 users. when i click the report, it pops up a screen that shows mac address, ip address, hostname, subnet, etc. If i try to do
-
Proxy Class (for compiling purpose)?
Since JDK 1.3, there is a Proxy class that allows us to dynamically generate Java object classes from scripts. We can use it to implement interface functions etc and calls to these functions would be redirect to a hook. My question is, will Sun consi
-
1. login in to sender system with <iqeadm> and executed the command R3ldctl to create control file on /home/iqeadm/sapinst directory 2. define RFC defination. 3.maintain target database with Oracle/RSD & sapinst directory path where the control files