| T O P I C R E V I E W |
| blt2si |
Posted - 01/24/2003 : 08:28:24 AM Hi all, following file is my example text file(all my files are in this format only).i imported this file successfully in to a window.but there is a major problem occuring.i.e: it is considering from first line to last line(date/time...and values rows)except the followinmg last values row as the text header and it places the whole thing in the column label area including the values between those repeated strings.only the last row(which is having values in this case) is considered as data values.i want to delete all the repeated string headers...(ie:the date/time..row must be appeared only once in the column label area) and the values must appearing in the respected columns..is it possible to do while importing ? if the file must be changed before the importing ,please suggest me how to do it?
date/time name1 name2 name3 name4 name5 name6............. 23.01.03/08:30 245.3 23.32 3211 222.7 221.3 12.03 ..... date/time name1 name2 name3 name4 name5 name6............. 22.01.03/10:32 222.3 27.41 3452 256.3 287.3 13.04..... date/time name1 name2 name3 name4 name5 name6............. 22.01.02/9:32 202.3 67.40 5652 756.4 207.3 37.09.......
final format should be in the following format:
date/time name1 name2 name3 name4 name5 name6............. 23.01.03/08:30 245.3 23.32 3211 222.7 221.3 12.03 ..... 22.01.03/10:32 222.3 27.41 3452 256.3 287.3 13.04..... 22.01.02/09:32 202.3 67.40 5652 756.4 207.3 37.09.....
Thank you, blank
|
| 6 L A T E S T R E P L I E S (Newest First) |
| Mike Buess |
Posted - 01/29/2003 : 11:16:45 AM Hi Blank,
InputBox() is the only input box available in Origin C so you're stuck with entering one string at a time if you only use Origin C. In OriginPro you can create a single Dialog Builder dialog for all of your strings. (?)
Getnumber is a LabTalk command and you can test my example code by pasting it in the script window, highlighting all of it (except the final etc. comment at the end) and pressing enter. Call it from Origin C with the LT_execute command. It would probably be best to put the command in a LabTalk section at the end of your C file like this...
#ifdef LABTALK
[StrDialog1] getn (Project) %%A (Department) %%B (Machine) %%D (Date and time) %%E (Speed) %%F (Location) %%G (Information...);
#endif
and use it from Origin C like this... 1> Initiate the string variables with LT_set_str(). 2> Run the dialog with LT_execute("run.section(ThisFile.c,StrDialog1)") ThisFile.c is the name of your Origin C file (you may have to include the path with respect to the Origin program folder). 3> Fetch the results with LT_get_str().
Since you have more than 6 strings you will probably need more LabTalk sections: [StrDialog2], [StrDialog3], .... Repeat steps 1> through 3> for each.
I hope that helps.
Mike Buess Origin WebRing Member |
| easwar |
Posted - 01/29/2003 : 10:55:50 AM Hi Blank,
The getn dialog, as Mike pointed out, has a limit of 6 strings. If you want to handle more, and/or want more sophisticated dialogs in general, you should take a look at Dialog Builder, which is a feature in OriginPro: http://www.originlab.com/www/products/originpro/dialog_builder1.asp
Easwar OriginLab
|
| blt2si |
Posted - 01/29/2003 : 10:32:50 AM Hi Mike Buess, Thank You. i couldn't understand the code which was sent by you and u told that code is suitable for 6 strings but unfortunately i have more here.i sent that 6 strings as examples.So i used the InputBox() command with some addtional code and it is working.This is asking everytime for a single string but not all.Is there any other method to open the dialogue box and to enter all the details at a time? Thank you, Blank
|
| Mike Buess |
Posted - 01/28/2003 : 11:17:19 AM Hi Blank,
You're lucky because you have six strings, which is the most you can use with the getnumber command. You should give the strings default values first. Notice that the string variables have double percent signs (%%) within the command.
%A="Untitled"; %B="Chemistry"; %D="whatever"; %E="1/28/03 11:28"; %F="1.4GHz"; %G="wherever";
getn (Project) %%A (Department) %%B (Machine) %%D (Date and time) %%E (Speed) %%F (Location) %%G (Information...);
%A=; // Project %B=; // Department etc.
You can also use numeric variables, booleans and lists with the getnumber command, which provides considerable flexibility.
...Note: There is an Origin C dialog for entering a string but it will only handle one string at a time.
Mike Buess Origin WebRing Member
Edited by - Mike Buess on 01/28/2003 11:18:13 AM
Edited by - Mike Buess on 01/28/2003 11:43:15 AM |
| blt2si |
Posted - 01/28/2003 : 10:50:05 AM Hi Easwar, Thank you very much for your help.Finally I got the text file in required format.Now i want to open a dialogue box to enter the details of the project and these details must come in the starting rows of the work sheet. after completing the conversion from the rawfile it must ask for the details by opening a dialogue box and after entering the details and pressing the OK button by the user the details must appear at the beginning of the work sheet. the required details are like this(these including text and numbers):
Project name: department name: type of machine: date and time: speed : location:
Thank you, Blank
|
| easwar |
Posted - 01/24/2003 : 4:51:58 PM Hi Blank,
You could do the following: Create a new Wks template by doing the following: 1> Initiate the ASCII import dialog 2> Click on the Options button in the file dialog 3> Turn off the "Auto determine to skip..." radio button by clicking on the "Specify known subheader..." radio button. 4> Leave the number of lines in the edit box to be 0 5> Click the Update Options button to get back to File dialog 6> Click cancel to get out of the dialog and save wks as a template
Now if you use this template in your import script all lines of your file will come in as rows in the worksheet. You can then write additional script to delete every alternate row that has the text lines.
One alternative to all this, if you have version 7, is to write this in Origin C using the stdiofile or file class to create your own custom routine. You can just read and throw away every alternate line etc. If you have an earlier version, and if you have Pro, there is the File Utility Module in Pro that allows customization of import using LabTalk script.
If you need further help with OC coding etc. please post again.
Easwar OriginLab.
|