Zeroes in text file
Hi guys my problem is,
I have a struct which has the foll component of type c(7).
z_rate(7) type c.
I need to download this to a text file in a way that it shows just two decimal places but doesn not condense the rest of the space.
eg
11.00 nextvalNEXTVAL.....and so forth
at the moment the txt file appears like this
11.0000nextvalNEXTVAL.....and so forth
I am passing value to z_rate like this
data:source(4) type p dec 4.
buffer(4) type p dec 2.
buffer = source.
z_rate = buffer.
append struct.
Please advise.
Points assured
It looks ok.. May be you are not clearing the existing contents of the Z_RATE.
data:source(4) type p dec 4.
buffer(4) type p dec 2.
clear z_rate.
buffer = source.
z_rate = buffer.
append struct.
Regards,
Naimesh Patel
Similar Messages
-
How to build an array based on inputs from a text file
Hi
I have ta text file that has the following format. The apmlitude is the first value then I have the start index number and last index number
Other index values in between should be zero
(amplitide, start index number, end index number)
2, 2 ,3
4, 6, 7
5, 10,11
using this format I should make the foloowing array
0,0,2,2,0,0,4,4,0,0,5,5
Could you please help me to implement it in LabVIEW
ThanksA few notes:
- You'll want to use the Initialize Array function for 1) and 3) (if this is, in fact, how you want to do this.) This function takes two inputs when initializing a 1D array- element value and array size.
- Change the polymorphic instance of Read From Spreadsheet File.vi to "Double" or "Integer"- there's no reason to read in these numeric values as strings and convert them later.
- Will the text file always contain 12 elements worth of data? If not, you'll need to change your logic for the number of elements to initialize.
As Altenbach said, this seems a lot like a basic logic/homework problem. My suggestion was only that-a suggestion. It is not the only way to do this. Figure out a sequence of steps to get you from point A to point B before you jump in and start coding.
Regards,
Tom L. -
Read from Text File - Help Bug?
Hi - I am currently working on LV8 and I think that there is some misunderstanding potential in the help file. To be more exact in the help to the "Read From Text File" VI.
The description for "count":
" ... If count is <0, the function reads the entire file. The
default is –1, which indicates to read a single line if you placed a checkmark
next to the Read Lines shortcut menu item and to read the
entire file if you removed the checkmark next to the item. "
If count is lower than zero, the function reads the entire file. That sounds clear to me.
The default is -1, which indicates to read a single line if you placed a checkmark next to the "Read Lines" shortcut menu item. Now what? Does it read a single line or the whole file?
.. and to read the entire file if you removed the checkmark next to the item. I thought it reads the whole file if I use -1 ?
the VI itself behaves as I'd expect it to:
* If I place a checkmark next to Read Lines and put -1, I get an array containing the lines
* If I remove the checkmark, I get only a single string item.
Now where is the error? Is the VI not working properly or only the description a little bit ... strange ??hein??
?what?
Both you guys lost me..
And I drink coffee without sugar (being sweet enough, already)
Here is what I get from Context Help on the Read From Text File:
Read from Text File
Reads a specified number of characters or lines from a byte stream file. By default, this function reads all characters from the text file. Wire an integer value to count to specify how many individual characters you want to read starting with the first character. Right-click the function and place a checkmark next to the Read Lines option in the shortcut menu to read individual lines from the text file. When you select the Read Lines option in the shortcut menu, wire an integer value to the count input to specify how many individual lines you want to read from the file starting with the first line. Enter a value of -1 in count to read all characters and lines from the text file.
Humm.
New feature (again).. If you select checkmark the Read Lines option, it will not send the text to a sting indicator, as shown in the attached image. If selected, then it's expecting to write lines to an array of strings... WHY??? I don't know.. I'll ask..
Strange... LV8 is full of mysteries...
RayR
Attachments:
bad write file.JPG 33 KB
more bad write file.JPG 12 KB -
How to save input from a text file in to array
I got this assignment, and almost have no clue, and my teacher doesn't even teaches us anything
This is what i am suppose to do
5. The program must store the following data about each student in this Talent Show:
* The student's name (store as a String)
* The student's average time score [only for the events they competed in] (store as a Double)
Note: Some of the data comes directly from the text file, and some of the data must be calculated from the data that is read from the file.
6. The program must search through all of the student's scores to find the student who has the minumum average time of all students.
7. You must calculate how many events each student played. Zero values are not counted.
8. You must then generate a report on the screen that prints out
* the total number of students in the competition,
* the winning student's ...
o name
o times
o average time (rounded to one decimal places)
Sample output
btw this is the data file
Bart Simpson
7.5
12.3
7.8
19.2
9.9
5.3
8.5
11.8
2.2
4.6
Stewie Griffin
9.5
29.7
7.8
22.5
9.9
12.6
8.5
0
8.2
0
Pinky
2.5
0
1.8
0
3.9
0
6.5
0
5.2
12.1
Rocky N Bullwinkle
10.0
22.2
9.5
17.5
9.9
1.5
8.7
23.7
9.2
11.0
Angelica Pickles
5.5
11.1
6.8
12.2
7.9
13.3
8.1
5.1
7.2
7.9
Pink Panther
8.5
5.5
8.8
6.6
8.9
7.7
9.9
8.8
2.2
9.9
Josie
9.5
0
8.8
12.2
9.9
0
8.5
0
9.2
5.3
Rogue
8.5
1.1
7.8
2.2
7.9
3.3
7.5
4.4
8.2
5.5
Usagi Tsukino
8.5
15.5
8.8
30.1
9.9
19.7
9.5
11.0
8.2
8.6
Yosemite Sam
0
15.2
0
29.5
3.9
0
0
16.0
0
7.7
My code so far
import java.io.*;
public class test
public static void main (String [] args)
FileInputStream File1;
DataInputStream In;
String fileInput = "";
try
File1 = new FileInputStream ("data.txt");
In = new DataInputStream (File1);
while (In.available () > 0)
fileInput = In.readLine ();
System.out.println (fileInput);
In.close ();
catch (FileNotFoundException e)
System.out.println ("Error - this file does not exist");
catch (IOException e)
System.out.println ("error=" + e.toString ());
}My question, how do i save the data in to an array, and how do i seperatly save names in to different array, and their scores in to different arrays
bte he said you can use scanner class
Thanks
Edited by: supahsain08 on Mar 26, 2008 2:55 PMsupahsain08 wrote:
Well, you are not in my class and you don't even know my teacher
who are you to judge meHe is jaded by our experiences here. 99% of posters who complain that the teacher doesn't teach have adequate (note that I didn't say good) teachers, but it's the student who is failing to take responsibility for his own education. It is after all your responsibility and complaining won't help you any.
Good luck. -
I have data that is in basic generic text file format that needs to be converted into Excel spreadsheet format. The data is much longer than 65536 lines, and in my code I haven't been able to figure out how to carry over the data into the next column. Currently the conversion is done manually and generates an Excel file that has a total of 30-40 full columns of data. Any suggestions would be greatly appreciated.
Thanks,
Darrick
Solved!
Go to Solution.No need to use nested For loops. No need for any loop anyway. You just have to use a reshape array function. The picture below shows how to proceed.
However, there may be an issue if your element number is not a multiple of the number of columns : zero value elements will be added at the end of the last column in the generated 2D array. Now the issue depends on the way you intend store the data in the Excel spreadsheet : you could convert the data as strings, replace the last zero values with empty strings, and write the whole 2D array to a file (with the .xls extension ) using the write to spreadsheet function. Only one (minimal) problem : define the number of decimal digits to be used;
or you could write the numeric array directly to a true Excel spreadsheet, using either the NI report generation tools or ActiveX commands, then replace the last elements with empty strings.
We need more input from you to decide how to solve these last questions.
Message Edité par chilly charly le 01-13-2009 09:29 PM
Chilly Charly (aka CC)
E-List Master - Kudos glutton - Press the yellow button on the left...
Attachments:
Example_VI.png 10 KB -
How I can save an existed Table "exactly" into an Excel or a Text file?
I am able to save from a Table into an Excel file, but I could not put in it the following:
a)Column Headers
b)First column should be integer
c)The Scientific notation (supposed to be with 6 decimal point) but it shows only two decimal point
d)In the last 3 rows, it couldn't understand --> it showed Zero's
***> It shows better when I changed the data.xls to data.txt ... only solved c)
***> You cam modify completely how to write into the Excel or Text file ... but do not change the way I write to the TABLE (I have "no choice" to keep it that way!)
Attachments:
Write_Table.vi 51 KBFirst of all, the Write to Spreadsheet File function does not create an Excel file. It creates a text file with values separated by a delimiter. Excel is capable of recognizing tabs and commas as delimiters and will convert the text into a spreadsheet.
Most of your problems can be solved by converting Write to Spreadsheet to accept arrays of strings instead of arrays of numbers and adding the column headers to the array. You'll probably have to experiment with the Excel import function as well.
Thye best way, however to get exactly what you want into Excel is to use ActiveX. There is an example the4 comes with LabVIEW that shows some of the basics. You can find other examples by searching the Developers Zone. NI also sells a toolkit for reading/
writing Excel and Word files. -
Importing multiple amount columns from a single text file
I'm sure this question has been addressed many times. I have tried to search for an answer here and other areas, but I have not been able to find a clear answer yet. I am relatively new to HFM and FDM and thus do not have a lot of experience to fall back on. I am primarily a Planning/Essbase person. That being said, here is my question:
I have a data source (text file) containing two amount columns that I need to load to HFM via FDM. One amount column consists of Average Exchange Rates and the other amount column consists of Ending Exchange Rates. I have been asked to develop a process to load both columns of data to HFM using a single process (one Import Format). I've been told this is possible by writing an Import DataPump script. It seems that I would need to create a temporary record set based on the original source file and modify it so that it contained a duplicate set of records where the first set would be used for the Average Rate and the second set would be used for the Ending Rate. This would be a piece of cake using SQL against a relational source, but that's obviously not the case here. I do have some experience with writing FDM scripts but from an IF... Then... Else... standpoint based on metadata values.
If there is anyone out there that has time to help me with this, it would be most appreciated.
Thanks,This is relatively easy to achieve with a single import script associated with the Account source field (assuming AverageRate and EndRate are accounts in your application) in your import format.
Essentially your first amount say AverageRate would be set as the default field for Amount and these values would be loaded as if it were a single value file. For the second value, EndRate you would have to insert the second value directly into the FDM work table which is the temporary table populated when data is imported from a file during the import process. The example code snippet below suld gve you guidance on how this is done
'Get name of temp import work table
strWorkTableName = RES.PstrWorkTable
'Create temp table trial balance recordset
Set rsAppend = DW.DataAccess.farsTable(strWorkTableName)
If IsNumeric(EndRateFieldValue Ref Goes Here) Then
If EndRateFieldValue Ref Goes Here <> 0 Then
' Create a new record, and supply it with its field values
rsAppend.AddNew
rsAppend.Fields("DataView") = "YTD"
rsAppend.Fields("PartitionKey") = RES.PlngLocKey
rsAppend.Fields("CatKey") = RES.PlngCatKey
rsAppend.Fields("PeriodKey") = RES.PdtePerKey
rsAppend.Fields("CalcAcctType") = 9
rsAppend.Fields("Account") = "EndRate"
rsAppend.Fields("Amount") = EndRateFieldValue Ref
rsAppend.Fields("Entity")=DW.Utilities.fParseString(strRecord, 16, 1, ",")
rsAppend.Fields("UD1") = DW.Utilities.fParseString(strRecord, 16, 2, ",")
rsAppend.Fields("UD2") = DW.Utilities.fParseString(strRecord, 16, 3, ",")
rsAppend.Fields("UD3") = DW.Utilities.fParseString(strRecord, 16, 16, ",")
'Append the record to the collection
rsAppend.Update
End If
End If
'Close recordset
rsAppend.close
In addition the return value of this Import Script should be "AverageRate" i.e. name of ht eaccount associated with the first value field. The NZP expression also needs to be put on the Amount field in the import format to ensure that the EndRate Field value is always processed even if the value of AverageRate is zero. -
How to Store something in a text file.
Store the record of the session in a text file.
please can any one tell me how can i create this thing.
i cerate the button but does not work correctly and i can not save any calculation/
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.lang.Math.*;
import java.math.BigInteger;
public class Calculator2 extends JFrame implements ActionListener{
JLabel lN1, lN2,lN3;//here are the Label.
JTextField tN1, tN2;// here the place for the text field.
JButton btnAdd,btnSub,btnMul,btnDiv,btnClear,btnSave; JTextArea outArea;//all our Button which are in the program.
Calculator2(){//constructor.
Box box=Box.createVerticalBox();//creation of the box.
// input
lN1=new JLabel("Write first number"); box.add(lN1);//creation of the input,the number which we want use.
tN1=new JTextField(100); tN1.setEditable(true); box.add(tN1);//allows or prevents the user editing the text
lN2=new JLabel("write second number"); box.add(lN2);
tN2=new JTextField(100); tN2.setEditable(true); box.add(tN2);
// buttons
btnAdd=new JButton("+"); btnAdd.addActionListener(this); box.add(btnAdd);// button of addition operation
// setPreferredSize();
btnSub=new JButton("-"); btnSub.addActionListener(this); box.add(btnSub);// button of subtraction operation
btnMul=new JButton("*"); btnMul.addActionListener(this); box.add(btnMul);// button of multiplication operation
btnDiv=new JButton("/"); btnDiv.addActionListener(this); box.add(btnDiv);// button of division operation
btnClear=new JButton("Clear"); btnClear.addActionListener(this); box.add(btnClear);// button of Clear operation
btnSave=new JButton("Save"); btnSave.addActionListener(this); box.add(btnSave);// button of save operation
// Output
String desc="This is a simple integer calculator\n";//here the out put with text area.
outArea=new JTextArea(desc,30,60);//out put area with the hight and length.
ScrollPane scrollPane=new ScrollPane();//Creates an empty (no viewport view) JScrollPane where both horizontal and vertical scrollbars appear when needed
scrollPane.add(outArea);
box.add(scrollPane);
Container c=getContentPane();
c.add(box);
c.setBackground(Color.green);//back ground color.
setTitle("Calculator");//title
setSize(600,375);//size
setVisible(true);// visiblity of the program.
private void showStatus(String status) {
lN3.setText(status);
public void actionPerformed(ActionEvent actionEvent){
if(actionEvent.getSource()==btnClear){
outArea.selectAll(); outArea.cut();
} else {
String sN1=tN1.getText(), sN2=tN2.getText(), sOp="";
BigInteger bN1=new BigInteger(sN1);
BigInteger bN2=new BigInteger(sN2);
BigInteger bRes=BigInteger.ZERO, bResDiv[]={BigInteger.ZERO,BigInteger.ZERO};
BigInteger bRemainder=BigInteger.ZERO;
if(actionEvent.getSource()==btnAdd){bRes=bN1.add(bN2); sOp=" + ";}
if(actionEvent.getSource()==btnSub){bRes=bN1.subtract(bN2); sOp=" - ";}
if(actionEvent.getSource()==btnMul){bRes=bN1.multiply(bN2); sOp=" * ";}
if(actionEvent.getSource()==btnDiv){sOp=" / ";
if(bN2.signum()!=0)bResDiv=bN1.divideAndRemainder(bN2);//Math.signum() tells you what sign a number is....
//returns zero if the argument is zero, 1.0 if the argument is greater than zero,
//-1.0 if the argument is less than zero
bRes=bResDiv[0]; bRemainder=bResDiv[1];
if(sOp.equals(" / ") && bN2.signum()==0){
// showStatus("Cannot divide by zero");
} else {
outArea.append(bN1.toString() + sOp+bN2.toString() + " = " + bRes.toString() + "\n");
if(actionEvent.getSource()==btnDiv)outArea.append("Remainder = "+bRemainder.toString()+"\n");
public static void main(String[] args) {//the main method of the program.
new Calculator2().setVisible(true);
}// This is a simple calculator that calculate 4 mathematical operations, addition,
// subtraction, multiplication and division.
// Author: Jean Chedid.
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.lang.Math.*;
import java.math.BigInteger;
public class Calculator2 extends JFrame implements ActionListener{
JLabel lN1, lN2,lN3;//here are the Label.
JTextField tN1, tN2;// here the place for the text field.
JButton btnAdd,btnSub,btnMul,btnDiv,btnClear,btnSave; JTextArea outArea;//all our Button which are in the program.
Calculator2(){//constructor.
Box box=Box.createVerticalBox();//creation of the box.
// input
lN1=new JLabel("Write first number"); box.add(lN1);//creation of the input,the number which we want use.
tN1=new JTextField(100); tN1.setEditable(true); box.add(tN1);//allows or prevents the user editing the text
lN2=new JLabel("write second number"); box.add(lN2);
tN2=new JTextField(100); tN2.setEditable(true); box.add(tN2);
// buttons
btnAdd=new JButton("+"); btnAdd.addActionListener(this); box.add(btnAdd);// button of addition operation
// setPreferredSize();
btnSub=new JButton("-"); btnSub.addActionListener(this); box.add(btnSub);// button of subtraction operation
btnMul=new JButton("*"); btnMul.addActionListener(this); box.add(btnMul);// button of multiplication operation
btnDiv=new JButton("/"); btnDiv.addActionListener(this); box.add(btnDiv);// button of division operation
btnClear=new JButton("Clear"); btnClear.addActionListener(this); box.add(btnClear);// button of Clear operation
btnSave=new JButton("Save"); btnSave.addActionListener(this); box.add(btnSave);// button of save operation
// Output
String desc="This is a simple integer calculator\n";//here the out put with text area.
outArea=new JTextArea(desc,30,60);//out put area with the hight and length.
ScrollPane scrollPane=new ScrollPane();//Creates an empty (no viewport view) JScrollPane where both horizontal and vertical scrollbars appear when needed
scrollPane.add(outArea);
box.add(scrollPane);
Container c=getContentPane();
c.add(box);
c.setBackground(Color.green);//back ground color.
setTitle("Calculator");//title
setSize(600,375);//size
setVisible(true);// visiblity of the program.
private void showStatus(String status) {
lN3.setText(status);
public void actionPerformed(ActionEvent actionEvent){
if(actionEvent.getSource()==btnClear){
outArea.selectAll(); outArea.cut();
} else {
String sN1=tN1.getText(), sN2=tN2.getText(), sOp="";
BigInteger bN1=new BigInteger(sN1);
BigInteger bN2=new BigInteger(sN2);
BigInteger bRes=BigInteger.ZERO, bResDiv[]={BigInteger.ZERO,BigInteger.ZERO};
BigInteger bRemainder=BigInteger.ZERO;
if(actionEvent.getSource()==btnAdd){bRes=bN1.add(bN2); sOp=" + ";}
if(actionEvent.getSource()==btnSub){bRes=bN1.subtract(bN2); sOp=" - ";}
if(actionEvent.getSource()==btnMul){bRes=bN1.multiply(bN2); sOp=" * ";}
if(actionEvent.getSource()==btnDiv){sOp=" / ";
if(bN2.signum()!=0)bResDiv=bN1.divideAndRemainder(bN2);//Math.signum() tells you what sign a number is....
//returns zero if the argument is zero, 1.0 if the argument is greater than zero,
//-1.0 if the argument is less than zero
bRes=bResDiv[0]; bRemainder=bResDiv[1];
if(sOp.equals(" / ") && bN2.signum()==0){
// showStatus("Cannot divide by zero");
} else {
outArea.append(bN1.toString() + sOp+bN2.toString() + " = " + bRes.toString() + "\n");
if(actionEvent.getSource()==btnDiv)outArea.append("Remainder = "+bRemainder.toString()+"\n");
public static void main(String[] args) {//the main method of the program.
new Calculator2().setVisible(true);
} -
Problem with saving data in text file in Application server
Hello Experts,
I am trying to save a text file in application server.When I text file have less that 60000 (i.e 59999) records, it saves the file successfully, but if records in text file (saved in application server) is more than 60000 (i.e 60002), it creates a new file at the 60000th record with the continued records.
Can anyone please advise, why it is creating a new file if records are more that 60000. I tested it with 59000 records in my internal table and it is working fine. I have not given any restriction in my program to create a new file if records are more than 60000.
The logic I implemented is the following:
*Open file
open dataset g_accnt_file for output in text mode encoding utf-8.
if sy-subrc = 0.
clear g_header_record.
*Building header record for Accounting Validation file
concatenate gc_hdr_desc
gc_filetype
gc_sequence
gc_idntf_refresh
gc_cmpny_idntf
gc_accnt_id
sy-datum
sy-uzeit
gc_linde_group
sy-sysid
gc_not_used into g_header_record separated by
gc_deliminator.
transfer g_header_record to g_accnt_file.
*Move Cost center data to file to create a detail record for Accounting
*Validation file
loop at gt_csks into gs_csks.
*Remove leading Zeros
call function 'CONVERSION_EXIT_ALPHA_OUTPUT'
exporting
input = gs_csks-kostl
importing
output = gs_csks-kostl.
* Overlay gs_csks-kostl with space.
* SHIFT gs_csks-kostl RIGHT DELETING TRAILING gc_space.
*Prepare Cost Centre String
perform prepare_costcentre_string.
*Prepare detail record with Company Code & Cost Centre
perform prepare_detail_record.
clear:g_detail_record,gs_csks,g_coa.
endloop.
*Move Order data to file to create a detail record for Accounting
*Validation file
loop at gt_aufk into gs_aufk.
*Remove leading Zeros
call function 'CONVERSION_EXIT_ALPHA_OUTPUT'
exporting
input = gs_aufk-aufnr
importing
output = gs_aufk-aufnr.
* SHIFT gs_aufk-aufnr RIGHT DELETING TRAILING gc_space.
*Prepare Order String
perform prepare_order_string.
*Prepare detail record with Company Code & Order
perform prepare_detail_record.
clear:g_detail_record,gs_aufk,g_coa.
endloop.
*Move WBS data to file to create a detail record for Accounting
*Validation file
loop at gt_prps into gs_prps.
call function 'CONVERSION_EXIT_ABPSP_OUTPUT'
exporting
input = gs_prps-pspnr
importing
output = g_wbs_element.
* SHIFT g_wbs_element RIGHT DELETING TRAILING gc_space.
*Prepare WBS Element String
perform prepare_wbs_string.
*Prepare detail record with Company Code & WBS Element
perform prepare_detail_record.
clear:g_detail_record,gs_prps,g_coa.
endloop.
*Building trailer record for Accounting Validation file which will
*contain the total number of detail records in file
concatenate gc_trail_desc
g_total_count
into g_trailer_record
separated by gc_deliminator.
transfer g_trailer_record to g_accnt_file.
*Close file
close dataset g_accnt_file.
if sy-subrc = 0.
message s036(/lig/fi).
endif.
endif.
endform. " SELECT_DATA
Edited by: Matt on Sep 30, 2010 11:02 AM - added tagsHi Pankaj,
Can u check the concatenate statement with one more data. Check the no of lines for a single file.
concatenate gc_hdr_desc
gc_filetype
gc_sequence
gc_idntf_refresh
gc_cmpny_idntf
gc_accnt_id
sy-datum
sy-uzeit
gc_linde_group
sy-sysid
sy-subrc
gc_not_used into g_header_record separated by
gc_deliminator.
Regards,
Amitava -
Take an existing text file and modify values
I’m looking to take an existing text file and modify certain values inside of it. Then save it to a new file, with all the same formatting as the original. The file format is not uniform and can change.
Basically the file is:
Random numbers and letters of unknown length for an unknown number of lines.
Label="Test_#"
Description
String
X=123
Y=456
Z=-789
20 lines of strings with numbers in them
Label="Test_#2"
Description
String
X=-1232
Y=4562
Z=7892
Then it repeats a set number of times.
I want to modify the X Y and Z = values for each Test_#.
I’ve managed to import the important values into a numeric array and I have a different array with values that will replace the existing ones. I’m having troubles replacing the existing ones. There are no zeros before or after the existing numbers so they are all different lengths.
If anyone has any sample code that does anything similar please post it. I’m sure someone has done something like this in the past.
Solved!
Go to Solution.I just thought I would throw this out there. Can you make the .txt file tokenized? This would make searching for specific parameters much easier.
Reese, (former CLAD, future CLD)
Some people call me the Space Cowboy!
Some call me the gangster of love.
Some people call me MoReese!
...I'm right here baby, right here, right here, right here at home -
Add date to new text file name and generic text in body
Okay, I hope this is the right forum. To help manage and keep track of incoming assets/files and I created an Automator workflow with the following: "Get Selected Finder Items → Get Folder Contents → New Text File (w/Show this action when the workflow runs so I can give a unique name).
This creates a text file with the folder contents listed in the body.
I would like to know if I can do two things:
1. Automatically add a date/time stamp to the Save as field so it will automatically have a unique file name?
2. I also want to add text before the listed contents within the text file. (e.g.: Let's say the folder contents are Volumes/Mac HD/Generic_movie.mov. I want the final text to read:
"The following file has been moved to the local volume at: Volumes/Mac HD/Generic_movie.mov"
Is there a way to accomplish either one or both of these with Automator or AppleScripts?
Thanks.I would like to know if I can do two things...
This might address your first concern:
*1) Get Selected Finder Items*
*2) Get Folder Contents*
*3) New Text File* -- select a destination folder and check *Show Action When Run*
*4) Rename Finder Items:*
Choose *Add Date or Time* from the popup
Date/Time: select Created, Modified, or Current - Format: *Month Day Year*
Where: *After name* - Separator: *Forward Slash*
Separator: Space - check *Use Leading Zeros* (optional)
*5) Rename Finder Items:*
Choose *Add Text* from the popup
Add: *" at"* -- put a leading space before "at" (without the quotes), and select *after name*.
*6) Rename Finder Items:*
Choose *Add Date or Time*
Date/Time: Current - Format: *Hour Minute Second*
Where: *After name* - Separator: Dash
Separator: Space - check *Use Leading Zeros* (strongly recommended)
+--- End of Workflow ---+
Save the workflow as an application and use it as a droplet. Drop a desired folder onto the saved applet and enter a name when the dialog appears. The new text file, which will be found in the destination folder, should be appended with a date and time stamp, e.g., *"My Folder List 7/8/2010 at 23-54-09"*
Tested using Mac OS 10.4.11 and Automator v. 1.0.5
Good luck; hope this helps. -
Problem in creating text file from report file
Hello Everybody...
I have problem in creating text file.
I had set System Parameter as below
DESTYPE : File
MODE : Character
DESNAME : gayu.txt
And ruler setting
Units : Character Cells
Character Cell Size : Horiziontal = 7
Vertiacle =12
GridSpacing : 1
no of snap points per grid spacing : 1
but when i run report it will give error
"REP_1219 M_2 or R_2 has no size -- length or width zero"
so is there any solution of that
or another way to convert report into text file?....Hi Folks,
Please don't go after that Error as its a very deceptive one. Please don't go for altering your design Or changing the size of items in your layout.
Similar errors I have come across in reports. I think its due to file transfer type. You might have transferred the file in Binary and your File Mode I am seeing it as CHAR.
This normally happens while making the Report Format as "Text". Either you change that format which I think is possible in your case as your basic requirement is making a report output of CHAR type.
Please check for this error in Metalink and proceed accordingly. I could fix similar errors when I changed Format type to PDF(from text).
Regards
Shibu -
Importing a text file with variable values into web reporting
Hello,
I'm looking for a possibility to import values from a text file into a variable selection in Web reporting.
With BEx reporting in Excel this is possible, by clicking on the multiple selection button in the variable popup screen, and subsequently selecting the "Import from Text file" button.
However, this function seems not to be available for web-reporting...
It would be great if someone could help me out with this!
Thanks & regards,
ArvidHi,
we could resolve this issue, so i thought it may also be helpful for others:
In our example we used a file with numbers for materials. This file is stored somewhere in a directory, to which SAP BI must have authorization to read.
The file looks something like this:
4711
4712
4713
4714
The file is named "import.txt" and lays in directory "/usr/sap/EC6/files/bi/"
*& Include ZXRSRU01
* global variables
Data: intern_range LIKE LINE OF i_t_var_range,
l_s_range TYPE rsr_s_rangesid,
line(100) TYPE c,
p_file(128) TYPE c,
length_rangelow type i,
tmp_rangelow like l_s_range-low.
* internal tables for selection-transfer from transaction
* Data: BEGIN OF it_file occurs 0,
* it_p_file(128) TYPE c,
* END of it_file.
IF i_step = 1.
** variables can be changed or set before pop-up appears
CASE i_vnam.
* take material from external file to selection-list
WHEN 'ZSD_UPMA'.
** call of transaction, with which the path can be set
*CALL TRANSACTION 'ZBW_VARIABLE' using it_file
*MODE 'A' " call should be visible, so that variable can be set
*UPDATE 'S'. " first transaction, then processing
** Der Pfad, der in dem Selektionsbild eingegeben wird, wird an die Variable übergeben
** Der Set-Parameter ist in Report ZSD_SELECT_VARIABLE
* get parameter id 'VAR' field p_file.
p_file = '/usr/sap/EC6/files/bi/import.txt'.
* further handling of variable in BI
OPEN DATASET p_file FOR INPUT IN TEXT MODE ENCODING DEFAULT.
IF sy-subrc = 0.
READ DATASET p_file INTO line.
WHILE sy-subrc = 0.
IF line(2) <> '//'.
l_s_range-sign = 'I'.
l_s_range-opt = 'EQ'.
l_s_range-low = line.
* fill with leading Zeros
* in variable tmp_rangelow the value from l_s_range-low is taken
tmp_rangelow = l_s_range-low.
* read the length
length_rangelow = strlen( tmp_rangelow ).
* in our case: material has 18 characters
while length_rangelow lt 18.
CONCATENATE '0' tmp_rangelow INTO tmp_rangelow.
length_rangelow = length_rangelow + 1.
endwhile.
* initialize l_s_range-low
clear l_s_range-low.
* set with filled values
l_s_range-low = tmp_rangelow.
* transfer to structure
APPEND l_s_range TO e_t_range.
ENDIF.
READ DATASET p_file INTO line.
ENDWHILE.
ENDIF.
CLOSE DATASET p_file.
ENDCASE.
ELSEIF i_step = 2.
** in step 2 all variable values from pop-up input can be processed or
** User Exit variables can be derived
* UserExit Ende.
ENDIF.
Hope i could help!
Best regards,
Tobias -
Tfman - text file manager, much different then others
Tfman - text file manager.
Performs operations on files through textual representation of file system.
Textual representation is in the form of plain text, editable with any text
editor and may contain multiple operations of every kind. Tfman can be
used from command-line or from within Vim as multi-window file manager.
It can be combined with tools like Sed or Awk.
. written in C fo Unix-like operating systems
. no dependencies (except gcc/clang and GNU Make for building)
Features in short:
- scan filesystem to create its textual representation
- parse textual representation and perform retrieved operations
- use favorite text editing tool to edit textual representation
- scan, edit and parse in one step
- use Tfman from command-line or from within Vim as multi-window file manager
- integration with other decent text editors should be easy
- available: brace expansion, globbing, entries grouping, whole directory operations and more
Project's homepage:
https://chiselapp.com/user/machel/repository/tfman/home
Installation procedure (AUR or sources tarball) - see Project's homepage
Documentation, sources, report issue - see Project's homepage
Warning:
Tfman is in an early state, it didn't receive sufficient testing yet. Please
be carefull when manipulating sensitive data with it.
Note:
I do not know any file manager that manipulates file system in similar way.
Therefore usefulness of this kind of approach is not proven.
Help me prove it.
Screenshots:
Screenshot1
New version pushed to AUR:
- changing entry ownership and permissions now associated under one action tag
- few other action tags changed
- Quick Start Guide now available, see Project's homepage
- bug fixes
Last edited by machel (2014-07-15 11:48:48)machel wrote:I know it looks complex, but I believe it is not as complex as it seems to be although
not as simple as I want it to be. Any ideas how to make it simpler are highly appreciated.
Well, for start: Is there really a reason to use different character for directory and its subdirectories? As far as I can tell, you could just use '%' for all directories and decide what is top-level directory and what is subdirectory based on the indentation. Also, it would be nice to reserve '#' for comments, as it is common in many languages.
machel wrote:2) Use action tags to specify operations. They apply to single entries, groups of entries or whole directories
Here the complexity begins. There is 13 operations, if I counted it correctly in the man page. To be fair, some of them are just adding '*' enforce overwrites. Fine, that leaves us with about 9 operations to learn. I could probably do that But it would be better if it was less... Would it be possible to simplify operations that don't affect file location by allowing user to simply change the value in the text representation? It would probably require some kind of header (or some clever trickery), because the order of columns is not fixed, but it might be worth the trouble. You could also extend this to changing file times and perhaps other properties (those from '-F proper'). The linking and moving operators look good, with little exception of '))' - that just looks odd to me But that is definitely my personal taste... I'd prefer something like single '>'.
machel wrote:3) Entry names and action operands - I believe using them is quite intuitive:
Name relative to directory/subdirectory above:
'name'
If you want absolute name:
'/name'
If you want name relative to current working directory (where Tfman was invoked):
'./name'
No problem with this, I like that.
machel wrote:
dolik.rce wrote:ability to execute commands on the files/directories
What do you mean? Shell commands?
Shell commands would be best, but generally just ability to execute command with given file/directory as input or parameter. Example usage would be something like this:
# Dir
file1 ^ sed -i -e 'some sed script here' becomes: sed -i -e 'some sed script here' < file1
file2 ^% touch % becomes: touch file2
The syntax is just an example, but in this case ^ would feed the file into the standard input of the command, and '^%' would replace '%' in commandline with the actual file name. For globing, command gets executed for each matching file.
machel wrote:
dolik.rce wrote:execute some actions conditionally
Interesting idea. I must think about it.
Tfman already have tags to stop parsing file, stop parsing line and goto next,
disable whole dir/group or single entry, exclude entry from under directory/group,
perform action on previous action's target, ignore errors.
But it works unconditionally.
I can imagine wanting to do something based on the properties of file or even based on output of external command. E.g. 'move file only if it's older then N days', or 'ask remote server if it has file X, move the file to directory upload/ when the command returns non-zero exit status'
machel wrote:--- Tfm ---
Remember about 'tfm' utility which is simple Tfman wrapper scanning given directory,
opening it in editor defined in EDITOR shell variable (Vim is default) and parsing
result after you save and quit.
It just compress 3 steps into 1.
This is definitely handy, and probably only reasonable way to use tfman interactively. However, I'm not a vim-person - as I already said I'm lazy to remember anything, so you can imagine that learning enough vim commands to use it effectively would be a nightmare for me The same goes for tfmvi, I'm just not the target audience for that. But my EDITOR variable is usually set to nano, so I could easily use it with that, probably just with slightly more typing. -
How do i clear a text file.....
Hi All...
I wud like to know how to clear a text file....
Currently am replacing the text file and writing...Actually i need to open the file(after clearing the contents)and write.
I think replacing the file each time is not a good idea...
So please let me know how to clear the text file.
Thanks in advance.
Solved!
Go to Solution.You can set the file size to zero using "Set File Size" from the advanced file io palette.
LabVIEW Champion . Do more with less code and in less time .
Maybe you are looking for
-
[SOLVED] Write access and owner of /srv/http
I installed the Apache HTTP server as stated on the LAMP page of the Arch Wiki. The Wiki says that the installation creates a http user and group automatically. When I ls -l in /srv, it shows that the permissions of the http folder are drwxrwxr-x roo
-
Ethernet Broke/Wireless Works
Connecting Apple TV to my computer via ethernet cable now doesn't work. I had it working originally, but I started playing with using an external storage drive and somewhere along the line ethernet broke. Wireless works just fine. Possible causes: 1.
-
Offline backup procedure for clustered ECC 6.0
Dear Experts. I Installed SAP ECC 6.0 Sr3 on MSCS with DB2 database. I want to take the offline database backup. In node 1 is having (ASCS and SCS and Central instance and Enque replication ) node 2 having dialog instance and ERS. Cluster administrat
-
Multiple movie clips within a button
I'm having trouble with working a movie clip played one after another within a button. Can anybody help? or is there a simpler way of getting multiple movie clips to play? for my project, when you hover over the button and vines grow out. currently,
-
Multiple genre assignment feature for songs.
Hi everyone, The question is simple and it's actually a strong recomandation for Apple Teams. In order to optimize the organization of songs, we have to be able to assign multiple genre, artists... Currently, assigning a song being "OST, Rock, Indepe