Subscribe Bookmark RSS Feed

Script question; importing data from .txt to jmp without overwriting existing jmp data

L_Kingma

New Contributor

Joined:

Oct 24, 2017

Hi all,

I have a question regarding creating a line of script, first i would like to know if it is possible and if so, is there someone who can help me create it? Since i am fairly new to the use of JMP and scripting, i appreciate all the help! 

 

The situation is as followed;

Three times a week i collect data in a .txt file. This data is automattically imported to JMP by the use of a script.

If i want to update the JMP file with data of a new week i manually have to cut and past the data into the txt file and run the script (this to prevent duplicates in the data). What the script does is clearing the entire JMP file and refill it with the two weeks of data. Now my question is;

 

Is there a line of script which can import and add the new data into the already existing JMP file without overwriting the existing data?

Can this data be in a new .txt or do i have to past this underneath the already existing/loaded .txt file?

 

Bonus question;

Is it possible that if there are duplicates in the data, automattically one of the duplicates gets deleted?

 

Kind regards,

L_Kingma

 

 

 

 

5 REPLIES
uday_guntupalli

Community Trekker

Joined:

Sep 15, 2014

@L_Kingma : 
 Can you please post samples of these data sets for people to test against .Yes , what ever you asked can be done - the easiest someone can do it by building it with an example . 

 

 

Best
Uday
L_Kingma

New Contributor

Joined:

Oct 24, 2017

@uday_guntupalli i have attached an example file, I hope this is workable.

What the script does is getting rid of the  " and put the data inbetween the " into a collum, so one collum will contain the date and the next collum contains the time etc.

if there is nothing inbetween the " there is no collum created.

 

uday_guntupalli

Community Trekker

Joined:

Sep 15, 2014

Looking at the sample data - is it fair to assume that some column in the data is unique ?
So , one way I can think of is using the time columns if they are always chronological , we can use them to sort and assemble the data accordingly.

Another alternative is if your pre-existing JMP script is writing the data to a JMP file , we can try to get the time of the file creation to know the order . Those are the only two I could get .
Best
Uday
L_Kingma

New Contributor

Joined:

Oct 24, 2017

Well this requires me to still copy and paste the data chronocally into my txt file. But that is more or less a nice to have. For now im really looking for a way how i can add data to the already existing JMP file, with the imput source a new .txt file, without overwriting the existing JMP data.

 

Is there a line of script able to do this and if so, what could it be?

 

Kind Regards,
L_Kingma

uday_guntupalli

Community Trekker

Joined:

Sep 15, 2014

FilePath = "C:\Test.txt"; 
Save Text File(FilePath,
			    "The quick brown fox"
              ); 
Load Text File( FilePath );
Save Text File(FilePath,
			    " jumped the fence",
			    mode("append")
              ); 
Load Text File( FilePath );             

You should be able to use Save Text File function to append data to an existing .txt file . 
Please see example code above . 
Relevant Post - https://community.jmp.com/t5/Discussions/Append-text-to-Save-Text-File-function/td-p/45256 
In case you meant to say append data from your .txt file to .jmp file , then 
look at Concatenate() in "Scripting Index" 
Help ==> Scripting Index ==> Concatenate 

Best
Uday