System.util.getSessionInfo() unable to filter by project

7.9.13, No matter what I try I cannot get the project filter to work. The manual says that you can filter by user and by project. Here is what I’ve tried:

system.util.getSessionInfo('','SewingStation')
system.util.getSessionInfo('SewingStation')
system.util.getSessionInfo(['SewingStation'])
system.util.getSessionInfo([['SewingStation']])
system.util.getSessionInfo(['*'],['SewingStation'])

The user filter works like …('Username'), not sure why project filter does not work the same

I vaguely recall a bug report about that…

I thought it might be a bug seeing as it should be pretty simple to use. Thanks.

Have you tried:

system.util.getSessionInfo(None,'SewingStation')

When I try it then it filters the way I believe your wanting it to. It wants something in the user filter but None/Null appears to get it to skip it and just allow the project filter to work.

That does seem to work and should definitely be in the manual. Not very intuitive to me considering the way other scripting functions work with multiple parameter options. Thanks

system.util.getSessionInfo(projectFilter='SewingStation') should also do the same thing.

2 Likes

Your comment just reminded me that I had the same problem with system.util.sendMessage(). It was easier to handle by decalring the parameter explicitly. I will note that when using anything in the system.util family

You should just do that whenever there are optional arguments - it will take all of the mystery out of why something might not be working as intended.

2 Likes

Yeah, we’re not very consistent about it on methods with only a few parameters, but generally any method that takes more than three parameters should accept keyword arguments, which makes the calling syntax a lot cleaner. Over time we’re (I’m :slight_smile: ) pushing to make all of our first-party scripting functions accept keyword arguments so they’re better at pretending to be Python functions.

3 Likes