Programmer Guide/Shell Items/File/FILE Item Attributes: Difference between revisions

From STX Wiki
Jump to navigationJump to search
 
(26 intermediate revisions by 3 users not shown)
Line 1: Line 1:
{{DISPLAYTITLE:{{SUBPAGENAME}}}}
{{DISPLAYTITLE:{{SUBPAGENAME}}}}
{{File Item}}
The following file item attributes can be queried in the format <code>$#fileItem[<var>Attribute</var>]</code>.
The following file item attributes can be queried in the format <code>$#fileItem[<var>Attribute</var>]</code>.


==General file item attributes==
== Common file item attributes ==


{|class="einrahmen"
{|class="einrahmen"
Line 8: Line 9:
! colspan="2" | Value(s) and Description
! colspan="2" | Value(s) and Description
|-
|-
| !PATH
| <code>!PATH</code>
| colspan="2" | full path of file attached to the file item
| colspan="2" | full path of the file attached to the respective file item
|-
|-
| !DRIVE
| <code>!UNCPATH</code>
| colspan="2" | drive letter (without trailing <code>:</code>) of file attached to the file item
| colspan="2" | full path of the file attached to the respective file item in UNC format
|-
|-
| !DIRECTORY
| <code>!DRIVE</code>
| colspan="2" | directory (without trailing <code>\</code>) of file attached to the file item
| colspan="2" | the drive letter of the file attached to the respective file item (without a colon)
|-
|-
| !NAME
| <code>!DIRECTORY</code>
| colspan="2" | name of file attached to the file item
| colspan="2" | the directory of the file attached to the respective file item (without a trailing backslash)
|-
|-
| !EXTENSION
| <code>!UNCDIRECTORY</code>
| colspan="2" | filetype-extension (without leading <code>.</code>) of file attached to the file item
| colspan="2" | the directory of the file attached to the respective file item (without a trailing backslash) in UNC format
|-
|-
| !CREATED
| <code>!NAME</code>
| yyyy.mm.dd hh.mm.ss
| colspan="2" | the name of file attached to the respective file item
|-
| <code>!EXTENSION</code>
| colspan="2" | extension part of the filename of the file attached to the respective file item (without a leading &quot;<code>.</code>&quot;)
|-
| <code>!FILENAME</code>
| colspan="2" | name and extension of the file
|-
| <code>!CREATED</code>
| <code>yyyy.mm.dd hh.mm.ss</code>
| creation date and time of file attached to the file item
| creation date and time of file attached to the file item
|-
|-
| !MODIFIED
| <code>!MODIFIED</code>
| yyyy.mm.dd hh.mm.ss
| <code>yyyy.mm.dd hh.mm.ss</code>
| time of last modification of file attached to the file item
| time of last modification of file attached to the file item
|-
|-
| !ATTRIBUTES
| <code>!MTSTAMP</code>
| DIRECTORY|SYSTEM|HIDDEN|NORMAL
| <code>modmin</code>
| time of last modification in minutes since 1st January 1980
|-
| <code>!ATTRIBUTES</code>
| <code>DIRECTORY&#124;SYSTEM&#124;HIDDEN&#124;NORMAL</code>
| type attributes of file attached to the file item
| type attributes of file attached to the file item
|-
|-
| !ACCESS
| <code>!ACCESS</code>
| READ|WRITE|APPEND
| <code>READ&#124;WRITE&#124;APPEND</code>
| access attributes of file attached to the file item
| access attributes of file attached to the file item
|-
|-
| !SIZE
| <code>!SIZE</code>
| filesize
| <code>filesize</code>
| size of file attached to the file item in bytes
| size of file attached to the file item in bytes
|-
|-
| !TYPE
| <code>!TYPE</code>
| FILE<nowiki>|</nowiki>LIST|TEXT|SECTION|XML
| <code>FILE&#124;LIST&#124;TEXT&#124;SECTION&#124;XML</code>
| type of file item (set in NEW command)
| type of file item (set in NEW command)
|-
|-
| !SHELL
| <code>!SHELL</code>
| owner
| <code>owner</code>
| shellidid of shell creating the file item (8 hex digits)
| shellidid of shell creating the file item (8 hex digits)
|-
|-
| !USERS
| <code>!USERS</code>
| numusers
| <code>numusers</code>
| number of linked items sharing the file item
| number of linked items sharing the file item
|-
|-
| !LASTACCESS
| <code>!LASTACCESS</code>
| yyyy.mm.dd hh.mm.ss
| <code>yyyy.mm.dd hh.mm.ss</code>
| date and time of the last access to the file attached to the file item
| date and time of the last access to the file attached to the file item
|-
|-
| rowspan="2" | !CHANGED
| rowspan="2" | <code>!CHANGED</code>
| <code>1<nowiki>|</nowiki>0</code>
| <code>a number >= 0</code>
| A value of 1 indicates that the file has been changed in memory and has not been saved yet. A value of 0 indicates that the file in memory is identical to that on disk.
| A value of 0 indicates that the file in memory is identical to that on disk. For all files except XML files, a value of 1 indicates that the file has been changed in memory and has not been saved yet. For XML files, the value may be greater than 1, and indicates the number of change operations which have been made since the last time the content was saved to disk.
|-
|-
| assigning <code>1</code> or <code>0</code>
| assigning <code>1</code> or <code>0</code>
| You may programmatically set, or reset, the value of the !CHANGED attribute by ''assigning'': <code>1</code>, or <code>0</code>, to this attribute:
| You may programmatically set, or reset, the value of the !CHANGED attribute by ''assigning'' <code>1</code>, or <code>0</code>, to this attribute:


  $#file[!changed] := 1    // set the attribute
  $#file[!changed] := 1    // set the attribute
Line 72: Line 86:
|}
|}


==Binary file item attributes==
== Binary file items ==


{|class="einrahmen"
{|class="einrahmen"
|-
|-
!Attribute
! Attribute
!Value(s) and Description
! Value(s)
! Description
|-
| rowspan="2" | <code>!BININFO</code>
| rowspan="2" | number of sections
| After a <code>LIST</code> command, <code>!BININFO</code> will return the index of the last  section loaded/saved.
|-
|-
|!BININFO
| After a <code>LOAD</code> command <code><nowiki>-</nowiki>1</code>, if the file is not a binary file, or the last command failed. <!-- ??? C.G.: What does that MEAN? -->
|number of sectionsAfter a LIST commandindex of last loaded/saved sectionAfter a LOAD command<nowiki>-</nowiki>1If the file is not a binary file, or the last command failed.
|}
|}


 
== GDX file items ==
 
==GDX file item attributes==


The GDX file item supports the following attributes in addition to the general file item attributes.
The GDX file item supports the following attributes in addition to the general file item attributes.


;<var>!DATA</var>
{|class="einrahmen"
 
!Attribute
:The <code>!DATA</code> attribute returns data from the GDX file.
! colspan="2" | Value(s) and Description
 
|-
:<code>$#gdx[!DATA] // returns all the data</code>
|<code>!DATA</code>
 
|The <code>!DATA</code> attribute returns data from the GDX file.
:<code>$#gdx[!DATA,index,count] // returns one or more columns</code>
$#gdx[!DATA] // returns all the data
 
$#gdx[!DATA,index,count] // returns one or more columns
:<code>index</code> determines the first column, and <code>count</code> the number of columns to return.
Here the <code>index</code> argument determines the first column, and the <code>count</code> argument determines the number of columns to return.
 
|-
;<var>!DATATYPE</var>
|<code>!DATATYPE</code>
 
|The <code>!DATATYPE</code> attribute returns the data type of this GDX file (See [[Programmer Guide/Shell Items/File/NEW FILE|Creating a GDX file]] for details).
:The !DATATYPE attribute returns the data type of this GDX file (See [[Programmer Guide/Shell Items/File/NEW FILE|Creating a GDX file]] for details).
|-
 
|<code>!NCOL</code>
;<var>!NCOL</var>
|The <code>!NCOL</code> attribute returns the number of columns.
|-
|<code>!NROW</code>
|The <code>!NROW</code> attribute returns the number of rows.
|-
|<code>!NWRITTEN</code>
|The <code>!NWRITTEN</code> attribute returns the number of columns which have been written (rather than defined).
|}


:The <code>!NCOL</code> attribute returns the number of columns.
== XML file items ==


;<var>!NROW</var>
=== General attributes of XML file items ===
 
:The <code>!NROW</code> attribute returns the number of rows.
 
;<var>!NWRITTEN</var>
 
:The <code>!NWRITTEN</code> attribute returns the number of columns which have been written (rather than defined).
 
==XML file item attributes==
 
===General attributes of XML file items===


{|class="einrahmen"
{|class="einrahmen"
Line 124: Line 137:
! Description
! Description
|-
|-
| !XROOT
| <code>!XROOT</code>
| <var>root_element_nametag</var>
| <var>root_element_nametag</var>
| name of the root element
| name of the root element
|-
|-
| !XPARENT
| <code>!XPARENT</code>
| <var>parent_element_nametag</var>
| <var>parent_element_nametag</var>
| name of the parent element
| name of the parent element
|-
|-
| !XPARENTPATH
| <code>!XPARENTPATH</code>
| <var>root_element_name\&hellip;\parent_element_name</var>
| <var>root_element_name\&hellip;\parent_element_name</var>
| full path of the parent element
| full path of the parent element
|-
|-
| !XELEMENTS
| <code>!XELEMENTS</code>
| <var>elementcountnumber</var>
| <var>elementcountnumber</var>
| of elements on selected element level
| of elements on selected element level
|-
|-
| !XNODETYPE
| <code>!XNODETYPE</code>
| <code>ELEMENT|COMMENT|PROC|DOCTYPE</code>
| <code>ELEMENT&#124;COMMENT&#124;PROC&#124;DOCTYPE</code>
| type of the selected node
| type of the selected node
|}
|}


===Attributes of the selected element of a XML file item===
=== Attributes of the selected element of an XML file item ===


{|class="einrahmen"
{|class="einrahmen"
Line 152: Line 165:
! Value(s) and Description
! Value(s) and Description
|-
|-
| rowspan="9" | !XALL
| rowspan="9" | <code>!XALL</code>
|
|
|-
|-
Line 170: Line 183:
| <var>nattr</var> || number of attributes
| <var>nattr</var> || number of attributes
|-
|-
| <var>attr0</var>,&hellip; || name of attribute 0, ... (0 to <var>nattr</var>-1)
| <var>attr<sub>0</sub></var>,&hellip; || name of attribute 0, &hellip; (0 to <var>nattr</var>-1)
|-
|-
| !XTAG
| <code>!XTAG</code>
|<nowiki>-</nowiki>
|<nowiki>-</nowiki>
|element_tag
|element_tag
|-
|-
| !XATTRIBUTES
| <code>!XATTRIBUTES</code>
|<nowiki>-</nowiki>
|<nowiki>-</nowiki>
|number_of_attributes
|number_of_attributes
|-
|-
| !XATTRIBUTE
| <code>!XATTRIBUTE</code>
|<var>index</var>
|<var>index</var>
|attribute_name name of attribute number <var>index</var>
|attribute_name name of attribute number <var>index</var>
|-
|-
| !XATTRIBUTE
| <code>!XATTRIBUTE</code>
|<var>name</var>
|<var>name</var>
|attribute_value value of attribute named <var>name</var>
|attribute_value value of attribute named <var>name</var>
|-
|-
| !XEMPTY
| <code>!XEMPTY</code>
|<nowiki>-</nowiki>
|<nowiki>-</nowiki>
|returns 1 if element is empty (no data) and 0 otherwise
|returns 1 if element is empty (no data) and 0 otherwise
|-
|-
| !XCDATA
| <code>!XCDATA</code>
|<nowiki>-</nowiki>
|<nowiki>-</nowiki>
|returns 1 if element contains a CData section and 0 otherwise
|returns 1 if element contains a CData section and 0 otherwise
|-
|-
| !XCHILDS or !XCHILDREN
| <code>!XCHILDS</code> or <code>!XCHILDREN</code>
|<nowiki>-</nowiki>
|<nowiki>-</nowiki>
|returns number of child elements of the selected element
|returns number of child elements of the selected element
|-
|-
| !XSIZE
| <code>!XSIZE</code>
|<nowiki>-</nowiki>
|<nowiki>-</nowiki>
|size of data section in characters
|size of data section in characters
|-
|-
| !XDATA
| <code>!XDATA</code>
|<nowiki>-</nowiki>
|<nowiki>-</nowiki>
|content of data section
|content of data section
|}
|}


==XML file item document/element type definition attributes==
=== Document/element type definition attributes of an XML file item ===


{|class="einrahmen"
{|class="einrahmen"
Line 217: Line 230:
!Value(s) and Description
!Value(s) and Description
|-
|-
|!XDTNAME
|<code>!XDTNAME</code>
|<nowiki>-</nowiki>
|<nowiki>-</nowiki>
|<nowiki>-</nowiki>
|<nowiki>-</nowiki>
|name of document type definition
|name of document type definition
|-
|-
|!XDTROOT
|<code>!XDTROOT</code>
|<nowiki>-</nowiki>
|<nowiki>-</nowiki>
|<nowiki>-</nowiki>
|<nowiki>-</nowiki>
|tag of root element
|tag of root element
|-
|-
|!XDTELEMENTS
|<code>!XDTELEMENTS</code>
|<nowiki>-</nowiki>
|<nowiki>-</nowiki>
|<nowiki>-</nowiki>
|<nowiki>-</nowiki>
|number of defined element types
|number of defined element types
|-
|-
|!XDTELEMENT
|<code>!XDTELEMENT</code>
|index or tag
|<var>index</var> or <var>tag</var>
|<nowiki>-</nowiki>
|<nowiki>-</nowiki>
|definition of element type with specified index or tag; the result is
|definition of element type with specified index or tag; the result is
Line 241: Line 254:
|-
|-
|parent
|parent
|parent element tag or *
|parent element tag or <code>*</code>
|-
|-
|base
|base
|base element tag or *
|base element tag or <code>*</code>
|-
|-
|nobase
|nobase
|nobase element tag or *
|nobase element tag or <code>*</code>
|-
|-
|data
|data
|data type name or *
|data type name or <code>*</code>
|}
|}
|-
|-
|!XDTCHILDREN
|<code>!XDTCHILDREN</code>
|tag
|<var>tag</var>
|<nowiki>-</nowiki>
|<nowiki>-</nowiki>
|number of children defined for element tag
|number of children defined for element tag
|-
|-
|!XDTCHILD
|<code>!XDTCHILD</code>
|tag
|<var>tag</var>
|cindex or ctag
|cindex or ctag
|definition of child cindex or ctag of the element tag. The result is:ctag min maxwith:
|definition of child cindex or ctag of the element tag. The result is:ctag min maxwith:
Line 265: Line 278:
! ctag !! tag of child element
! ctag !! tag of child element
|-
|-
|min
|<var>min</var>
|number of minimum occurrences
|number of minimum occurrences
|-
|-
|max
|<var>max</var>
|number of maximum occurrences or <nowiki>-</nowiki>1 if not defined
|number of maximum occurrences or <nowiki>-</nowiki>1 if not defined
|}
|}
|-
|-
|!XDTATTRIBUTES
|<code>!XDTATTRIBUTES</code>
|tag
|<var>tag</var>
|<nowiki>-</nowiki>
|<nowiki>-</nowiki>
|number of attributes defined for element tag
|number of attributes defined for element tag
|-
|-
|!XTDATTRIBUTE
|<code>!XTDATTRIBUTE</code>
|tag
|tag
|aindex or aname
|<var>aindex</var> or <var>aname</var>
|definition of attribute aindex or aname of element tag. The result is:aname req vis val type paramswith:
|definition of attribute aindex or aname of element tag. The result is:aname req vis val type paramswith:
{|
{|
Line 294: Line 307:
|-
|-
|type
|type
|attribute value type (INTEGER, NUMBER, STRING, VALUELIST)
|attribute value type (<code>INTEGER</code>, <code>NUMBER</code>, <code>STRING</code>, <code>VALUELIST</code>)
|-
|-
|params
|params
|parameters, depends on type{|
|parameters, depends on type{|
|-
|-
|INTEGER
|<code>INTEGER</code>
|minval<nowiki>|</nowiki>* maxval|*
|<code><var>minval</var><nowiki>|</nowiki>* <var>maxval</var><nowiki>|</nowiki>*</code>
|-
|-
|NUMBER
|<code>NUMBER</code>
|minval<nowiki>|</nowiki>* maxval|*
|<code><var>minval</var><nowiki>|</nowiki>* <var>maxval</var><nowiki>|</nowiki>*</code>
|-
|-
|STRING
|<code>STRING</code>
|unique{0<nowiki>|</nowiki>1} respect{0|1}
|unique{0<nowiki>|</nowiki>1} respect{0<nowiki>|</nowiki>1}
|-
|-
|VALUELIST
|<code>VALUELIST</code>
|value1 value2 ...
|<code>value1 value2 &hellip;</code>
|}
|}
|-
|-
| !XDTISA
| <code>!XDTISA</code>
| <var>tag</var>
| <var>tag</var>
| none
| none
| returns <code>1</code> if the selected element of the file item is of type <var>tag</var> or is derived from <var>tag</var> and <code>0</code> otherwise
| returns <code>1</code> if the selected element of the file item is of type <var>tag</var> or is derived from <var>tag</var> and <code>0</code> otherwise
|}
|}

Latest revision as of 12:15, 10 April 2018

File Item
INTRODUCING NEW SET ATTRIBUTES EXAMPLES

The following file item attributes can be queried in the format $#fileItem[Attribute].

Common file item attributes

Attribute Value(s) and Description
!PATH full path of the file attached to the respective file item
!UNCPATH full path of the file attached to the respective file item in UNC format
!DRIVE the drive letter of the file attached to the respective file item (without a colon)
!DIRECTORY the directory of the file attached to the respective file item (without a trailing backslash)
!UNCDIRECTORY the directory of the file attached to the respective file item (without a trailing backslash) in UNC format
!NAME the name of file attached to the respective file item
!EXTENSION extension part of the filename of the file attached to the respective file item (without a leading ".")
!FILENAME name and extension of the file
!CREATED yyyy.mm.dd hh.mm.ss creation date and time of file attached to the file item
!MODIFIED yyyy.mm.dd hh.mm.ss time of last modification of file attached to the file item
!MTSTAMP modmin time of last modification in minutes since 1st January 1980
!ATTRIBUTES DIRECTORY|SYSTEM|HIDDEN|NORMAL type attributes of file attached to the file item
!ACCESS READ|WRITE|APPEND access attributes of file attached to the file item
!SIZE filesize size of file attached to the file item in bytes
!TYPE FILE|LIST|TEXT|SECTION|XML type of file item (set in NEW command)
!SHELL owner shellidid of shell creating the file item (8 hex digits)
!USERS numusers number of linked items sharing the file item
!LASTACCESS yyyy.mm.dd hh.mm.ss date and time of the last access to the file attached to the file item
!CHANGED a number >= 0 A value of 0 indicates that the file in memory is identical to that on disk. For all files except XML files, a value of 1 indicates that the file has been changed in memory and has not been saved yet. For XML files, the value may be greater than 1, and indicates the number of change operations which have been made since the last time the content was saved to disk.
assigning 1 or 0 You may programmatically set, or reset, the value of the !CHANGED attribute by assigning 1, or 0, to this attribute:
$#file[!changed] := 1    // set the attribute
$#file[!changed] := 0    // reset the attribute

Warning: this functionality changed in version 3.9.0. Previously, setting the attribute using '1' would reset the attribute, and using the value '0' was unsupported.

Binary file items

Attribute Value(s) Description
!BININFO number of sections After a LIST command, !BININFO will return the index of the last section loaded/saved.
After a LOAD command -1, if the file is not a binary file, or the last command failed.

GDX file items

The GDX file item supports the following attributes in addition to the general file item attributes.

Attribute Value(s) and Description
!DATA The !DATA attribute returns data from the GDX file.
$#gdx[!DATA] // returns all the data
$#gdx[!DATA,index,count] // returns one or more columns

Here the index argument determines the first column, and the count argument determines the number of columns to return.

!DATATYPE The !DATATYPE attribute returns the data type of this GDX file (See Creating a GDX file for details).
!NCOL The !NCOL attribute returns the number of columns.
!NROW The !NROW attribute returns the number of rows.
!NWRITTEN The !NWRITTEN attribute returns the number of columns which have been written (rather than defined).

XML file items

General attributes of XML file items

Attribute Value(s) Description
!XROOT root_element_nametag name of the root element
!XPARENT parent_element_nametag name of the parent element
!XPARENTPATH root_element_name\…\parent_element_name full path of the parent element
!XELEMENTS elementcountnumber of elements on selected element level
!XNODETYPE ELEMENT|COMMENT|PROC|DOCTYPE type of the selected node

Attributes of the selected element of an XML file item

Attribute Argument Value(s) and Description
!XALL
  a list of all element parts
tag element tag name
empty 1 if element data is empty, 0 otherwise
cdata 1 if element data is a CData-section, 0 otherwise
childs number of child elements
size size of data section (characters)
nattr number of attributes
attr0,… name of attribute 0, … (0 to nattr-1)
!XTAG - element_tag
!XATTRIBUTES - number_of_attributes
!XATTRIBUTE index attribute_name name of attribute number index
!XATTRIBUTE name attribute_value value of attribute named name
!XEMPTY - returns 1 if element is empty (no data) and 0 otherwise
!XCDATA - returns 1 if element contains a CData section and 0 otherwise
!XCHILDS or !XCHILDREN - returns number of child elements of the selected element
!XSIZE - size of data section in characters
!XDATA - content of data section

Document/element type definition attributes of an XML file item

Attribute-Id Sub-Id 1 Sub-Id 2 Value(s) and Description
!XDTNAME - - name of document type definition
!XDTROOT - - tag of root element
!XDTELEMENTS - - number of defined element types
!XDTELEMENT index or tag - definition of element type with specified index or tag; the result is

tag parent base nobase data with:

tag element tag
parent parent element tag or *
base base element tag or *
nobase nobase element tag or *
data data type name or *
!XDTCHILDREN tag - number of children defined for element tag
!XDTCHILD tag cindex or ctag definition of child cindex or ctag of the element tag. The result is:ctag min maxwith:
ctag tag of child element
min number of minimum occurrences
max number of maximum occurrences or -1 if not defined
!XDTATTRIBUTES tag - number of attributes defined for element tag
!XTDATTRIBUTE tag aindex or aname definition of attribute aindex or aname of element tag. The result is:aname req vis val type paramswith:
aname name of attribute
req required flag (0=no, 1=yes)
vis visibility flag (0=hidden, 1=value, 2=name and value)
val default value of * if not set
type attribute value type (INTEGER, NUMBER, STRING, VALUELIST)
params
INTEGER minval|* maxval|*
NUMBER minval|* maxval|*
STRING unique{0|1} respect{0|1}
VALUELIST value1 value2 …
!XDTISA tag none returns 1 if the selected element of the file item is of type tag or is derived from tag and 0 otherwise

Navigation menu

Personal tools