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
- x=get_depend_items(get_current_item())
- max=table.maxn(x)
- if max>=1 then
- ctr1 = 1
- msg=max .. " Functions Listed"
- while ctr1<=max do
- dependitem=get_item_text(x[ctr1])
- dependdescription=get_item_text(get_item_children(get_item_children(x[1])[1])[1])
- msg=msg .. "\n\n" .. dependitem.. '\n '.. dependdescription
- ctr1=ctr1+1
- end
- else
- msg=" No Related Items"
- end
- msgbox(msg,"Related Functions")
Code Description
- A vector of the dependent item ids is created
- the total number of items in the vector is set to the variable max
- if there are more than zero items in the vector, max is greater than or egual to one
- a counter is set to one
- an initial message is created that includes the number of dependent items
- a while loop is created that extracts and assembles the mssage for the message box
- the ITL of the dependent item is set to a variable
- the description, two child levels down, is extracted
- the message is assembled
- the counter is incremented by one
- the while loop continues if there are more depends items or exits
- the else statement for the if statement
- the message is set to indicate that there are no related items, no dependancies set
- the end of the if statement
- 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)