HyperMath

Querying a Table of Contents

Querying a Table of Contents

Previous topic Next topic Expand/collapse all hidden text  

Querying a Table of Contents

Previous topic Next topic JavaScript is required for expanding text JavaScript is required for the print function  

It is possible to extract the table of contents of the data at once.

hmtoggle_plus1t = ReadFileToc (filename)

Returns the hierarchical tables of contents (Subcases, Types, Requests, Components) of the specified data file.

filename

Fully qualified name of the data file.

t

A table containing the information in the hierarchical structure as shown below.

 

t

 

|---

Subcases(an array of tables)

 

 

 

|------

Types(an array of tables)

 

 

 

    |

|------

Reqs(an array of tables)

 

 

    |

    |

|----------

Comps(an array of tables)

 

    |

    |

   |

|------

Name (Comp name)

 

    |

    |

   |

|------

Total (# of Comps)

 

    |

    |

|----------

Name (Req name)

 

 

    |

    |

|----------

Total (# of Reqs)

 

    |

|------

Name (Type name)

 

 

    |

|------

Total (# of Types)

 

 

|------

Name(Subcase name)

 

 

 

|------

Total (# of Subcases)

 

 

Example

The following shows how to query data for its table of contents and access selected fields.

t = ReadFileToc ("c:/test.dat");

// get the total number of Subcases

n = t.Subcases.Total;

// get the name of first Component in the hierarchy

name = t.Subcases[1].Types[1].Reqs[1].Comps[1].Name;

// get the name of the second Subcase

name = t.Subcases[2]. Name;