Sample Script 6


Description

This script will extract all of the depend item ids for a selected item and then show in a message box the ITL for each dependant item along with its description.

Code

  1. x=get_depend_items(get_current_item())
  2. max=table.maxn(x)
  3. if max>=1 then
  4. ctr1 = 1
  5. msg=max .. " Functions Listed"
  6. while ctr1<=max do
  7. dependitem=get_item_text(x[ctr1])
  8. dependdescription=get_item_text(get_item_children(get_item_children(x[1])[1])[1])
  9. msg=msg .. "\n\n" .. dependitem.. '\n '.. dependdescription
  10. ctr1=ctr1+1
  11. end
  12. else
  13. msg=" No Related Items"
  14. end
  15. msgbox(msg,"Related Functions")

Code Description

  1. A vector of the dependent item ids is created
  2. the total number of items in the vector is set to the variable max
  3. if there are more than zero items in the vector, max is greater than or egual to one
  4. a counter is set to one
  5. an initial message is created that includes the number of dependent items
  6. a while loop is created that extracts and assembles the mssage for the message box
  7. the ITL of the dependent item is set to a variable
  8. the description, two child levels down, is extracted
  9. the message is assembled
  10. the counter is incremented by one
  11. the while loop continues if there are more depends items or exits
  12. the else statement for the if statement
  13. the message is set to indicate that there are no related items, no dependancies set
  14. the end of the if statement
  15. a message box is created based on the above constructs

Notes

it is assumed that the format for the function description is that the first child item's child item is the detailed description (see line 8)