how to save a joined table into the right folderHello everyone,
I am working on a project that needs to update new data into the original data file. I am using join table function now. The issue is that I can't save the joined data table into the right place. What I am trying to do is 1. pull out last 14 days data from the database, 2. open the original data file 3. join these two table 4. replace the original table by joined table. The issue is that last 14 days data table is saved but not the joined table.
I will appreciate a lot if you can help.
Re: how to save a joined table into the right folderNow, add your Close() statements back in, one at a time to confirm that the data table referenced by dtjoined is the one with all the data.
After you've confirmed that, instead of trying to save it at the same time you close it, save it first with:
dtjoined << save( savepathFieldarray);
Then just close it:
close(dtjoined);
Re: how to save a joined table into the right folderHi Jeff,
The data table created by the Join has all the data. Since I have three data tables now, it's a little bit tricky for me to save the right one.
Thanks,
Re: how to save a joined table into the right folderWe need to narrow down exactly where the problem is.
Can you verify that the data table created by the Join has all the data that you want?
Remove the Close() statements so that all three tables are still open and verify that the tables have the right data.
Re: how to save a joined table into the right folderHello Jeff,
Thank you so much for your reply.
Yes, the last 14 days of data are saved into the file that I specified with savepathFieldArray. But I want to save the joined data table with all of the data. I don't want the "last 14 days data table" being saved.
Thanks,
Winnie
Re: how to save a joined table into the right folderLooking at your code it looks like the line:
Close( dtjoined, save( savepathFieldArray ) );
should be saving the joined data table.
When you say that the "last 14 days data table is saved," do you mean that the last 14 days of data are saved into the file you specify with savepathFieldArray?
Can you provide an example of the two files (main and 14 days) that will reproduce the problem? If not the actual data can you use some dummy data that exhibits the same behavior?
Also, Tables->Join always creates a new data table, even when the "Update main table with data from second table" option is used. Tables->Update will update a data table in place.
Re: how to save a joined table into the right folderHello everyone,
My isuee is still exist. I need help either on join two tables and update data on the origanal table or save the new table correctly.
I will appreciate your help a lot.
Thanks,
Wen
Re: how to save a joined table into the right folderThank you for your answer, I did update but new data table is still created.
Re: how to save a joined table into the right folderWhen you do a join, there is an option to "Update main table with data from second table". Using that option, you could just save the original table after you've updated it. To invoke this option, you just need to add "Update main table with data from second table(1)," somewhere in this code snippet:
Drop multiples( 1, 1 ),
Include Nonmatches( 1, 1 ),
Preserve main table order( 1 ),
Output Table( ::dt_activeRI:Lineage[rowNum] || "_RI_" || Char( ::dt_activeRI:InvestigationId[rowNum] ) || "_FieldArray.jmp" )