What field properties can I access via VB? (v8/7/6/5)


<< Working with MultiValue ( ...
Back to Portfolio FAQ index
Scripting Changes in Path ... >>

For a full list of members of the field object see the FAQ articles on the VB TLB.

The 'value' property is the actual value of that record, e.g. the value for the 'color mode' field of the record of an RGB image will be 3 although you see RGB displayed in the client UI.

Note that in v7 documentation, some of the data types have changed names: Integer is now Number, and String is now Text. The other type descriptions are unchanged

 Index#   Name   IsIndex   Type   IsCustom   IsMultiValue   IsPredefined   IsURL 
Field #1 Filename True 0 (String) False False False False
Field #2 Path False 0 (String) False False False False
Field #3 Extension Win ** True 0 (String) False False False False
Field #4 Short Filename Win True 0 (String) False False False False
Field #5 Description True 0 (String) False False False False
Field #6 Volume True 0 (String) False False False False
Field #7 Created True 3 (Date/Time) False False False False
Field #8 Last Modified True 3 (Date/Time) False False False False
Field #9 Cataloged True 3 (Date/Time) False False False False
Field #10 Last Updated True 3 (Date/Time) False False False False
Field #11 File Size True 1 (Integer) False False False False
Field #12 Keywords True 0 (String) False True False False
Field #13 Thumbnail False -26784 (or 99 from v8.0? onwards) False False False False
Field #14 Custom Thumbnail False -26952 (or 99 from v8.0? onwards) False False False False
Field #15 File Type Mac True 0 (String) False False False False
Field #16 Creator Mac True 0 (String) False False False False
Field #17 Alias Mac False -27456 (or 99 from v8.0? onwards) False False False False
Field #18 Zone Mac True 0 (String) False False False False
Field #19 Thumbnail Size True 1 (Integer) False False False False
Field #20 Color Mode True 1 (Integer) False False False False
Field #21 Horizontal Resolution True 2 (Decimal) False False False False
Field #22 Vertical Resolution True 2 (Decimal) False False False False
Field #23 Width True 1 (Integer) False False False False
Field #24 Height True 1 (Integer) False False False False
Field #25 Category True 1 (Integer) False True False False
Field #26 Number of Pages True 1 (Integer) False False False False
Field #27 Placeholder True 1 (Integer) False False False False
Field #28 Watermarked True 1 (Integer) False False False False
Field #29 Watermark URL True 4 (URL) False True False True
Fields below are only created in v6.x catalogues.
Field #30 FileStoreID True 1 (Integer) False False False False
Field #31 Directory Path True 0 (String) False False False False
Fields below are only created in v7.x catalogues.
Field #32 Item ID True 1 (Integer) False False False False
Field #33 Cataloged By True 0 (String) False False False False
Field #34 Changed By True 0 (String) False False False False
Fields below are only created in v8.0/8.1.x catalogues.
Field #35 FullyCataloged True 1 (Integer) False False False False
Field #36 CorruptFile True 1 (Integer) False False False False
Field #37 PartiallyRotated True 1 (Integer) False False False False
Fields below are only created in v8.5 catalogues.
Field #38 XMP False 99 False False False False
Fields below are only created in v8.x catalogues.
From here (or #37 for v8.0/1, #35 for v7, #32 for v6, #30 for v5) custom fields are then indexed in order of creation. In upgraded catalogues new standard schema fields will be added after existing custom fields.

** In v7.x "Extension win" was renamed "Extension". Also see the mapping list below.

Note that four of the fields give error codes (from ? v8.0 onward the error code is always '99'). The two thumbnail-related fields are BLOB-type (Binary Large OBject) fields storing image data but you cannot access them via the VB TLB (and, I suspect from AppleScript); the BLOBs can be accessed via custom VB code. If you have SQL Connect you should be able to access these assets via VB/SQL access methods.

Using AppleScript access, the equivalents of field #17 reports its name as "Mac Alias" and #30 as "FileStore ID" (note the space in the latter). Despite this, both accept the Win style names "Alias Mac" and "FileStoreID" which is worth noting if doing cross-platform work. Note also that AppleScript doesn't use the consistent built-in field numbering of windows - reported order varies from catalogue to catalogue. The likely cause of the different reported field names via scripting is indicated by the field.properties file in NetPublish which gives this look-up table (noting the absence FileStoreID and new post v8.0 built-in fields:
External (screen) Internal
-------- --------
Filename = Filename
Extension = Extension Win
Path = Path
Short Filename Win = Short Filename Win
Description = File Description
Volume = Volume
Created = Created
Modified = Last Modified
Cataloged = Cataloged
Changed = Last Updated
File Size = File Size
Keywords = Keywords
File Type Mac = Mac File Type
Creator Mac = Mac Creator
Alias Mac = Mac Alias
Zone Mac = Zone Mac
Thumbnail Size = Thumbnail Size
Color Mode = Color Mode
Horizontal Resolution = Horizontal Resolution
Vertical Resolution = Vertical Resolution
Width = Width
Height = Height
Category = Category
Number of Pages = MultipageCount
Placeholder = PlaceHolder
Watermarked = Watermarked
Watermark URL = WatermarkURL
Directory Path = Directory Path
Item ID = RID
Cataloged By = Cataloged By
Changed By = Updated By
Routed To = Routed To

Exporting field information
To generate the table above (including any custom fields in your catalogue) use this code:

Private Sub cmdFieldInfo_Click()
 
Dim i As Long
Dim lngCount As Long
 
lngCount = PortObj.Gallery(1).SelectedRecords(1).Count
MsgBox "Num Fields per Record = " & lngCount
 
' Following code prints name and properties of Record #1 of Gallery #1
For i = 1 To lngCount
Debug.Print "Field #" & i & " = "; PortObj.Gallery(1).AllRecords(1).Fields(i).Name & _
vbTab & PortObj.Gallery(1).AllRecords(1).Fields(i).IsIndexed & _
vbTab & PortObj.Gallery(1).AllRecords(1).Fields(i).Type & _
vbTab & PortObj.Gallery(1).AllRecords(1).Fields(i).IsCustom & _
vbTab & PortObj.Gallery(1).AllRecords(1).Fields(i).IsMultiValue & _
vbTab & PortObj.Gallery(1).AllRecords(1).Fields(i).IsPredefined & _
vbTab & PortObj.Gallery(1).AllRecords(1).Fields(i).IsURL
' & _
' Uncomment next line and end of line above to see actual field value as well
'vbTab & PortObj.Gallery(1).AllRecords(1).Fields(i).Value

Next

' see the RID of the current Record
Debug.Print PortObj.Gallery(1).AllRecords(1).RecordID
 
End Sub

Index Numbers of Custom Fields
In a default schema for v8.5 these start at #38 (or #37 for v8.0/1, #35 for v7, #32 for v6, #30 for v5) and are added in order of creation. Some client dialogs (e.g. Customise Gallery) list the fields in alphabetical orders, others by creation order (Import Field Values). If a custom field is deleted, all indexes shift down by one (or more).

So, although you can rely on the first custom field being #32 you cannot predict that the third created field will always be #34 unless you have total control of additions/deletions of custom fields. The easiest way to see the creation order without resorting to use of VB is to open the Import Field Values dialog.

Catalogues updated after custom field creation add the new built-in fields after existing custom fields. From v8.5, the use of custom arranged schema will make use of field index numbers dangerous except when looping through the whole field collection.

Colour Modes
The colour mode codes are:

0 = Unknown
1 = Black & White
2 = Greyscale
3 = RGB
4 = CMYK
5 = YUV (TIFF; also known as YCbCr)
6 = Lab
7 = YCCK (JPEG)

These codes are listed on page 178 of the v5 manual but were omitted entirely from the v6 manual & since. They are not listed in any of the VB or AS documentation.

Note there is a bug whereby if the colour mode is unknown or not read by the cataloguing filter the 'color mode' value for that record is empty, i.e. not 0 (zero) gives a match against an empty string, e.g. "". Rather strange! Such values, if exported to text are exported as null values. This bug exists in both v5 and v6 (last tested with v6.01).

To see this effect for yourself, use this code:

If PortObj.Gallery(1).AllRecords(1).Field("Color Mode").Value = "" Then
   MsgBox "It is an empty string"
End If
If PortObj.Gallery(1).AllRecords(1).Field("Color Mode").Value = vbNull Then
   MsgBox "It is Null"
End If
Debug.Print PortObj.Gallery(1).AllRecords(1).Field("Color Mode").Name & _
   " = [" & PortObj.Gallery(1).AllRecords(1).Field("Color Mode").Value & "]"

Placeholders
A placeholder field value for record created via normal cataloguing is empty, i.e. not 0 (zero) and gives a match against an empty string, e.g. "". For records originally created as Placeholders you get these values:

0 = populated (i.e. now a proper working record)
1 = placeholder

Thus the 'null' field condition can be used to test for whether a record was originally a placeholder or not. You can test this out by using the Color Mode test code above substituting "Placeholder" for "Color Mode".



Question: What field properties can I access via VB? (v8/7/6/5) [FAQ00252.htm]
Last Update:- 09 August 2011


<< Working with MultiValue ( ...
Back to Portfolio FAQ index
Scripting Changes in Path ... >>

Quick Search of PortfolioFAQ (word, words or phase): or try the Advanced Search

User-to-User Forums  |  Report error/typo/broken link  |  Request new topic  |  Ask a question

Site and articles © Mark Anderson 2001-2007 - Visit my home page


This FAQ is created and maintained using
Friday logo
Friday - The Automatic FAQ Maker