test.knwf (279.4 KB)
Hi, I’m new to KNIME and having a problem with this what-should-be-simple task when trying to read multiple json files from a folder using table row to variable loop start. I would appreciate any help here. I have several thousands of json to read and process each time. I use list Files/Folders and that seems to work fine. Then I pass it to Table Row To Variable Loop Start. There is a Path variable with (LOCAL, C:\Users\mynamehere\knime-workspace\test\data\1.json)
And then I don’t see that Path in the Json Reader node.
I spent several hours last night and I reinstalled KNIME. I would greatly appreciate any help with this. Thank you so much!! Stay safe.
@alabamian2 welcome to the KNIME forum.
EDIT: the mixture of relative paths, path variables and strings are somewhat confusing. You might have to toy around with them. JSON file reader does not seem to support the new path variables while the List Files node does.
First you might have to use the new path variables in order to tell file readers like JSON where a file is in a loop situation.
Having said that I think you found a bug with the new Path variables and the JSON reader - since it would not accept a KNIME-protocol path but would use a full local path; demonstrated in the sample workflow.
@ScottF maybe you could have a look. The problem seems to be that in order to be able to browse the /data/ directory you have to enter a dot or two dots (…) but the path would not correctly convert the result.
The full path does work:
Wow, thank you soooooooo much, mlauber71!!! Yes, adding Path to String Variable worked!!! I was also using relative path and as you pointed out, that probably made it worse for a newbie like me. I’m just going to use absolute path for now. Phew, thank you so much again!!
@alabamian2 glad it does work. Relative paths and especially the KNIME protocol are good things to make it easier to track and share your workflows and have them in a logical way regardless of where in a subfolder your workflow is.
The option to determine your full local path with a Metanode and some Java Snippets is not the most elegant way and not very KNIMEy but it does work.
Unfortunately with the new path variable concept there can be some bugs and some readers are not fully equipped to use the new variables while others (like the list file node) demand it. So ist sometimes is not so easy. But with some back and forth it can work.
Ah, and you would want to take a look at the (new):
It is long and somewhat technical but then you should know everything you never dared to ask about how KNIME does handle files and paths and connections. This knowledge can come in quite handy at certain occasions.
OK, after seeing your recommendation, I’m attempting to do relative path and before I somehow had it right and now I’m doing something wrong. I’ll keep trying.
@alabamian2 you might have to specify which kind of Path (variable) you have. In your screenshot is is a local string in the Folder field but you have a setting for “Read from” the current workflow area, and this will not work.
Also when using path variables you have to specify what kind of path you are providing.
Thank you so much for explaining this. This makes sense and I’ll try to update from local.
I have one related question. I think I’ve seen other folks having the knime-workspace in Dropbox (like yours) and maybe OneDrive? I have OneDrive. Is there a way to move the knime-workspace folder designation so that I don’t have everything on my local laptop file system? This is what I have for the workspace now.
And for the folder I’m using, the local path is this.
And I should use this as best practice? What’s the difference with other options?
I didn’t have to change Path to String Variable.
I know I have to move the workflow to another VM to run it so this is very helpful. Thank you so much, @mlauber71.
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.