File System: Difference between revisions

From Starfish ETL
Jump to navigation Jump to search
No edit summary
No edit summary
Line 20: Line 20:


First, create a Before Each Row VBScript Operation which loads the chunk of JSON into the parser:
First, create a Before Each Row VBScript Operation which loads the chunk of JSON into the parser:
<source lang="vbscript">
<source lang="vb">
Sub VBScriptProcedure
Sub VBScriptProcedure
                 ParseJSON("@@ORG:ExtendedProperties@@")
                 ParseJSON("@@ORG:ExtendedProperties@@")
Line 26: Line 26:
</source>
</source>
Then on your field, pull out the value you want by name..
Then on your field, pull out the value you want by name..
<source lang="vbscript">
<source lang="vb">
Function ScriptedField   
Function ScriptedField   
                 ScriptedField=GetJSON("Authors")
                 ScriptedField=GetJSON("Authors")
End Function
End Function
</source>
</source>
<source lang="vbscript">
<source lang="vb">
Function ScriptedField   
Function ScriptedField   
                 ScriptedField=GetJSON("Title")
                 ScriptedField=GetJSON("Title")

Revision as of 17:02, 29 May 2015

The File System Connector reads all files from a folder specified in the Directory field. The Username and Password fields are not used. Filter can be used to filter for certain file names/extensions. To search for all files with an extension of "txt, use the filter "*.txt". To search for all files with "Work" anywhere in the filename, use the filter "*Work*"

The Connector returns standard data in the first 12 fields returned:

  • CreationTime
  • FullDirectoryName
  • DirectoryRelative
  • DirectoryName
  • Extension
  • FullName
  • IsReadOnly
  • LastAccessTime
  • LastWriteTime
  • Length
  • Name
  • LastWriteTime

The Connector returns all information available for the File in json format in the ExtendedProperties field. Rather than add a column for each potential property, we went with a more dynamic method of using one column called “ExtenededProperties” and formatted the data as JSON.

It’s very easy to parse this and then pull out the data you need in Starfish.

First, create a Before Each Row VBScript Operation which loads the chunk of JSON into the parser:

Sub VBScriptProcedure
                ParseJSON("@@ORG:ExtendedProperties@@")
End Sub

Then on your field, pull out the value you want by name..

Function ScriptedField   
                ScriptedField=GetJSON("Authors")
End Function
Function ScriptedField   
                ScriptedField=GetJSON("Title")
End Function

etc.. If a value doesn’t exist for a particular file it’ll just return “”.