Flow variables don't appear

Hello there,

I have a peculiar problem. I defined the following flow variables for paths that I then feed into MS Access Connector:

However, the flow variable path does not appear and I do not know why:

image

Weirdly enough, in the excel reader, the flow variable path does appear:

image

Does anyone know what is going on?

1 Like

Hey there,

this is not too obvious, but I think the node in your first screenshot seems to expect the Path as String type as you only see variables of type string.

Your Path variable is of type FSLocationVariableType:

And that is why it does not show!

You can use Variable Expressions (legacy) with the following function to turn your Path Type into String Type:

getPathString(variable("Path"))

I think that should fix it!

2 Likes

Yes, that seemed to do the trick, thank you! :smiley:

I was under the impression that you needed paths to give the location to a node, because the other nodes handle it this way.

Let’s say I agree that it’d be great if all nodes handled it this in the same and consistent way… however for now some support Path Data Type whilst others require Path as String. This can be a bit problematic in cases where workflows may be used on different Operating Systems - e.g. Windows and Mac - one file system uses forward the other backslash…

Glad the above worked out for you!

1 Like

This component among other things provides the separator by operating system

1 Like

Hi @MartinDDDD , @mlauber71 , @KasimirNepomuk

Something I cam across a while back is that you can actually use both forward slash or back slash in Windows in KNIME and it doesn’t care.

You can even mix and match in the same path :slight_smile:
e.g.
c:/temp\somefolder/anotherfolder/PowerBI_sample.accdb
will work fine as a string!

The String to Path node converts it without problem, and it can be used directly in nodes that still use String instead of Path variables, so happy days! :wink:

So my suggestion if having to build string paths is just use forward slash for everything and it should work across all platforms. It also makes building in string manipulation much simpler as you don’t need to worry about “escaping” backslashes

As you can see, the Access Connector is happy with that jumbled path string too:

1 Like

@takbb I do not like such mixes. They tend to cause trouble somewhere down the road. Also I use these paths in R or Python nodes. But indeed to use one type might just work.

2 Likes

Hi @mlauber71 - lol, I’m not recommending that they be mixed, but just giving a demonstration that KNIME on Windows handles both :slight_smile: (I’m not crazy about mixing either)

I confess I hadn’t tried it with R and Python, so I should add a health warning to my suggestion of just using forward slash. Be interesting to know if it works ok for those too.

2 Likes

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.