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!
MZ

Hello,
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

Similar Messages

  • How can i compare two excel files with different no. of records.

    Hi
    I am on to a small project that involves us to compare two excel files. i am able to do it but am struck up at a point. When i compare 2 different .csv files with different no. of lines i am only able to compare upto a point till when the number of lines is same in both the files.
    Eg. if source file has 8 lines and target file has 12 lines. The difference is displayed only till 8 lines and the remaining 4 lines in source lines are not shown.
    Can you help me in displaying those extra 4 lines in source file. I am attaching my code snippet below..
    while (((strLine = br.readLine()) != null) && ((strLine1 = br1.readLine())) != null)
                     String delims = "[;,\t,,,|]";
                    String[] tokens = strLine.split(delims);
                    String[] tokens1 = strLine1.split(delims);
                   if (tokens.length > tokens1.length)
                    for (int i = 0; i < tokens.length; i++) {
                        try {
                            if (!tokens.equals(tokens1[i])) {
    System.out.println(tokens[i] + "<----->" + tokens1[i]);
    out.write(sno + " \t" + lineNo1 + " \t\t" + tokens[i] + "\t\t\t\t" + tokens1[i]);
    out.println();
    sno++;
    } catch (Exception exception)
    out.write(sno + " \t" + lineNo1 + " \t\t" + tokens[i] + "\t\t\t\t" + "");
    out.println();
    Thanks & Regards                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

    A CSV file is not an Excel file.
    But apart from that your logic makes no sense.
    If the 2 files are of different sizes the files are different by definition, so further comparison isn't needed, you're done.
    If you want to compare individual records, you need to compare all records from one file with all records from the other, unless the order of records is important in which case your current system might work.
    That system however is overly complicated for comparing CSV files.
    As you assume a single record per line, and if one can assume those records to have identical layout (so no leading or trailing whitespace in or between columns in one file that's not in the other) comparing records is simply a matter of comparing the entire lines.

  • How to import data from CSV file with columns separated by semicolon?

    I migrate database from MS SQL 2008 to ORACLE 11g
    I export data to CSV file from MS SQL
    then I try to import it to Oracle
    several tables goes fine using Import data option in the SQL Developer
    Standard CSV files with data separated by comma were imported.
    chars, date (with format string), and integer data are imported via import wizard without problems
    the problems were when I try to import table with noninteger numbers with modal part separated by comma not by dot
    comma is the standard separator for columns in CSV file
    so I must change the standard separator to semicolon
    then the import wizard have problem to correct recognize the columns data because it use only standard CSV comma separator :-/
    In SQL Developer 1.5.3 Tools -> Preferences -> Migration -> Data Move Options
    I change "End of Column Delimiter" to ; but it doens't work
    Is this possible to change the standard column separator for import data wizzard in SQL Developer 1.5.3?
    Or maybe someone know how to import data in SQL Developer 1.5.3 from CSV when CSV colunn separator is set to semicolon?

    A new preference has been added to customize the import delimiter in main code line. This should be available as part of future release.

  • How to generate graphs from csv file and show on remote clients?

    Hi,
    I have set of csv files. Each file has 104 parameters. From these parameters different graphs have to be generated and displayed to remote clients thru tomcat.
    Can anyone tell me how to do that?
    cheers,
    its reeju

    it's very easy to load the CSV into java objects. Once you have done that why not use the Java2D API to draw your graphs and then use the Sun JPG encoder tools to write out a jpg stream back to the browser (you will need to set the content type for jpg).

  • How do I upload a CSV file with embedded quotation marks into a table via ETL

    I'm having a problem importing a CSV file via ETL that contains double-quotes, and prior solutions aren't helping.  My data looks like this:
    A
    B114SA                             
    CHLORASCRUB SWAB INS SUBASSEMB                  
    A
    S273SA                             
    CHLORASCRUB MAXI INS SUBASSEMB                    
    A
    2AB286                             
    WEB ZEE ANTISEPT 5410\4.5" CD                     
    A
    2AB512                             
    WEB PDI PVP IODINE PREP PAD 3870/4.5              
    A
    2AB542                             
    WEB ZEE CLEAN WIPE NP5410/4.5                     
    If I set the "Text Qualifier" to ' " ', then run it, it falls over on the third row, with the following error:
    - Executing (Error)
    Messages
    Error 0xc0202055: Data Flow Task 1: The column delimiter for column "Column 2" was not found.
     (SQL Server Import and Export Wizard)
    Error 0xc0202092: Data Flow Task 1: An error occurred while processing file "H:\AS400_file_transfers\LIMS\ACTITEMPF.CSV" on data row 3.
     (SQL Server Import and Export Wizard)
    Error 0xc0047038: Data Flow Task 1: SSIS Error Code DTS_E_PRIMEOUTPUTFAILED.  The PrimeOutput method on component "Source - ACTITEMPF_CSV" (1) returned error code 0xC0202092.  The component returned a failure code when the pipeline engine
    called PrimeOutput(). The meaning of the failure code is defined by the component, but the error is fatal and the pipeline stopped executing.  There may be error messages posted before this with more information about the failure.
     (SQL Server Import and Export Wizard)
    Any help?

    Full support for embedded quotes was added in SSIS 2012.
    Which version are you using?
    http://blogs.msdn.com/b/mattm/archive/2011/07/17/flat-file-source-changes-in-denali.aspx

  • How to process large input CSV file with File adapter

    Hi,
    could someone recommend me the right BPEL way to process the large input CSV file (4MB or more with at least 5000 rows) with File Adapter?
    My idea is to receive data from file (poll the UX directory for new input file), transform it and then export to one output CSV file (input for other system).
    I developed my process that consists of:
    - File adapter partnerlink for read data
    - Receive activity with checked box to create instance
    - Transform activity
    - Invoke activity for writing to output CSV.
    I tried this with small input file and everything was OK, but now when I try to use the complete input file, the process doesn't start and automatically goes to OFF state in BPEL console.
    Could I use the MaxTransactionSize parameter as in DB adapter, should I batch the input file or other way could help me?
    Any hint from you? I've to solve this problem till this thursday.
    Thanks,
    Milan K.

    This is a known issue. Martin Kleinman has posted several issues on the forum here, with a similar scenario using ESB. This can only be solved by completely tuning the BPEL application itself, and throwing in big hardware.
    Also switching to the latest 10.1.3.3 version of the SOA Suite (assuming you didn't already) will show some improvements.
    HTH,
    Bas

  • Parse CSV file with some dynamic columns

    I have a CSV file that I receive once a week that is in the following format:
    "Item","Supplier Item","Description","1","2","3","4","5","6","7","8" ...Linefeed
    "","","","Past Due","Day 13-OCT-2014","Buffer 14-OCT-2014","Week 20-OCT-2014","Week 27-OCT-2014", ...LineFeed
    "Part1","P1","Big Part","0","0","0","100","50", ...LineFeed
    "Part4","P4","Red Part","0","0","0","35","40", ...LineFeed
    "Part92","P92","White Part","0","0","0","10","20", ...LineFeed
    An explanation of the data - Row 2 is dynamic data signifying the date parts are due. Row 3 begins the part numbers with description and number of parts due on a particular date. So looking at the above data: row 3 column7 shows that PartNo1 has 100 parts
    due on the Week of OCT 20 2014 and 50 due on the Week of OCT 27, 2014.
    How can I parse this csv to show the data like this:
    Item, Supplier Item, Description, Past Due, Due Date Amount Due
    Part1 P1 Big Part 0 20 OCT 2014 100
    Part1 P1 Big Part 0 27 OCT 2014 50
    Part4 P4 Red Part 0 20 OCT 2014 35
    Part4 P4 Red Part 0 27 OCT 2014 40
    Is there a way to manipulate the format to rearrange the data like I need or what is the best method to resolve this? Moreover how do I go about doing this? 

    Hello,
    If the files have the same structure you can create an Integration Service Package.
    see this article
    http://www.mssqltips.com/sqlservertip/2923/configure-the-flat-file-source-in-sql-server-integration-services-2012-to-read-csv-files/
    Javier Villegas |
    @javier_vill | http://sql-javier-villegas.blogspot.com/
    Please click "Propose As Answer" if a post solves your problem or "Vote As Helpful" if a post has been useful to you

  • How to generate & publish  webhelp html files in different folder than default folder

    Hi All,
    I am new to robo help. I have a requirement to generate & publish webhelp html files in a different folder than default folder.
    Could anyone please tell me the steps to change the folder
    Thanks
    Rashmi

    You change the generate folder and filename in the first field on the first page of the wizard. It must be a folder on your hard disk.
    You change the publish folder in the last page of the wizard. Anywhere you like.
    See www.grainge.org for RoboHelp and Authoring tips
    @petergrainge

  • How do I transfer a Numbers file with different tabs to an excel file?

    Hello
    I am a teacher and for each class I have a file in numbers. In each file I have different tabs for each period. Now I want to tranfer my files to my Macbook to print them out but from each file there is only one tab tranfered. How can I transfer all the tabs from each file? I transfer my files trough ITunes.
    help me please!

    Looks like I should be more careful when reading.  You did post in the iOS forum (in which case I expect most people here have iOS devices).  I do apologize for not being more carfeul.
    Here is a link to an APPLE web page that may help you transfer the document using iTunes:
    http://support.apple.com/kb/HT4088
    I hope this helps!
    Regards,
    Wayne

  • Creating pdf-file from multiple files with different orientation

    How do I put together two files with different orientation in the page set up so that the lying A4-format is standing up in the new pdf-file?

    lophelia wrote:
    How do I put together two files with different orientation in the page set up so that the lying A4-format is standing up in the new pdf-file?
    First I've underline a Phrase in your Question did you mean underlying A4-format?
    Are both PDF Files created with A4-Format? If yes then:
    Did you shift orientation to Portriat Format for the item(s) that you need, such as a Chart or an excel Document? If so:
    Then when the documents are meged  They should print correctly.

  • I also have a .csv file with the name of a jpeg in one column and a text description of each jpeg in a second column. Is there a way to automatically insert one jpeg (photo) and its corresponding text, each pair on one page, into a Indesign document?

    I also have a .csv file with the name of a jpeg in one column and a text description of each jpeg in a second column. Is there a way to automatically insert one jpeg (photo) and its corresponding text, each pair on one page, into a Indesign document?

    I would also recommend to write the description into the meta data. This would allow to place a text frame above the image and it is possible to add meta information and file name automatically together with the image, when you place it or even in a prepared template.
    Meta data information can be written easily in Bridge in the Meta File Workspace.

  • How to create a csv file with NCS attributes?

    Hi
    i installed Cisco Prime NCS and trying to perform bulk update of device credentials with csv file.
    How to create a csv file with all required attributes?
    This is part of NCS online help talking about this topic:
    Bulk Update Devices—To update the device credentials in a bulk, select Bulk Update Devices from the Select a command drop-down list. The Bulk Update Devices page appears.You can choose a CSV file.
    Note        The CSV file contains a list of devices to be updated, one device per line. Each line is a comma separated list of device attributes. The first line describes the attributes included. The IP address attribute is mandatory.
    Bellow is test csv file i created but does not work:
    10.64.160.31,v2c,2,10,snmpcomm,ssh,zeus,password,password,enablepwd,enablepwd,60
    10.64.160.31,v2c,2,10,snmpcomm,ssh,zeus,password,password,enablepwd,enablepwd,60
    The error i am getting while importing this file:
    Missing mandatory field [ip_address] on header line:10.64.160.31,v2c,2,10,snmpcomm,ssh,zeus,password,password,enablepwd,enablepwd,60
    Assistance appreciated.

    It looks like the IP address field is incorrectly set.,
    It should be as follows
    {Device IP},{Device Subnet Mask}, etc etc
    so a practical example of the aboove could be (i dont know if this is completely correct after the IP address / Subnet Mask)
    10.64.160.31,255.255.255.0,v2c,2,10,snmpcomm,ssh,zeus,password,password,enablepwd,enablepwd,60
    below is a link to the documentation
    http://www.cisco.com/en/US/docs/wireless/ncs/1.0/configuration/guide/ctrlcfg.html#wp1840245
    HTH
    Darren

  • How to upload .csv file with tab as delimiter.

    HI,
    I want to upload a .csv file with tab as delimiter to unix path in background.                                                                                                             
    I know there is function module 'GUI_UPLOAD', but in my case data is available in an internal table .
    upload the *.CSV :
    OPEN DATASET lv_filename
             FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.
        IF sy-subrc = 0.
      *     Write  file records into file on application server
          LOOP AT gt_datatab INTO gs_datatab.
            TRANSFER gs_datatab TO lv_filename.
          ENDLOOP.
    CLOSE DATASET lv_filename.

    Bhanu,
    Define a local variable of type CL_ABAP_CHAR_UTILITIES=>HORIZONTAL_TAB.
    LV_TAB TYPE CL_ABAP_CHAR_UTILITIES=>HORIZONTAL_TAB
    LOOP AT  GT_DATATAB INTO GS_DATATAB.
    CONCATENATE GS_DATATAB-FIELD1
                             GS_DATATAB-FIELD2
                             GS_DATATAB-FIELDN
                             INTO LV_STRING SEPARATED BY LV_TAB.
    TRANSFER LV_STRING TO lv_filename.
    ENDLOOP.
    Thanks,
    Vikram.M

  • How to read appended objects from file with ObjectInputStream?

    Hi to everyone. I'm new to Java so my question may look really stupid to most of you but I couldn't fined a solution by myself... I wanted to make an application, something like address book that is storing information about different people. So I decided to make a class that will hold the information for each person (for example: nickname, name, e-mail, web address and so on), then using the ObjectOutputStream the information will be save to a file. If I want to add a new record for a new person I'll simply append it to the already existing file. So far so good but soon I discovered that I can not read the appended objects using ObjectInputStream.
    What I mean is that if I create new file and then in one session save several objects to it using ObjectOutputStream they all will be read with no problem by ObjectInputStream. But after that if in a new session I append new objects they won't be read. The ObjectInputStream will read the objects from the first session after that IOException will be generated and the reading will stop just before the appended objects from the second session.
    The following is just a simple test it's not actual code from the program I was talking about. Instead of objects containing different kind of information I'm using only strings here. To use the program use as arguments in the console "w" to create new file followed by the file name and the strings you want save to the file (as objects). Example: "+w TestFile.obj Thats Just A Test+". Then to read it use "r" (for reading), followed by the file name. Example "+r TestFile.obj+". As a result you'll see that all the strings that are saved in the file can be successfully read back. Then do the same: "+w TestFile.obj Thats Second Test+" and then read again "+r TestFile.obj+". What will happen is that the strings only from the first sessions will be read and the ones from the second session will not.
    I am sorry for making this that long but I couldn't explain it more simple. If someone can give me a solution I'll be happy to hear it! ^.^ I'll also be glad if someone propose different approach of the problem! Here is the code:
    import java.io.*;
    class Fio
         public static void main(String[] args)
              try
                   if (args[0].equals("w"))
                        FileOutputStream fos = new FileOutputStream(args[1], true);
                        ObjectOutputStream oos = new ObjectOutputStream(fos);
                        for (int i = 2; i < args.length ; i++)
                             oos.writeObject(args);
                        fos.close();
                   else if (args[0].equals("r"))
                        FileInputStream fis = new FileInputStream(args[1]);
                        ObjectInputStream ois = new ObjectInputStream(fis);
                        for (int i = 0; i < fis.available(); i++)
                             System.out.println((String)ois.readObject());
                        fis.close();
                   else
                        System.out.println("Wrong args!");
              catch (IndexOutOfBoundsException exc)
                   System.out.println("You must use \"w\" or \"r\" followed by the file name as args!");
              catch (IOException exc)
                   System.out.println("I/O exception appeard!");
              catch (ClassNotFoundException exc)
                   System.out.println("Can not find the needed class");

    How to read appended objects from file with ObjectInputStream? The short answer is you can't.
    The long answer is you can if you put some work into it. The general outline would be to create a file with a format that will allow the storage of multiple streams within it. If you use a RandomAccessFile, you can create a header containing the length. If you use streams, you'll have to use a block protocol. The reason for this is that I don't think ObjectInputStream is guaranteed to read the same number of bytes ObjectOutputStream writes to it (e.g., it could skip ending padding or such).
    Next, you'll need to create an object that can return more InputStream objects, one per stream written to the file.
    Not trivial, but that's how you'd do it.

  • Is there a way to open CSV files with more than 255 columns?

    I have a CSV file with more than 255 columns of data.  It's a fairly standard export of social media data that shows volume of posts by day for the past year, from which I can analyze the data and publish customized charts. Very easy in Excel but I'm hitting the Numbers limit of 255 columns per table. Is there a way to work around the limitation? Perhaps splitting the CSV in two? The data shows up in the CSV file when I open via TextEdit, so it's there. Just can't access it in Numbers. And it's not very usable/useful for me in TextEdit.
    Regards,
    Tim

    You might be better off with Excel. Even if you could find a way to easily split the CSV file into two tables, it would be two tables when you want only one.  You said you want to make charts from this data.  While a series on a chart can be constructed from data in two different tables, to do so takes a few extra steps for each series on the chart.
    For a test to see if you want to proceed, make two small tables with data spanning the tables and make a chart from that data.  Make the chart the normal way using the data in the first table then repeat the following steps for each series
    Select the series in the chart
    Go to Format sidebar
    Click in the "Value" box
    Add a comma then select the data for this series from the second chart
    Press Return
    If there is an easier way to do this, maybe someone else will chime in with that info.

Maybe you are looking for

  • How can I work with the video feature on iPhone 3G after the new download?

    I have an 3G iPhone and have downloaded the software of iPhone 4. I still cannot make any videos. How can I do that? There is not the buttom to switch from pictures to video. Please, can anyone help me? Tks in advance.

  • Error while saving Business Rule EAS Java

    Hi there all, I get the following errror when saving a business rule that actually was working fine just yesterday. Something tells me it's about network issues but i'll appreciate if anyone got the same and how to solve this. Thanks. Error while sen

  • Changing the gallery name doesn't "stick."

    Hello, I have one gallery (all you can presently have with iPhoto 8) with a few password-protected albums. When I use iPhoto preferences to change the name of the gallery, previous gallery names appear on both the gallery and album pages of idisk. Em

  • When is an anonymous function evaluated?

    Hi everyone. I used two kinds of anonymous function in my AS 3.0 Flash file, in order to implement the roll-over animation of menu buttons. menu_1, menu_2, ... are the buttons already on the stage, and menu_list is an array of them. The code is about

  • Material Rejection At Production Floor

    Hi, We are a Manufacturing house, and the below mentioned scenaio is common for us: We receive Material against a PO, say 10000 PCS,  SLoc 1000, Batch 200701. As per the QC Norms, we pass the entire 10000 PCS, The MIRO & Payment is done for 10000 PCS