Subscribe Bookmark RSS Feed

Re: How to join multiple tables together?

Hi Guys,

I have several files that look like this:

File 1:
location number1 position
1 6 A
2 8.9 A
3 4.8 B
4 10.52 B
5 15.87 B

----
File 2:
location number2 position
1 6.9 A
2 8.9 A
3 4.8 B
4 10.52 B
5 15.87 B

----

File 3:

location number3 position
1 7.89 A
2 8.9 A
3 4.8 B
4 10.52 B
5 15.87 B
-----

I want a file that looks like:

location number1 number2 number3 position
1 6 6.9 7.89 A
2 8.9 8.9 8.9 A
3 4.8 4.8 4.8 B
4 10.52 10.52 10.52 B
5 15.87 15.87 15.87 B

---

All the values under the number1, number2 and number3 columns are different for different files.

How do I achieve this?

I tried the join command and it did not work.

Thanks.
9 REPLIES
Highlighted
mpb

Super User

Joined:

Jun 23, 2011

How did the Join command "not work"? The Join command is definitely the way to do the job.
Ok that worked.

Now how do I join a group of files in a folder?
I am trying something like this:

Anybody?
ms

Super User

Joined:

Jun 23, 2011

In your code files1 is a list, not a file. That's why the Open() command probably fails. Try Open(files1) or similar (look in the manual!) to get a file name in the list instead of the whole list. That's the first problem I spotted. Might be more.

Btw, to get swift help it would help if you explain why your code didn't work (the log window is indeed helpful in this respect).

Message was edited by: MS
I had an i as the loop index in the open command so that worked. Here is the error I am getting the jmp log window. Send Expects Scriptable Object in access or evaluation of 'Send' , dt << Join( With( dt ), By Row Number )

Could it be that I cannot iteratively join the same table? dt changes every time the loop runs and it moves across all the files in the files1 list.
It works fine when I don't use the loop and use a separate reference for every file.
Anybody?
mpb

Super User

Joined:

Jun 23, 2011

Following assumes folder contains only .jmp files. If other kinds of files or folders exist then you should remove all non .jmp files from the files list. you may or may not want to uncomment the Merge Same Name Columns line.

Ok that worked, thanks.