Also have an issue with the new module. Once I can load a file I want to add a new column name based on a mapping from a sql table. I’m having a hard time trying to figure out how to pass this to replace it. I see in my initial load of the file everything is labeled (Column 1, Column 2, etc). Then I load a sql table that has a Column number then to the new Mapped column name.
Awesome. Let me try to create a base sample and see if I can get this to relate back. The main idea is I have a folder with an unknown amount of other sub folders, Each sub folder has files in it. Each file, needs to be remapped with column headers and then outputted back out to a document lets say google docs or to the directory.
The only way I can see this working is by creating modules. Module 1 needing to links to the main folder then iterate and pass a sub folder to Module 2 which then takes the each folder and looks for each file in that folder and sends it to Module 3. Module 3 then takes the file and does a lookup and replaces the column x identifiers with a replacement from sql.
I finally have the replace by lookup working but I’m having a hard time with the looping.
coding wise would be:
For each folder in a directory
For each file in that folder
Rename generic column headers to headers defined by a SQL query and Output file to excel
If you know that there is only 1 level of subfolders, then you can produce the list of necessary files in one action “List files”. Just specify that you need to scan subfolders. If may reduce the number of necessary modules from 3 to 2: one module to build a list of files and do iteration, and the other module to process one file.
If the folder structure is hierarchical with unknown depths, that can be handled too, but that’s a different story.
Yeah I saw this option but in the next module how do you pass the full path with file name to “Import delimited text file”. I tried to create a Parameter through “Edit Parameter” using it as a string. Then passed the “File name with full path” as a string to the new created Parameter from Module 1 to Module 2. It doesn’t like we to use it this way. Do you have a sample or way to pass the fulle filename with path from module 1 to Module 2 use of the “Import delimited text file” so that I an load it?
The error I see is an absolute path with my variable name concatenated. So Module 1 passes “File name with full path” to var “FullPath”. FullPath is created as a string var in Module 2 through edit parameters. Current value I renamed as [FullPath]. But when I try to Load File in “Import delimited text file”, and try Parameter [FullPath] - it errors with “Something is wrong: Calculation failed. 1 error occurred. File C:\Tests\RunTest[FullPath] not found.”
Please post more screenshots (esp. of errors) and examples. I’m not sure I understand what you are trying to achieve. I understand that English is not your native language, so any visuals would help as they require no translation.
The expression for calculating the file path shown in the error message is clearly wrong. The contents of the [FullFilePath] column should’ve been appended instead of the column name. How do you obtain the file path? What’s the expression for it?
Parameter assignment doesn’t work like that. Parameters of the iterated module are assigned in the “Iterate” action. See this tutorial guide: EasyMorph | Iterations. Explore the examples in the tutorial and watch the video(s).
So when I use the pull the file names out in the “Files to Run” box in my sample code in GetFiles Module, I assumed I could iterate through each row of found files. I have pasted the iterate call that shows I tried to use fullfilepath as parameter in execute files with it pointing to the “File name with full path” (RenameError4.png). With the sample picture of the directory structure I created, it should have 4 files listed in the directory/subdirectories. Filename with full path, it has 4 rows. C:\test\a\test.xlsx, C:\test\b\test.xlsx, C:\test\b\test2.xlsx, C:\test\a\test3.xlsx (RenameError5.png). I then call iterate to pass it to Module 2 named ExecuteFiles. In ExecuteFiles, first section calls Create Combined Files box by trying to Load file of what was pulled from Module 1 “Get Files”. But I can’t seem to get row into the Import Excel Spreadsheet. In the Load file, how do I pass that iterate row parameter to Load file? (depicted in RenameError 6.png).
So my hope is you can tell me how I’m suppose to create it in the Edit parameters. Do I use Filename? and if so how do I get it to work in Import Excel spreadsheet in the Load File? Or do I use string text? I’ve tried many different ways but it doesn’t seem to recognize it in the Load file.
Just want a sample code or what to do when you grab rows of filenames, how to pass that filename path to a new module that gets pass to Import Excel Spreadsheet.
I created a sample project, maybe I didn’t full understand the problem but I hope this could help.
In the first module, main, I scan the folder to retrieve path and file name. The second action simply exclude the .morph file that is in the same dir. The third action iterate the second module, passing the full path as parameter. In the second module I read the content of each file.