Converting csv files to signals
I need to convert this csv file to an analog signal. The timing and magnitude need to be exact
duplicate post
Similar Messages
-
How to convert csv files into java bean objects?
Hi,
I have a CSV file, I want to store the data availabale in that csv file into java bean, I am new to this csv files how can I convert CSV files into java beans.
Please help me.
Adavanced Thanks,
MahendraYou can use the java.io API to read (and write) files. Use BufferedReader to read the CSV file line by line. Use String#split() to split each line into an array of parts which were separated by comma (or semicolon). If necessary run some escaping of quotes. Finally collect all parts in a two-dimensional List of Strings or a List of Javabeans.
java.io API: [http://www.google.com/search?q=java.io+javase+api+site:sun.com]
java.io tutorial: [http://www.google.com/search?q=java.io+tutorial+site:sun.com]
Basic CSV parser/formatter example: [http://balusc.blogspot.com/2006/06/parse-csv-upload.html] -
Error converting CSV file into internal table
Hi,
I have to convert a large CSV file (>20.000 entries) into an internal table. I used FM GUI_UPLOAD to get a raw data table then convert this table using FM TEXT_CONVERT_CSV_TO_SAP.
But this does not seem to work properly: after 16.000 or so, the FM seems stuck as if in an endless loop.
Note that if I split the CSV file in several parts, the conversion runs successfully.
Is there any memory limit with this FM ?
Thanks,
FlorianFlorian Labrouche,
Instead of using two function modules, you can use 'TEXT_CONVERT_XLS_TO_SAP' function module once by specifying file name in that function module itself. It does not take much time.
Check the sample program.
report zvenkat-upload-xl no standard page heading.
"Declarations.
"types
types:
begin of t_bank_det,
pernr(8) type c,
bnksa(4) type c,
zlsch(1) type c,
bkplz(10) type c,
bkort(25) type c,
bankn(18) type c,
end of t_bank_det.
"work areas
data:
w_bank_det type t_bank_det.
"internal tables
data:
i_bank_det type table of t_bank_det.
" selection-screen
selection-screen begin of block b1 with frame title text_001.
parameters p_file type localfile.
selection-screen end of block b1.
"At selection-screen on value-request for p_file.
at selection-screen on value-request for p_file.
perform f4_help.
"Start-of-selection.
start-of-selection.
perform upload_data.
"End-of-selection.
end-of-selection.
perform display_data.
"Form f4_help
form f4_help .
data:
l_file_name like ibipparms-path .
call function 'F4_FILENAME'
exporting
program_name = syst-cprog
dynpro_number = syst-dynnr
field_name = 'P_FILE'
importing
file_name = l_file_name.
p_file = l_file_name.
endform. " f4_help
"Form upload_data
form upload_data .
type-pools:truxs.
data:li_tab_raw_data type truxs_t_text_data.
data:l_filename like rlgrap-filename.
l_filename = p_file.
call function 'TEXT_CONVERT_XLS_TO_SAP'
exporting
i_tab_raw_data = li_tab_raw_data
i_filename = l_filename
tables
i_tab_converted_data = i_bank_det
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.
endform. " upload_data
" Form display_data
form display_data .
data: char100 type char100.
loop at i_bank_det into w_bank_det .
if sy-tabix = 1.
write w_bank_det.
write / '------------------------------------------------------------'.
else.
write / w_bank_det.
endif.
endloop.
endform. " display_data
Regards,
Venkat.O -
Converting CSV file coming as string in one of the field of xml to XML
Hi ,
we have the below requirement where the dat type is :
DT_MESSAGE
field1 Data
field2 DataString
the csv file of the below format will be sent in the DataString field of xml .
Source;EIX3;Date;080526;Charge;70199;Si;.42 ;Fe;.20 ;Cu;.00 ;Mn;.027 ;Mg;.49 ;Cr;.0007 ;Ni;0 ;Zn;.01 ;Ti;.01 ;Ag;0 ;B;0 ;Ba;0 ;Be;0 ;Bi;0 ;Ca;0 ;Cd;0 ;Co;0 ;Ga;0 ;Na;0 ;Nb;0 ;Pb;0 ;Sb;0 ;Sn;0 ;Sr;0 ;V;0 ;Zr;0 ;Al;0 ;P;0 ;Hg;0 ;Li;0 ;Alloy;606044;Alloy_Hy;AC10;Diametre;152;Client;IMPOL
Source;EXF3;Date;080811;Charge;71460;Si;.04 ;Fe;.10 ;Cu;.002 ;Mn;.003 ;Mg;.002 ;Cr;.0006 ;Ni;.003 ;Zn;.014 ;Ti;.000 ;Ag;0 ;B;0 ;Ba;0 ;Be;0 ;Bi;0 ;Ca;0 ;Cd;0 ;Co;0 ;Ga;0 ;Na;0 ;Nb;0 ;Pb;.0010 ;Sb;0 ;Sn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;Diametre;152;Client;ARO TUBI
where the starting field is Sorce of each row .
I need to parse the above csv using xslt or java mapping .
The target structure xml is
DT_Target
row 0 to unbounded
field 1 Source
field2 Date
field3 Charge
field n Client
can anyone help me how to parse and map to the target.what could be the better method to do it.
Thanks and Regards,
RajeshYou can use xsl mapping to retrieve that payload ina single field and map it to target
Please check these links
String to XML using XSLT..
Re: String to XML using XSLT
/people/michal.krawczyk2/blog/2005/11/01/xi-xml-node-into-a-string-with-graphical-mapping
regards
Ninad -
Hi buddies,
I want to read the values of csv file in XML. Can anyone suggest me.. how to do so?
bye
its reejuHallo,
it is really quite easy! Our firm has developed a proprietary technology for a life assurance application which is configurable and adapts to changing requirements in the mapping between the CSV format and the XML. Unfortunately, I cannot release the technology to you, unless you wish to purchase it, or purchase consultancy from us.
I can however give you a couple of hints.
The most important starting position is to identify on paper how you want to map the fields in your csv-file to XML elements. You need to prepare a schema for the XML file, to document its structure. When you have done this, then you can start to implement the necessary solution.
Then you need to parse your CSV-file, to identify the fields in each line. It is often helpful if the first line of the csv-file contains the field names as a check, but it is not 100% necessary. You could, for example, store the fields in a Vector, or with associated field names in a Hashtable. You could build a Hashtable which maps csv-fields to XML-element-names. You then go through the individual fields and build a DOM-Tree, inserting the associated XML-elements in the correct positions. It is then a simple matter to transform your DOM-Tree to an XML file. For speed of implementation, we normally use XALAN with an xslt script, so that the XML looks reasonably formatted in the file.
Good luck
David Singleton
[email protected] -
Want to convert .CSV file into an internal table
Hi Experts,
I have a file for eg. data.csv on the application server and i want to transfer its contents to an internal table.
i tried using function module 'KCD_CSV_FILE_TO_INTERN_CONVERT' but it gives the UPLOAD_CSV exception.
Please suggest..
Thanks and Regards.you can do something like this..
DATA: BEGIN OF itab OCCURS 0,
vbeln LIKE vbak-vbeln,
ernam LIKE vbak-ernam,
END OF itab.
DATA itab2 LIKE TABLE OF KCDE_CELLS WITH HEADER LINE.
CALL FUNCTION 'KCD_CSV_FILE_TO_INTERN_CONVERT'
EXPORTING
i_filename = 'D:\data\upl.txt'
i_separator = ','
tables
e_intern = itab2
EXCEPTIONS
UPLOAD_CSV = 1
UPLOAD_FILETYPE = 2
OTHERS = 3
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
LOOP AT itab2.
SPLIT itab2-value AT ',' INTO itab-vbeln itab-ernam.
APPEND itab.
CLEAR itab.
ENDLOOP. -
How to covert a CSV file into a file of spreadsheet format(staroffice)?
Hello everybody,
I want to create a java that can convert CSV file into spreadsheet. But i dont have any idea how to create a Spreadsheet (i just know it have a Binary File format).
So anyone can give me some reference or program sample, some advises ????
Pls help
thxHi
set the content type as given below and PrintWriter class to write into excel sheet
response.setContentType("application/x-msexcel");
response.setHeader("Content-Disposition", "attachment; filename=" + "abc Download" + ".xls"); -
What is a good, safe and free converter for converting csv flies into ofx or qfx flles
I am considering to buy HomeBudget. However my bank only supplies CSV files. I need a good free and safe converter to convert csv files to ofx or qfx file format. Any advice? Thanks.
bint
The first place I would try asking is the HomeBudget Developer - http://www.anishu.com/contact.html
This from the App Store looks like it will open and edit any file type > https://itunes.apple.com/us/app/csv-converter/id550840765?mt=12
The top Google result sounds a little dubious = ONLINE conversion of MY bank data is NOT something I would do!!
I will ask our Hosts to move your Question to the Yosemite forum where it may get more exposure that in Using ASC
good luck
ÇÇÇ -
Problem in converting table data into CSV file
Hi All,
In my Process i need to convert my error table data into csv file,my data is converted as csv file by using OdisqlUnload function,but the column headers are not converted,i use another procedure for converting column headers but iam getting below error ...
com.sunopsis.sql.SnpsMissingParametersException: Missing parameter string.find, string.find
SQL: import string import java.sql as sql import java.lang as lang import re sourceConnection = odiRef.getJDBCConnection("SRC") output_write=open('C:/Oracle/Middleware/Oracle_ODI2/oracledi/pro/PRO.txt','r+') myStmt = sourceConnection.createStatement() my_query = "select * FROM E$_LOCAL_F0911Z1" my_query=my_query.upper() if string.find(my_query, '*') > 0: myRs = myStmt.executeQuery(my_query) md=myRs.getMetaData() collect=[] i=1 while (i <= md.getColumnCount()): collect.append(md.getColumnName(i)) i += 1 header=','.join(map(string.strip, collect)) elif string.find(my_query,'||') > 0: header = my_query[7:string.find(my_query, 'FROM')].replace("||','||",',') else: header = my_query[7:string.find(my_query, 'FROM')] print header old=output_write.read() output_write.seek(0) output_write.write (header+'\n'+old) sourceConnection.close() output_write.close()
And i used below code for converting.......
import string
import java.sql as sql
import java.lang as lang
import re
sourceConnection = odiRef.getJDBCConnection("SRC")
output_write=open('C:/Oracle/Middleware/Oracle_ODI2/oracledi/pro/PRO.txt','r+')
myStmt = sourceConnection.createStatement()
my_query = "select FROM E$_COMPANY"*
*my_query=my_query.upper()*
*if string.find(my_query, '*') > 0:*
*myRs = myStmt.executeQuery(my_query)*
*md=myRs.getMetaData()*
*collect=[]*
*i=1*
*while (i <= md.getColumnCount()):*
*collect.append(md.getColumnName(i))*
*i += 1*
*header=','.join(map(string.strip, collect))*
*elif string.find(my_query,'||') > 0:*
*header = my_query[7:string.find(my_query, 'FROM')].replace("||','||",',')*
*else:*
*header = my_query[7:string.find(my_query, 'FROM')]*
*print header*
*old=output_write.read()*
*output_write.seek(0)*
*output_write.write (header+'\n'+old)*
*sourceConnection.close()*
*output_write.close()*
Any one can you help regarding this
Edited by: 30021986 on Oct 1, 2012 6:04 PMThis may not be an option for you but in pinch you may want to consider outputing your data to an MS Spreadsheet, then saving it as a CSV. It's somewhat of a cumbersome process, but it will get you by for now.
You will need to change your content type to application/vnd.ms-excel.
<% response.setContentType("application/vnd.ms-excel"); %> -
How do i convert a pdf into an xls or csv file
how do i convert a pdf into an xls or csv file ? thnx
HI newapiary
You can either use Adobe Acrobat or Adobe ExportPDF Online Service.
Please Refer : https://www.acrobat.com/exportpdf/en_GB/convert-pdf-to-word.html -
How to convert a CSV file to HTML?
Hi I'm wondering how we can convert a CSV file to a HTML file?
Moreover what is the best way to count the number of lines in a given file?
Is using readlines() the best way?
Thanks,
KishoreKishorei20 wrote:
Hi I'm wondering how we can convert a CSV file to a HTML file? easy way: put <html> in the front and </html> at the end and yu've got an html file
but I think what ur looking for is how to build table
start with <table><tr><td>
every comma becomes </td><td>
every newline become </td></tr></tr><td>
Moreover what is the best way to count the number of lines in a given file?
Is using readlines() the best way?
Thanks,
Kishore -
How to convert a csv file into excel report?
Hello,
I have a csv file, can any body help me how to convert it into an excel report.
thanks in advance
vakvarmaSearch this board for "read CVS" and "write Excel". both are very common questions, you should be able to find answers very quickly.
Hints: String.split(), Apache POI -
Converting html file to csv file or excel file
Any body help me to convert html file into csv file or excel file using java.
I have no idea how to proceed.
is there any third party API's available.
Please guide me.
Thanks in advance
Vivekdev_vivek wrote:
I have no idea how to proceed.That could be due to the fact that there is no generic way to transform a html file into a csv or excel file.
Could it be that you're really interested in extracting specific values from the html file and then you want to export these values to csv and/or excel? -
Converting flat files to csv format
hi,
Iam converting flat files to csv format..the problem is that iam running a script for inserting values.while i run this script it works fine .but while i open this csv file the datas in the excel sheet is not coming in a single line that is for a particular record its moving to second line .there is a break for a single record.so there is a problem in conversion.can anything be done in it this to avoid the breaking of lines
thanks
RatheeshYOGenereally, you shouldn't convert from a lossy format AAC or MP3) to another lossy fomrat.
It's called loss because you lose information when you convert it.
If you only use these files on the computer and the iPod, I'd recommend AAC. Better quality at same bit rate as MP3. -
Converting csv from a txt file
Hi,
There is a txt file, I have updated which I need to convert to a csv file. The txt file looks something like this.
Count,Test Number
46,003201 3
14,008131 2
8,003150 1
I am running this piece of script
Import-Csv C:\VPS\newfile.txt |
Where-Object {$_.Count -notmatch '----'} |
export-csv C:\VPS\newfile3.csv -notype
However the output does not seem to work. This is what I get.There are spaces as you see below.
"Count","Test
Number "
"46","003201 3
"14","008131 2
"8","003150
1 "
I am trying to create a csv file with the correct format. This is what I am expecting.
"Count","Test ", "Number"
"46","003201" ,"3"
"14","008131","2"
"8","003150","1"
Please assist.Sorry, forgot for doesn't generate output. We need to put it in a scriptblock and then output it:
$inputData = get-content "inputdata.txt"
for ( $row = 2; $row -lt $inputData.Count; $row++ ) {
if ( $inputData[$row] ) {
$inputData[$row] | select-string '^(\d+),(\d+)\s+(\d+)' | foreach-object {
new-object PSObject -property @{
"Count" = $_.Matches[0].Groups[1].Value
"Test" = $_.Matches[0].Groups[2].Value
"Number" = $_.Matches[0].Groups[3].Value
} | select-object Count,Test,Number
} | export-csv "outputdata.csv" -notypeinformation
This version also skips blank lines in the input, provided the blank lines are past the third line.
-- Bill Stewart [Bill_Stewart]
Maybe you are looking for
-
Finding last page in SAP Script when there are multiple layouts involved?
Hi, I want to find out the last page in the SAP script. I have used &NEXTPAGE& = '0', this is finding the last page of a one layout however I do have three layouts in my script. I have also used the &SAPSCRIPT-JOBPAGES(3ZC)& and I have taken one coun
-
How can I keep the dock in view at all times?
The dock hides and then re-appears every few minutes. I can chase it and bring it up, but i want it in sight at all times.
-
Purpose of instructor led training requirement for OCP?
What is the purpose of requiring OCP candidates to take an instructor led course? It all seems a bit random / superfluous. Costly too if one does not have an employer willing to pay for the training. My Oracle Press "OCA/OCP Oracle Database 11g All-i
-
I know there are several threads similar to this one, but I wanted to start my own and include the exact messages that keeps popping up. Today when I tried to sync (by USB) my iPhone 4, I got the following sequence of messages: 1) "This computer is n
-
HI Can someone give the difference between RAID 10 and ASM From my understanding both is doing stripping of data. If we are implementing RAID 10 ,then do we need to implement ASM (if yes what is the advantage) Thanks