Filtering by tag

   2776   5   1
User Avatar
Member
28 posts
Joined: 3月 2015
Offline
Hi,

I have 2 work items, each with a different tag:
  • “file/geo/terrain”
  • “file/image”
I'd like to filter out the work item with the “file/geo/terrain” tag.

I've tried using the “Filter By Expression” top node with no success:
I've used the HScript expression
pdginput(1, "file/image", 0)
with various string functions, but I couldn't get what I wanted.

Does anyone would have a solution?
Thanks!

Alex

Attachments:
filterbyexpression.png (72.5 KB)

User Avatar
スタッフ
387 posts
Joined: 8月 2017
Offline
The pdginput function returns the input file, but the Filter Expression parameter is expecting an integer.

You will need to use the strcmp function:

strcmp(pdginput(0, "file/geo/terrain", 0), "")
Edited by BrookeA - 2019年10月23日 10:58:28
User Avatar
Member
28 posts
Joined: 3月 2015
Offline
Thanks Brandon, it works!

The only thing I don't get is: My work item's index is 1, so I wrote
strcmp(pdginput(1, "file/geo/terrain", 0), "")
Why is it only working with the work item's index set to 0?
User Avatar
スタッフ
585 posts
Joined: 5月 2014
Offline
The index in that function is the index of the file in the list of output files, not the work item index. In this case, the 0 means the first file with that tag, while 1 would mean the second file with the tag (if it existed).

The work item index isn't needed because PDG evaluates the parameter against each work item, so all of the expression functions are computed with respect to a particular work item. If you select a work item dot in the UI, you can preview the evaluation w/ respect to that work item in the parameter interface by MMB-ing on the parm label.
Edited by tpetrick - 2019年10月23日 11:21:02
User Avatar
Member
28 posts
Joined: 3月 2015
Offline
Thanks for the clarification!

I guess the documentation would need a small update then
http://www.sidefx.com/docs/houdini/expressions/pdginput.html [www.sidefx.com]
User Avatar
スタッフ
585 posts
Joined: 5月 2014
Offline
Yep I checked after writing my post and realized the docs are quite unclear about how the function should be used. I'm going to update it today so it does a better job describing what the function arguments are.
  • Quick Links