<directory>

<directory> returns a table that provides information about the child objects of a particular folder. These include any tables, folders, and queries that have been saved to that folder.

Syntax

<directory folder="[NAME_OF_FOLDER]"/>

Attributes

folder
Accepts a folder name (e.g., pub.demo.retail).

folder="0" will display all root directories.

title
Accepts arbitrary text that overrides the title of the table returned by <directory>.
sdesc
Accepts arbitrary text that overrides the short description of the table returned by <directory>.
ldesc
Accepts arbitrary text that overrides the long description of the table returned by <directory>.
depth
Accepts an integer value specifying the recursive depth to which the <directory> operation will return folder information.

For example, depth="2" returns two levels of directory information starting from the directory provided in the folder attribute.

The default if the depth attribute is omitted is 1, which returns information only for the current directory.

depth="0" returns directory information for all available levels in the current directory.
folder="0" depth="0"
will display every object that a user has access to.
folder="0" depth="1"
will display all the top level folder paths that a user has access to.

(Available as of prod-9)

find
Used as <directory find="string"/>, returns a table with the metadata for all tables and folders in the session whose path or title contain string.

Because it only retrieves the metadata for matching objects, if the number of matches is small it is much faster (especially for users with a large number of tables/folders) than using

<directory folder="0">

to get metadata for all tables, then selecting on that table.

search
Specifies the metadata over which the find operation will be applied.
search="path"
will search only paths and
search="title"
will search only titles (the default is
search="path,title"
). It is also possible to further extend (or restrict) the search by specifying one or more of sdesc, ldesc, owner in the list.
foldcase
The default is a case-sensitive search. Using foldcase="1" will make it case-insensitive.
sm
The default is to treat the search string as literal text (ignoring the wildcard characters *,?,[,]). Using sm="1" will cause the search string to be treated as a match pattern as in the MDB function sm().
exact
The default is to search for objects whose path/title/whatever contain the search string or pattern. Using exact="1" will find only exact matches.
limit
By using limit="n" the number of results from the operation are limited to n. Since full metadata is only retrieved for search results, this can be much faster in the case of a very non-specific search string.
hard
To be used with limit="n", hard="1" causes the operation to signal the error "m matches", instead of returning a table, if the number of matches m > n. By using limit="n" the number of results from the operation are limited to n. Since full metadata is only retrieved for search results, this can be much faster in the case of a very non-specific search string.
Note: A current limitation of
<directory find=...>
is that if the title (sdesc, ldesc, owner) of a table is changed during the session, the changed title will not be matched in the search. Newly created tables will, however, be found.

Return Value

The <directory> operation returns a table containing information about any child objects (i.e., tables, folders, and queries) under the specified folder.

This table contains the following columns:
path
Full path to the object
title
The label associated with the object
type
The type of object
Valid values are:
dir folder
tab table
ctype
Integer representation of the type of data
Valid values are:
0 table
1 non-parameterized Quick Query
2 parameterized Quick Query
3 uploaded query (deprecated)
4 merged table
5 tolerant merged table (ignores missing tables)
ttype
Character representation of the type of data
Valid values are:
table table
query Quick Query
id
Integer value representing a unique identifier
link
Link header
owner
Boolean value indicating whether the user currently logged in is the owner of the object
navto
Boolean value indicating whether or not the user can directly access the table
Note: This item has been deprecated.
owneris
Username of the owner
ts
Integer value representing the timestamp of the last modification
date
Integer value representing the date of the last modification
time
Integer value representing the time of the last modification
secure
Boolean value indicating whether SSL encryption is required (deprecated)
Note: Since SSL encryption is always required when using 1010data, this value no longer has any significance.
bytes
Decimal value representing the physical size of the object in bytes
sdesc
Short description
ldesc
Long description

Example

This example returns a table with information about the contents of the folder pub.demo.retail as specified by the folder attribute.

<directory folder="pub.demo.retail"/>

Returns the following table:

Example - find attribute

The following simple QuickApp demonstrates most of the features available for the find attribute.

<dynamic l="100" f="" s="path,title" m="" t="" c="0" >
  <do>
    <set m="" t=""/>
    <do queryvalue_="@t">
      <directory search="{@s}" find="{@f}" foldcase="{@c}" limit="{@l}" hard="1"/>
    </do>
    <do onerr_="* matches">
      <set m="{@doerr_}"/>
    </do>
  </do>
  <layout arrange_="v">
  <layout arrange_="h">
    <widget class_="field" label_="Search string:" immediate_="1" value_="@f"/>
    <widget class_="checkbox" label_="Ignore case" value_="@c"/>
    <widget class_="field" type_="numeric" label_="Show results:" value_="@l"/>
  </layout>
  <widget class_="checklist" value_="@s">
    <table>path;title;sdesc;ldesc;owner</table>
  </widget>
  <widget class_="text" require_="@m" invmode_="hide" text_="There are {@m}, too many to display"/>
  <widget class_="grid" require_="@t" invmode_="hide">
    <table data="{@t}"/>
  </widget>
  </layout>
</dynamic>

Returns the following table: