Registering multiple databases - scriptHello everyone,
I would like to create an automated script to extract data from a .csv file that records logs from a machine.
The file is awful, with no logic whatsoever.
I managed to get the script to retrieve the data, but in the end I get a data table from which I extract data from logs. Depending on the file, I don't have the same number of logs and therefore not the same number of data tables.
I would like to be able to save them individually, or even better, save them as csv files, so that my colleagues can use them.
I've finished my script with these queries, and I'm getting a list of data tables. Can you help me?
ext = dt3 << Subset(
By(:Name),
All rows,
Selected columns only(0),
columns(
:Time, :T1, :T2, :T7, :M1, :M2, :EV12, :EV13, :EV14, :"L-EV12"n, :"L-EV13"n, :"L-EV14"n,
:BR1, :"L-BR1"n, :PR2, :PR3, :PR4, :SPT1, :SPT2, :Curve T1, Number of heating cycles,
Date, Batch, Loading temperature, Heating cycle number, Heating cycle, Duration
)
)
Edit (jthi): added jsl formatting
Automation and Scripting
Re: Enregistrement de plusieurs base de données - scriptOnce you have all the data in JMP it's a pleasure to continue in JMP.
When you export the data as csv or excel, you will loose all the cool possibilities.
Better: store the table as a JMP table.
On the other hand: parse data - without the goal to process the data i JMP?
This can be done much better in Python.
Re: Enregistrement de plusieurs base de données - scriptWhen you are using By with subset you will get a list of datatable references which you can then loop over and do whatever you wish to do with it.
Names Default To Here(1);
dt = Open("$SAMPLE_DATA/Big Class.jmp");
subsets = dt << Subset(
By(:age),
All rows,
Selected columns only(0),
columns(:name, :sex, :height, :weight)
);
Show(subsets);
For Each({dt_subset}, subsets,
// do something here
Show(dt_subset << get name);
wait(0);
// close after done
Close(dt_subset, no save);
);
Show(subsets);
You can find example of saving .csv from Scripting Index under Data Table > Save
回复: Enregistrement de plusieurs base de données - scriptIf the CSV has no pattern, use regular expressions to replace it
Re: Saving multiple databases - scriptThank you for the feedback!
Indeed, there are several goals:
- For me: continue working with the data under JMP, but ultimately I don't need the extracted data, just the concatenated table, and that's fine, I can do that with my script!
- For my colleagues whom I haven't yet managed to convert to JMP
: Having quick access to separate data is essential. But I remain hopeful that they will eventually switch to JMP!
Thanks anyway!
Re: Saving multiple databases - scriptThank you for the feedback!
But I'm still stuck with the save function...
I don't know where to position it for it to work; I've tried this, but it doesn't work...
For Each({dt_subset}, ext,
Show(dt_subset << get name);
);
For Each({dt_subset}, ext,
dt_subset<< save;
);
Re: Enregistrement de plusieurs base de données - scriptNames Default To Here(1);
dt = Open("$SAMPLE_DATA/Big Class.jmp");
subsets = dt << Subset(
By(:age),
All rows,
Selected columns only(0),
columns(:name, :sex, :height, :weight)
);
Show(subsets);
For Each({dt_subset}, subsets,
dt_subset << Save("$TEMP/" || (dt_subset << get name) || ".jmp");
wait(0);
// close after done
Close(dt_subset, no save);
);
Show(subsets);
Open("$TEMP");Re: Saving multiple databases - scriptEverything works perfectly!!
Thank you so much !!