How to parse CSV format files in CPO?
Hi,
Not able to read the csv format file in CPO.
I need to loop through each line of the csv file, and retrieve each field by splitting with ','
Can anybody help me in this?
Thanks,
Swati
Use the "Read Table from Text" activity. Here's a thread: https://supportforums.cisco.com/message/3570542#3570542
Similar Messages
-
Hi,
Is that anyone know that how to parse xCBL format in java? It would be a great help if any one can give me the examples or any information to do this.Using the SAXParser in JAXP the parsing of the XML file is event driven.
Instantiate the parser:
SAXParserFactory factory = SAXParserFactory.newInstance();
SAXParser parser = factory.newSAXParser();
InputSource is = new InputSource(new FileReader(theXML));call the parse method:
parser.parse(is, this);The following events are fired as the parser works through the XML public void startElement(String namespaceURI, String localName, String qName, Attributes atts) throws org.xml.sax.SAXException
public void endElement(String namespaceURI, String localName, String qName) throws org.xml.sax.SAXException
characters(char[] ch, int start, int length)etc.
You write what you want within each of these sections to handle the structure of your data. Keep in mind SAX is useful only when you know the structure of your XML. -
FM - gui_upload. Problems uploading CSV format file
Hi experts,
I am facing an issue here. I tried to upload a .csv format file using FM - gui_load, in the table LT_RAW all the information is all in one column and rest of the columns are empty.
How can i get the information to its respective fields?
below are my codes:
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = pv_file
READ_BY_LINE = 'X'
HAS_FIELD_SEPARATOR = 'X'
codepage = '4110'
IMPORTING
filelength = lv_filelength
TABLES
data_tab = lt_raw
EXCEPTIONS
file_open_error = 1
file_read_error = 2
no_batch = 3
gui_refuse_filetransfer = 4
invalid_type = 5
no_authority = 6
unknown_error = 7
bad_data_format = 8
header_not_allowed = 9
separator_not_allowed = 10
header_too_long = 11
unknown_dp_error = 12
access_denied = 13
dp_out_of_memory = 14
disk_full = 15
dp_timeout = 16
OTHERS = 17.
I can only upload using .CSV format.Hi Suhas,
below is the new code that i used. now the data is not filled in only one column,
Instead it will fill up the max length of the field and continue the data in other field and fill up its max length of the field.
" my declaration of lt_raw and ls_raw
lt_raw TYPE TABLE OF ZCTD_MIGCUSTOMER,
ls_raw like line of lt_raw,
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = pv_file
codepage = '4110'
IMPORTING
filelength = lv_filelength
TABLES
data_tab = lt_raw
EXCEPTIONS
file_open_error = 1
file_read_error = 2
no_batch = 3
gui_refuse_filetransfer = 4
invalid_type = 5
no_authority = 6
unknown_error = 7
bad_data_format = 8
header_not_allowed = 9
separator_not_allowed = 10
header_too_long = 11
unknown_dp_error = 12
access_denied = 13
dp_out_of_memory = 14
disk_full = 15
dp_timeout = 16
OTHERS = 17. -
I am a new learner to XML & JAVA,I dont't know how to parse the XML file using JAXP,Who can tell me,Who can write an Example?
thx
Best Regards.Using the SAXParser in JAXP the parsing of the XML file is event driven.
Instantiate the parser:
SAXParserFactory factory = SAXParserFactory.newInstance();
SAXParser parser = factory.newSAXParser();
InputSource is = new InputSource(new FileReader(theXML));call the parse method:
parser.parse(is, this);The following events are fired as the parser works through the XML public void startElement(String namespaceURI, String localName, String qName, Attributes atts) throws org.xml.sax.SAXException
public void endElement(String namespaceURI, String localName, String qName) throws org.xml.sax.SAXException
characters(char[] ch, int start, int length)etc.
You write what you want within each of these sections to handle the structure of your data. Keep in mind SAX is useful only when you know the structure of your XML. -
How to Parse an HTML File?
Hi all
I want to parse an HTML file?
How is it possible?
After taking an input which is an HTML file, i need to parse it, and i need to print/modify values based on some tags?
Please help me, how to parse an HTML file?You start by reading the first character and then continiung until you reach the last character.
For a more serious answer try elaborating on your question. Its really really vague. -
How quickly parse big XML file (60 MB) ???
How quickly parse big XML file (60 MB) ???
I assume you mean load it into XML DB ?. Fundamentally your document is about the upper limit for 9.2.x. I would strongly recommend trying to break it up into a set of smaller documents using a SAX parser before trying to load it into XML DB. In 10g it should be possible to load much bigger documents than this.
-
I'm trying to load data into csv format file, by adding "," at the "Text Delimiter" at the "Files" tab. However, it adds several commas as:
,aaaaaa , ,aaaaaaaa , ,aa,
,bbbbbb , ,bbbbbbbb , ,bb,
,cccccc , ,cccccccc , ,cc,
Can anyone confirm if it's right way to load into csv file?There is too many commas!
You should not use a comma in your text delimiter but a quote' or double quote"
and put a comma in the field separator to have something like
"aaa","aaaa","aa" -
Unable to open CSV format files
Hi , Iam using Blackberry Z3 handset . But unable to opening the files in CSV format files .
Please help meHi and Welcome to the Community!
Refer:
Article ID: KB35546 BlackBerry 10 OS - Supported Attachement types
It would appear that CSV is not a supported attachment format.
Good luck!
Occam's Razor nearly always applies when troubleshooting technology issues!
If anyone has been helpful to you, please show your appreciation by clicking the button inside of their post. Please click here and read, along with the threads to which it links, for helpful information to guide you as you proceed. I always recommend that you treat your BlackBerry like any other computing device, including using a regular backup schedule...click here for an article with instructions.
Join our BBM Channels
BSCF General Channel
PIN: C0001B7B4 Display/Scan Bar Code
Knowledge Base Updates
PIN: C0005A9AA Display/Scan Bar Code -
How to generate .SQL format file from oracle database?
How to generate .SQL format file from oracle database?
I have a database of Oracle 8.1.6,now want to generate script file (including table structure,index,etc.) from it,What should I do?
Thanks.Your question pertains to the Database Export/Import. This forum exclusively focusses on the export/import utilities that come along with "Oracle Portal" which is a web-based tool. Could you please post your question under the RDBMS export/import or migration forum.
-
How to use CSV format in making a data connection.
Hello All,
I have got a form to develop. There are over 1000 entries to be imported. Can I use CSV format to embed those data in the forms. Mainly those data would be embedded as dropdowns.If I can use how to do it ? If i can not use is there any better way without using the Database like MySQL or something.
Thanks.
Bibhu.Hi Afroz,
To be more specific, if the csv file doesn't has header, please refer to this script to add header:
$csv = Import-Csv d:\haha.csv -Header "UserA","UserXYZ","EmailA"
Then you can loop this csv file to run the "add-mailboxpermission" cmdlet, I recommend you can test this script before running against production environment, please also note I haven't tested this script:
$csv = Import-Csv d:\users.csv -Header "UserA","UserXYZ","EmailA"
foreach($each in $csv){
write-host "assign fullaccess permission of user $($each.UserXYZ) on mailbox $($each.EmailA)"
get-mailbox -identity $each.EmailA | add-mailboxpermission -user $each.UserXYZ -accessrights 'fullaccess'
If there is anything else regarding this issue, please feel free to post back.
Best Regards,
Anna Wang
Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Support, contact [email protected] -
Runtime error in KEFC Transaction while uploading CSV format file
Hi Experts,
This is regarding Runtime Error while executing the KEFC transaction in R3D.
It is working successfully while uploading the file in Text format. But there is run time error while uploading in CSV format.
It showing "The transfer was terminated.However,content errors occured" .
Please provide the solution.
Thanks in advance.
Regards,
Priya.Hi,
To upload a CSV file it is used FM:
CALL FUNCTION 'TEXT_CONVERT_CSV_TO_SAP'
EXPORTING
i_field_seperator = ';'
I_LINE_HEADER =
i_tab_raw_data = lt_file
i_filename = p_filename
TABLES
i_tab_converted_data = p_table
EXCEPTIONS
conversion_failed = 1
OTHERS = 2
Please check what separetor this fm and your file are using. It should be the same.
Regards,
Fernando -
JDBC Adapter how to select multi format files on AS/400
Hi all,
i want to access a multi format file in a AS/400 Library via JDBC Adaptor. When i try to 'select * from XXXX.FILEN' i get an error "SQLException during query 'select * from XXXX.FILEN': java.sql.SQLException:[SQL7003]File FILEN in XXXX has more than one format.
Does anybody knows how to access a multi format file in AS/400 via a SQL statement which i can use in the JDBC-Adaptor configuration.
Thanks,
JuergenHi Jurgen,
Check this link,
http://help.sap.com/saphelp_nw04/helpdata/en/2e/96fd3f2d14e869e10000000a155106/frameset.htm
also a guess, instead of "*", can you try with column names of required columns (and make multiple queries, based on qualifiers/columns for appropriate formats within the same file)
Regards
Vishnu -
Error when transferring table data to a CSV format file.
Hi
I am getting an error when I am passing the parameter value for the file name from the selection screen. If i hard code the path and name it works fine. can any one help me please. here is my code:
PARAMETERS: OUTFILE LIKE dxfile-filename
DEFAULT 'C:\Apositivepay.txt',
RUNDATE LIKE PAYR-LAUFD,
Bank LIKE T012K-HBKID. "List of Possible Banks
type-pools:TRUXS.
DATA: BEGIN OF OUTPUT_REC OCCURS 0, "Output file for USBANK
ACCT(12), "bank account no
Payee2(40) type c, "payee 2
END OF OUTPUT_REC.
data: itab1 type TRUXS_T_TEXT_DATA.
CALL FUNCTION 'SAP_CONVERT_TO_CSV_FORMAT'
EXPORTING
I_FIELD_SEPERATOR = ','
TABLES
I_TAB_SAP_DATA = OUTPUT_REC
CHANGING
I_TAB_CONVERTED_DATA = itab1
EXCEPTIONS
CONVERSION_FAILED = 1
OTHERS = 2.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
filename = OUTFILE "This doesn't work
filename = 'C:\Apositivepay.txt' "This works
TABLES
DATA_TAB = itab1
EXCEPTIONS
FILE_OPEN_ERROR = 1
FILE_WRITE_ERROR = 2
INVALID_FILESIZE = 3
INVALID_TABLE_WIDTH = 4
INVALID_TYPE = 5
NO_BATCH = 6
UNKNOWN_ERROR = 7
OTHERS = 8.
Message was edited by: Anwarul Kabirhi,
use this code and save that file in CSV format it will work
OPEN DATASET P_IFILE FOR INPUT IN TEXT MODE ENCODING DEFAULT.
IF SY-SUBRC NE 0.
MESSAGE E000 WITH 'Problem in opening Application Server file'.
ELSE.
DO.
READ DATASET P_IFILE INTO IT_UPLOAD.
IF SY-SUBRC NE 0.
EXIT.
ELSE.
APPEND IT_UPLOAD.
CLEAR IT_UPLOAD.
ENDIF.
ENDDO.
CLOSE DATASET P_IFILE.
ENDIF.
IF IT_UPLOAD[] IS INITIAL.
MESSAGE E000 WITH 'NO data in the file/upload problem'.
ENDIF.
LOOP AT IT_UPLOAD.
SPLIT IT_UPLOAD AT ','
INTO
IT_FDATA-MATNR
IT_FDATA-WERKS.
IT_FDATA-SLGORT.
APPEND IT_FDATA.
CLEAR IT_FDATA.
ENDLOOP.
IT_TOTAL1[] = IT_FDATA[]. -
Creating CSV format/files from Objects
Hi,
Context : I need to convert a linear object (having only one level of member variables) into CSV format.
Progress: I have been able to create CSV format if strings are passed.
Requirement: However, I was wondering if it is possible to create the entire CSV at one shot, instead of having to pass the object members separately, as this wud turn out to be very cumbersome for objects with lots of members...
Is there a way to create a csv file or formatted text, if given a linear object?
Any pointers appreciated
Cheers!
Nicki was wondering....
if the class is dynamically created at runtime, then we would not be able to build such a functionality. Any thoughts? -
How to parse a flat file with C#
I need to parse a flat file with data that looks like
01,1235,555
02,2135,558
16,156,15614
16,000,000
You get the idea. Anyway, I'd like to just used a derived column and move on except I need to put a line number on each row as it comes by so the end looks like,
1,01,1235,555
2,02,2135,558
3,16,156,15614
4,16,000,000
I'm trying to do with a script transformation but I can't seem to get the hang of the syntax. I've tried looking at various examples but everybody seems to prefer VB and I'd like to keep all of my packages C#. I've set up my input and my output columns I just
need to figure out how to write the code that says something like:
row_number = 1
line_number = row_number
record_type = input.split.get the second data element
data_point_1 = input.split.get the third data element
row_number = row_number ++/* Microsoft SQL Server Integration Services Script Component
* Write scripts using Microsoft Visual C# 2008.
* ScriptMain is the entry point class of the script.*/
using System;
using System.Data;
using Microsoft.SqlServer.Dts.Pipeline.Wrapper;
using Microsoft.SqlServer.Dts.Runtime.Wrapper;
[Microsoft.SqlServer.Dts.Pipeline.SSISScriptComponentEntryPointAttribute]
public class ScriptMain : UserComponent
private int rowCounter = 0;
// Method that will be started before the rows start to pass
public override void PreExecute()
base.PreExecute();
// Lock variable for read
VariableDispenser variableDispenser = (VariableDispenser)this.VariableDispenser;
variableDispenser.LockForRead("User::MaxID");
IDTSVariables100 vars;
variableDispenser.GetVariables(out vars);
// Fill the internal variable with the value of the SSIS variable
rowCounter = (int)vars["User::MaxID"].Value;
// Unlock variable
vars.Unlock();
// Method that will be started for each record in you dataflow
public override void Input0_ProcessInputRow(Input0Buffer Row)
// Seed counter
rowCounter++;
// Fill the new column
Row.MaxID = rowCounter;
Here is a script to get an incremental ID. On the ReadWriteVariables of the script add the "User::MaxID" variables to get the last number. On the Inputs and Outputs tab, create an output column here in the code it's MaxID numeric data types.
Maybe you are looking for
-
Installing Photoshop Elements on a new computer
The hard drive on which my copy of Photoshop Elements 6 was installed has crashed and cannot be restored. I will receive a new computer tomorrow and wish to install the program on that. How do I deactivate the program and reactivate it on the new com
-
Position of column in query view
Hi, When i create a new column in a work book via the function 'add a formula', is it possible to place it in first position? I did try without success Thanks for your help Claude
-
Query on Service Order Reports
Hi, Need to take report based on Months for the Open Service Orders Quantity Actual Cost Value of Open Service Orders (Local Currency) Actual Billable Cost Value of Open Service Orders (Local Currency) Month to Date Revenue Month to Date Margin Quant
-
for the first time, I decided to use RMAN, took fullbackup thru rman twice then I deleted my controlfile, datafiles and SPfile, now I don't know how to recover them because I am not even able to connect to catalog database. can somebody tell me how t
-
Can't Reactivate - Podcast Blocked or Removed
I’ve been podcasting and publishing through iTunes for three years. Recently I started putting out some video podcasts to complement my audio stuff. I was able to publish my feed successfully: http://www.myobpod.com/video/rss.xml http://phobos.apple.