cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Want the oppurtunity to discuss enhancements to PTC products? Join a working group! X

Parent Subfolder

rleir
17-Peridot

Parent Subfolder

Hi team

In QueryBuilder you can join the document table to the Subfolder table, which gives you the 'leaf' folder where the document resides. You can have Subfolder Name in the 'Select or Constrain' tab. Good.

You can join from the Subfolder to its parent Subfolder, and so on for deep folder trees (performance seems to suffer due to this).

I don't always have the same depth of folders, so is there a way to recurse all the way up to the top folder? I hesitate to say 'iterate' because Windchill uses that term w.r.t. versioning, and I am not talking of that.

 

Maybe this is relevant: you can join the Document table to the Folder table via the 'Iterated Folder Member Link' but there are no Folder fields which can be used as criteria. How/What/Where can this be useful?

thanks

Rick

ACCEPTED SOLUTION

Accepted Solutions

Rick, hi

 

If you want to enter the folder path as the criteria that is doable.

 

In my example I entered the object and returned its folder path.

I wrote my own method which looped from the bottom up until it got to the top level folder.

 

That said, there are two OOTB getLocation methods.  The one that you'd pass the WTDoc. EPMDoc. WTPart (or any other object that is in the folder) is depreciated (WC 12.1) but it still works.

 

As for inputting the folder path itself, you can certainly pass the input to a Java Method and return the desired results.  You just need to enter it as a String "Parameter" and pass the String to your Java Method.

 

If you need help with this feel free contact me at windchill.developer@yahoo.com 

 

 

David

 

 

 

 

 

 

View solution in original post

7 REPLIES 7
Marco_Tosin
21-Topaz I
(To:rleir)

Rick,

I believe we have same limits as for extracting all BOM levels because, at the moment, query builder tool cannot be recursive.

Marco
rleir
17-Peridot
(To:Marco_Tosin)

Marco, Kudos to you for your reply. You say 'BOM' but no: I am asking more generally about nested folders.

 

/default/folderLevel2/folderLevel3/folderLevel4/folderLevel5/folderLevel6/  .. containing documents, parts, whatever.

 

QB gives me good access to the lowest level of subfolder, it can be used for report criteria. I cannot access the complete folderpath for use as report criteria (though I can display it). If I want access to the individual folders in the folderpath, I need to join to the subfolder's parent, and its parent, and so on.

That is fine when I know in advance how deep the folders go. As it happens, I want the parent's parent to be a report criterion (don't ask). That would be folderLevel4 above, and I have a working QB report for that.

 

It would be nice to know a more general way to access folders in the folderpath. Suppose you want the folder which is second level from the top to be a report criterion, but the folderpath depth varies from library to library? 

 

I think that your answer is simply 'no, that is not supported in QB'?

Thanks

Rick

Query Builder can be recursive.

What you want to do IS supported by Query Builder.

You can get the job done using “Java Method”.

 

Using Java Method you can go from the document to its folder and then recursively go up the folders until you get to the top folder.

The full path can then be returned and displayed in the report.

d_graham_1-1647780323650.png

 

 

d_graham_0-1647780228406.png

Seems to work.

rleir
17-Peridot
(To:d_graham)

Hi Dave

I know it's possible to join to FolderPath, but this cannot be used as criteria: the report user does not get to enter a folder path in the report criteria.

FolderPath.png

 

Are you talking of these Java methods in wt.folder.FolderHelper? 

  • getCabinetBasedToLocationMap
  • getLocation

Or maybe in com.ptc.windchill.enterprise.queryBuilder.methods.RecursionDisplayHelper:

  • level
  • levelDisplay

How do you use them?

 

Maybe I should write some Java, I know the language but I do not know the WC interfaces and DB schema.  

Thanks

Rick

Rick, hi

 

If you want to enter the folder path as the criteria that is doable.

 

In my example I entered the object and returned its folder path.

I wrote my own method which looped from the bottom up until it got to the top level folder.

 

That said, there are two OOTB getLocation methods.  The one that you'd pass the WTDoc. EPMDoc. WTPart (or any other object that is in the folder) is depreciated (WC 12.1) but it still works.

 

As for inputting the folder path itself, you can certainly pass the input to a Java Method and return the desired results.  You just need to enter it as a String "Parameter" and pass the String to your Java Method.

 

If you need help with this feel free contact me at windchill.developer@yahoo.com 

 

 

David

 

 

 

 

 

 

Marco_Tosin
21-Topaz I
(To:rleir)

Rick,
as Dave wrote, you can make recursive reports with the Query Builder, but you have to know how to write a Java method, so it is true that these are part of the standard operation of the Query Builders but it is also true that if a user/administrator, as in my case, is not able to write a piece of code to get a Java method usable by the report, he cannot run a recursive report with the Windchill OOTB tools, but he has to go to someone who can write the necessary Java method.

 

Marco
rleir
17-Peridot
(To:Marco_Tosin)

Marco

There is a workaround in Query Builder that I have been using. Do a join to the parent subfolder, then another join to its parent subfolder. Do this 3 or 5 times, depending on how deep your folders commonly get. Clearly this is not recursive. Let's call it pseudo-recursive. Then provide a parameter field, and in the criteria tab you can check the parameter against each subfolder. Not very nice but it works. 

You need to use outer joins, otherwise you will not get results in shallow folders. For example, if you want to display a result in /default/Fred/, your 3-deep joins will prevent this unless you use outer joins.

cheers -- Rick 

Announcements


Top Tags