# Collections of Items - [Python Regular Expressions](Python-Regular-Expressions) Match function - [Definitions](#definitions) - [ListSelector](#listselector) - [FileSelector](#fileselector) - [CSVFileSelector](#csvfileselector) - [CSVkmdSelector](#csvkmdselector) - [CSVSubkeySelector](#csvsubkeyselector) - [CSVDataSelector](#csvdataselector) - [Named Collections](#named-collections) - [Examples](#examples) ## Definitions * [Basic Items](Basic-Items) * [List Items](List-Items) * [Command data from Google Docs/Sheets/Storage](Command-Data-From-Google-Docs-Sheets-Storage) ``` ::= ::= ::= https://storage.cloud.google.com//| https://storage.googleapis.com//| gs:///| / ::= ||( ) ::= ||( ) ::= (json [charset ] ) | (json file [charset ]) | ``` ## ListSelector A list of items ``` ::= ::= "(,)*" ::= list ``` ## FileSelector A flat file containing a single Item per row. ``` ::= file (( [charset ])| (gdoc )| (gcsdoc )) [delimiter ] ``` * `` - A flat file containing Items * `gdoc ` - A Google Doc containing Items * `gcsdoc ` - A Google Cloud Storage Bucket Object containing Items * `delimiter ` - There are multiple Items per row separated by ``; if not specified, there is single item per row ## CSVFileSelector A CSV file with one or more columns per row that contain Items. ``` ::= csvfile (((:)+ [charset ] )| (gsheet(:)+ )| (gdoc(:)+ )| (gcscsv(:)+ )| (gcsdoc(:)+ )) [warnifnodata] [columndelimiter ] [noescapechar ] [quotechar ] [endcsv|(fields )] (matchfield|skipfield )* [delimiter ] ``` * `(:)+` - A CSV file and the one or more columns that contain Items * `gsheet(:)+ ` - A Google Sheet and the one or more columns that contain Items * `gdoc(:)+ ` - A Google Doc and the one or more columns that contain Items * `gcscsv(:)+ ` - A Google Cloud Storage Bucket Object and the one or more columns that contain Items * `gcsdoc(:)+ ` - A Google Cloud Storage Bucket Object and the one or more columns that contain Items * `warnifnodata` - Issue message 'No CSV file data found' and exit with return code 60 if there is no data selected from the file * `columndelimiter ` - Columns are separated by ``; if not specified, the value of `csv_input_column_delimiter` from `gam.cfg` will be used * `noescapechar ` - Should `\` be ignored as an escape character; if not specified, the value of `csv_input_no_escape_char` from `gam.cfg` will be used * `quotechar ` - The column quote characer is ``; if not specified, the value of `csv_input_quote_char` from `gam.cfg` will be used * `endcsv` - Use this option to signal the end of the csvfile parameters in the case that the next argument on the command line is `fields` but is specifying the output field list for the command not column headings * `fields ` - The column headings of a CSV file that does not contain column headings * `(matchfield|skipfield )*` - The criteria to select rows from the CSV file; can be used multiple times; if not specified, all rows are selected * `delimiter ` - There are multiple Items per column separated by ``; if not specified, there is single item per column ## CSVkmdSelector A CSV file with a key column that contains an Item and optional subkey and data columns that contain data related to the key Item. ``` ::= csvkmd ((| (gsheet )| (gdoc )| (gcscsv )| (gcsdoc )) [charset ] [columndelimiter ] [noescapechar ] [quotechar ] [fields ]) keyfield [keypattern ] [keyvalue ] [delimiter ] subkeyfield [keypattern ] [keyvalue ] [delimiter ] (matchfield|skipfield )* [datafield (:)* [delimiter ]] ``` * `` - A CSV file containing rows with columns of items * `gsheet ` - A Google Sheet containing rows with columns of items * `gdoc ` - A Google Doc containing rows with columns of items * `gcscsv ` - A Google Cloud Storage Bucket Object containing rows with columns of items * `gcsdoc ` - A Google Cloud Storage Bucket Object containing rows with columns of items * `columndelimiter ` - Columns are separated by ``; if not specified, the value of `csv_input_column_delimiter` from `gam.cfg` will be used * `noescapechar ` - Should `\` be ignored as an escape character; if not specified, the value of `csv_input_no_escape_char` from `gam.cfg` will be used * `quotechar ` - The column quote characer is ``; if not specified, the value of `csv_input_quote_char` from `gam.cfg` will be used * `endcsv` - Use this option to signal the end of the csvfile parameters in the case that the next argument on the command line is `fields` but is specifying the output field list for the command not column headings * `fields ` - The column headings of a CSV file that does not contain column headings * `(keyfield [keypattern ] [keyvalue ] [delimiter ])+` * `keyfield ` - The column containing key values * `[keypattern ] [keyvalue ]` - Allows transforming the value(s) in the `keyfield` column. If only `keyvalue ` is specified, all instances of `` in `keyvalue ` will be replaced by the item value. If `keypattern ` is specified, the item value is matched against `` and the matched segments are substituted into `keyvalue ` * `delimiter ` - There are multiple values per keyfield column separated by ``; if not specified, there is single value per keyfield column * `(subkeyfield [keypattern ] [keyvalue ] [delimiter ])*` * `subkeyfield ` - The column containing subkey values * `[keypattern ] [keyvalue ]` - Allows transforming the value(s) in the `subkeyfield` column. If only `keyvalue ` is specified, all instances of `` in `keyvalue ` will be replaced by the item value. If `keypattern ` is specified, the item value is matched against `` and the matched segments are substituted into `keyvalue ` * `delimiter ` - There are multiple values per subkeyfield column separated by ``; if not specified, there is single value per subkeyfield column * `(matchfield|skipfield )*` - The criteria to select rows from the CSV file; can be used multiple times; if not specified, all rows are selected * `(datafield (:])*` * `datafield (:` - There are multiple values per datafield column separated by ``; if not specified, there is single value per datafield column ## CSVSubkeySelector A subkey field identified in a `csvkmd` argument. ``` ::= csvsubkey ``` ## CSVDataSelector Data fields identified in a `csvkmd` argument. ``` ::= csvdata (: ::= | (query:)|(query:orgunitpath:)|(query ) | (browserou ) | (browserous ) | | ::= | | | | ::= | | | | ::= | | | | ::= | | | | ::= | | | | ::= | | | | ::= | | | ::= | | | | | ::= | | | ::= | | | | | ::= | | | | | ::= | | | | | ::= | (cros_sn ) | (query:) | (query:orgunitpath:) | (query ) ::= | (device_sn ) (query:) | (query ) ::= | (first|last|allexceptfirst|allexceptlast ) | (before|after