{@if("__SensorExec__"="true",now(),"")}
{@if(getSystemValue("DevelopmentMode"),fileModified(getToken("homedir")+"cache\WidgetEdit_S2SrVX9bnCUfDoFnKk3ZWQww_Federal Reserve Data.html"),"")}
Federal Reserve Data,collectionZ1FieldDescriptions,sensor_list,Sensor=collectionZ1FieldDescriptions,private,text
Federal Reserve Data,openFedZ1Table,sensor_list,Sensor=openFedZ1Table,private,text
[!------------------------------------------------------------------------
collectionZ1FieldDescriptions
--------------------------------------------------------------------------]
Creates a collection of z1 field descriptions by reading the data dictionary files
downloaded from the federal reserve
None
System driver containing the collection
[!------------------------------------------------------------------------
openFedZ1Table
--------------------------------------------------------------------------]
Opens the Investing_FED_Nonfinancial_Debt for a given table ID. This sensor reads the field
descriptions from the corresponding data_dictionary file and adds fields to the structure
on the fly. This allows a single dummy structure to be used to read all of the tables.
TableID - ID of the table (e.g. b101 or f2). These correspond to the ID's in the
Investing_List_of_Z1_Financial_Accounts_of_the_US_tables driver but do not include the
periods.
ExtendFieldName - If true, the sort order is prepended to the field name using pipes
as delimiters. This is used when the driver is included in a transposed dimensional driver.
System driver
0)
sFieldID=left(s,p)
sFieldID=replaceSubstring(sFieldID,".","_")
sFieldID=sFieldID+"_"+n
sFieldName=mid(s,p+1)
sFieldName=replaceSubstring(sFieldName,",","\,")
sFieldName=removeChar(sFieldName,char(0x3B))
sFieldName=removeChar(sFieldName,":")
if("__ExtendFieldName__"="true")
//add quarterly / yearly
if(bIsQuarterly)
sFieldName="Quarterly|"+sFieldName
else
sFieldName="Yearly|"+sFieldName
endif
sFieldName=sFieldID+"|"+sFieldName
//add sort order
sFieldName=n+"|"+sFieldName
endif
sAttr="Description="+sFieldName
sAttr=addElement(sAttr,"FieldType=Number")
sAttr=addElement(sAttr,"Formula=value(getElement(Content\,"+(n+1)+"))")
sAttr=addElement(sAttr,"FormatPattern=###|###|###|###|###")
driverAddField(d,sFieldID,sAttr)
//appendToLog("Add Field: "+sFieldID+char(9)+sFieldName)
endif
n++
endwhile
//filter the driver
//driverClearCache(d)
driverSetFilter(d,"true",true)
appendToLog("Record count="+driverGetRecordCount(d,false)+" / "+driverGetRecordCount(d,true))
driverExportStruct(d,"c:\temp\2020-10\driverstruct.csv")
return(d)
">