-
Notifications
You must be signed in to change notification settings - Fork 0
ASSIGNCATALOG
The ASSIGNCATALOG command is an assignment statement. It can create new catalogs or update existing ones. There are two different modes of using it; one is a regular assignment and the other is a subset.
The syntax in both cases is
ASSIGNCATALOG newnames = ...
You can put any number of new variable names on the left hand side of the = sign for the new catalog. This is helpful if you want to create it under multiple different names. The more typical use case is just to have one new variable name.
ASSIGNCATALOG works very similarly to ASSIGNLIST, the difference being that ASSIGNCATALOG creates or updates catalogs, not lists.
To use with regular assignment syntax, use ASSIGNCATALOG newnames = assignment expression
where assignment expression involves one or more catalogs and/or lists; if more than one item is on the right hand side, then + or - signs indicate what is being added and what is being subtracted. The order of operations on assignment expression is from left to right. If there are duplicates of the same list name during this evaluation, extras are discarded to ensure each list name inside the catalog is unique.
Some examples:
ASSIGNCATALOG scenerywords = trees + animals + flowers + landforms
ASSIGNCATALOG middledialog = alldialog - intro + questions
ASSIGNCATALOG newcat1 newcat2 = oldcatalog + list1 - list2 + othercatalog
Important note: If you make changes to one of the lists (e.g. via ASSIGNLIST) after it's been assigned to a catalog, the value will not update itself in the catalog. Instead, you will need to re-assign it (typically by subtracting the list name from the catalog and then adding it again).
Subset assignment syntax is designed for creating a new catalog containing a random selection of lists from an existing catalog. In this case, the syntax is ASSIGNCATALOG newcatalogname = existingcatalog number
where number refers to how many lists are to be selected from the existing catalog (must be greater than zero). Because we are dealing with lists within a catalog, please be aware that the entire contents of the selected list will be assigned to the new catalog. The name of the list inside the catalog will still be the same.
For example, in the following catalog structure:
mycatalog
colors
red
blue
yellow
emotions
happy
sad
pensive
trees
oak
fir
linden
The command ASSIGNCATALOG newcat = mycatalog 2
would result in 2 lists being chosen from the above catalog. Suppose emotions
and trees
happened to be the ones selected, then the result would be:
newcat
emotions
happy
sad
pensive
trees
oak
fir
linden
If multiple variable names are on the left hand side of the = sign, they will hold identical contents to each other after this assignment. The results are not re-randomized for each variable assignment.
There are not many typical-use cases where ASSIGNCATALOG is desired to be used via subset assignment syntax; it is more commonly used via regular assignment syntax.
ASSIGNLIST, ASSIGNGEN
For a hierarchical directory, see the homepage for this Wiki