FLAT
4D Library
FLAT is a free 4D code library that allows you to perform quick lookups within external text data files. This is a helpful capability when your application is monitoring external data sources that are updated outside of your control. It can also be used instead of implementing static lookup tables and importing lookup data into your database.
Example: Return the "Close" price from a file containing the data below:
Cell_T:=FLAT_GetCellDataFromFile(PathToFile;"Date";"2-May-05";"Close";",")
Where:
- PathToFile is the path to the external document
- "Date" is the name of the column that you are using as the query key field
- "2-May-05" is the value in the "Date" column that keys the row you wish to retrieve data from
- "Close" is the name of the column that you wish to retrieve data from
- "," is the data delimiter {optional - TAB is default}
After this call the variable Cell_T will contain the value "1191.5"
Example data file content for the above example:
Date,Open,High,Low,Close,Volume,Adj. Close*
3-Oct-05,1228.81,1233.34,1168.2,1179.59,25296306,1179.59
1-Sep-05,1220.33,1243.13,1205.35,1228.81,22321442,1228.81
1-Aug-05,1234.18,1245.86,1201.07,1220.33,19302434,1220.33
1-Jul-05,1191.33,1245.15,1183.55,1234.18,19609400,1234.18
1-Jun-05,1191.5,1219.59,1188.3,1191.33,19292513,1191.33
2-May-05,1156.85,1199.56,1146.18,1191.5,19601271,1191.5
1-Apr-05,1180.59,1191.88,1136.15,1156.85,21803157,1156.85
1-Mar-05,1203.6,1229.11,1163.69,1180.59,18740172,1180.59
1-Feb-05,1181.27,1212.44,1180.95,1203.6,16364678,1203.6
3-Jan-05,1211.92,1217.8,1163.75,1181.27,16589300,1181.27
1-Dec-04,1173.78,1217.33,1173.78,1211.92,14494363,1211.92
1-Nov-04,1130.2,1188.46,1127.6,1173.82,15244657,1173.82
1-Oct-04,1114.58,1142.05,1090.29,1130.2,15719904,1130.2
1-Sep-04,1104.24,1131.54,1099.18,1114.58,13608509,1114.58
2-Aug-04,1101.72,1109.68,1060.72,1104.24,12602272,1104.24
1-Jul-04,1140.84,1140.84,1078.78,1101.72,14563714,1101.72
1-Jun-04,1120.68,1146.34,1113.32,1140.84,13811095,1140.84
3-May-04,1107.3,1127.74,1076.32,1120.68,15249500,1120.68
1-Apr-04,1126.21,1150.57,1107.23,1107.3,15831714,1107.3
1-Mar-04,1144.94,1163.23,1087.16,1126.21,15286347,1126.21
2-Feb-04,1131.13,1158.98,1124.44,1144.94,15540000,1144.94
2-Jan-04,1111.92,1155.38,1105.08,1131.13,17227500,1131.13
1-Dec-03,1058.2,1112.56,1053.41,1111.92,13121195,1111.92
3-Nov-03,1050.71,1063.65,1031.2,1058.2,13131810,1058.2
1-Oct-03,995.97,1053.79,995.97,1050.71,14694521,1050.71
Note: In large external text data sources, this code can be slow due to the nature of blob parsing. In interpreted databases this code will execute considerably slower than compiled.
FLAT is provided free of charge.
Click here to download a .zip file containing the Windows interpreted 4D 2003 database.
Click here to download a .zip file containing the Macintosh interpreted 4D 2003 database.
Please refer all questions/comments/requests to Nufocus Inc. at support@nufocusinc.com.