Jump to content
Larry Ullman's Book Forums

How To List-Up Parent's Path In Recursive Function


Recommended Posts

hi,

this is another question.

 

using recursive function you showed-up the to-do list as follow.

 

1. must do this

2. another task

   1. subtask1

       1. subsubtask1

   2. suntask2

3. new task

 

btw, is it possble to list-up with it's parent's path?

 

that is, i'd like to list-up like this.

 

1. must do this

2. another task

  1. subtask1 : another task * subtask1

      1.subsubtask1 : another task * subtask1 * subsubtask1

   2....

 

thanks.

 

Link to comment
Share on other sites

Yeah, you could do that, although I think there's an aesthetic argument against doing so. Off the top of my head my inclination is that you'd pass a string as a preface to the recursive function, that string being the parent task. You'd just need to watch the logic such that you wipe it out when you're at the top level and don't display it in that situation. 

Link to comment
Share on other sites

thanks for your comment.

 

frankly speaking, displayed results is not what the end of my goal.

i'll transform the semi-result to array and then finally explode to calculate accumulated quantity.

(bills of material explosión to make single level BOM.)

 

so the aesthetic thing is not the ploblem.

 

i agonized a few days for this and wondered whether this is possible.

as far as i know it's posible, i'll break more sweats.

 

thanks again Larry.

 

from Korea.

Link to comment
Share on other sites

 Share

×
×
  • Create New...