Trying to call Recursive WebReport keeps using the root argument

Hi,

I have a WebReport that walks a directory. Or at least, that's what I want to do. The WebReport takes a starting container as an argument (no defaults, you are prompted). I fetch the children, and call the report again to get the children of the children and so on.

The issue I am having is that even though I pass in a new child ID to the original report and call it with the RUNSWR tag, the called report as a sub-report. Here is the source of the report:

[/* Title: WalkFolder: This report will walk a folder tree and perform a permission stripping operation */]

[LL_REPTAG_MYID SETVAR:rptID /]</br>

Current Depth: [LL_REPTAG_&currDepth /]<br/>

Walking container [LL_REPTAG_&containerID NODEINFO:NAME /] ([LL_REPTAG_&containerID NODEINFO:DATAID /])...<br/>

Number of children: [LL_REPTAG_&containerID NODEINFO:CHILDCOUNT /]<br/>

[// This IF statement is used as a recursion safety valve.

[LL_WEBREPORT_IF "[LL_REPTAG_&recurse /]" == "true" && "[LL_REPTAG_&currDepth /]" < "2" /]

  [LL_WEBREPORT_FOR VAR:childRec DATA:[LL_REPTAG_&containerID NODEINFO:children /] /]

    [LL_REPTAG_!childRec RECORD:DataID SETVAR:childID /]

    [LL_WEBREPORT_IF "[LL_REPTAG_!childID NODEINFO:CHILDCOUNT /]" > "0" /]

      Recursing into [LL_REPTAG_!childID /]...<br/>

      [// For some reason, despite passing in a new ID for container ID, it processes the original root container 

      [// over and over

      [LL_REPTAG_MYID RUNSWR:containerID:[LL_REPTAG_!childID /]:currDepth:[LL_REPTAG_&currDepth ADD:1 /] /]

    [LL_WEBREPORT_ENDIF /]

  [LL_WEBREPORT_ENDFOR /]

[LL_WEBREPORT_ENDIF /]


The output is that it gets the children for the original container, but when it calls the report for the child folder, container ID is still taken to be the original. That is, despite passing in a new value for containerID, the sub-report call is using the original value. I've tried calling the original report as a subWR using MYID, a constant, and a variable - all the same behaviour. This is for CS 21.2

-Hugh Ferguson

Comments

  • I found the root cause. I had to set a breakpoint in the RUNSWR sub-tag to see it. If your parameter is listed as an Object ID, internally it has <paramName>, <paramName>_ID, <paramName>_Path, etc. You would need to pass those in, or more simply, change the parameter to be Number type. For my scenario, this works since the recursive report is being called from within a workflow WR step. But this is something to watch out for. If you need to prompt for a node, you cannot recurse within THAT report, you have to call a sub-report which can do recursion.

    -Hugh