AFinScript functions: | |
Function | Short description |
GETDATAODBC | Get data from every ODBC database |
GETDATAJSON | Get data from a JSON string or its specified part in text file (JSON file) or web page |
GETDATAXML | Get data from a XML string or its specified part in text file (XML file) or web page |
GETDATATEXT | Get data from ANY text: html (local or internet), txt (local or internet), MS Word |
GETDATAGSHEETS | Get data from an open worksheet on Google Sheets |
GETEXCELVALUE | Get data from Excel file |
GETHTMLTABLE | Get data from specified html table |
GETVAR | Many ways to use - see details |
GETTRANSLATION | Translate phrases within function (It uses Google Translator) |
GETDATAFSO | Get info about files and folders using a standard File System Object |
GETUNREADMAIL | The simply access to your mailbox |
GETFROMSHELL | It performs(!) the Windows Shell command and shows its result as a value. |
GETDATAWMI | Access to Windows Management Instrumentation (WMI) data |
VAL2TEXT / SŁOWNIE | Number as a text |
KURS_NBP | Polish National Bank's foreign currency rates |
URLENCODE(strURL), URLDECODE(strURL) | |
IsUserAnAdmin() | |
Function specification | |
Function example(s) | Function value |
GETTRANSLATION(lsText; lsLangFrom; lsLangTo) | |
GETTRANSLATION("I like AfinScript";"EN";"PL") | Lubię AfinScript.... |
VAL2STR(ldValue; lsLanguage; lsCurrency; lsCentsString; lbThreeLetters) | |
SŁOWNIE(ldValue; lsLanguage; lsCurrency; lsCentsString; lbThreeLetters) | |
VAL2STR(1234,56;"pl") | Jeden tysiąc dwieście trzydzieści cztery złote 56/100 |
VAL2STR(1234,56;"en";"EUR") | One thousand two hundred thirty four EUR 56/100 |
VAL2STR(1234,56;"en";"EUR";"cts") | One thousand two hundred thirty four EUR 56cts |
VAL2STR(1234,56;"en";;;1) | ONE#TWO#THR#FOU#56/100 |
KURS_NBP(Waluta; Data) | (Function in Polish, because it is specified to Polish National Bank (NBP)) |
KURS_NBP("EUR"; "2017-01-10") | 4,3735 |
GETEXCELVALUE(lsWbkName, lsShtName, lsRngAddr) | (This function can be used in a single-cell- or table- form.) |
GETEXCELVALUE("C:\AnyPath\ExcelWbk";"Sheet1";"A1:B10") | (The content of specified range) |
GETDATAODBC(ConnStr; Sql) | (This function can be used in a single-cell- or table- form.) |
GETDATAODBC("DSN=Excel files; DBQ=C:\AnyPath\MyWorkbook.xlsx"; "SELECT COUNT(*) FROM [Sheet1$]") | 5 |
GETDATAODBC("C:\AnyPath\MyAccessDB.accdb"; "SELECT ContactName FROM [tblUsefulApps] WHERE Company='AFIN' ") | Wojciech |
GETDATAJSON(myUrl; myReturn) | |
GETDATAJSON("http://api.nbp.pl/api/exchangerates/rates/c/usd/2016-04-04/?format=json") | {"table":"C","currency":"dolar amerykański","code":"USD","rates":[{"no":"064/C/NBP/2016","effectiveDate":"2016-04-04","bid":3.6929,"ask":3.7675}]} |
GETDATAJSON("http://api.nbp.pl/api/exchangerates/rates/c/usd/2016-04-04/?format=json";"rates[0].bid") | 3,6929 |
GETDATAXML(myUrl; myXPath) | (This function can be used in a single-cell- or table- form.) |
GETDATAXML("http://api.nbp.pl/api/exchangerates/rates/c/usd/2016-04-04/?format=xml") | <?xml version="1.0" encoding="utf-8"?><ExchangeRatesSeries xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><Table>C</Table><Currency>dolar amerykański</Currency><Code>USD</Code><Rates><Rate><No>064/C/NBP/2016</No><EffectiveDate>2016-04-04</EffectiveDate><Bid>3.6929</Bid><Ask>3.7675</Ask></Rate></Rates></ExchangeRatesSeries> |
GETDATAXML("http://api.nbp.pl/api/exchangerates/rates/c/usd/2016-04-04/?format=xml";"//Rate/Bid") | 1836866 |
GETDATAXML("http://www.afin.net/samples/Data/ODBC/SalesInHTML/HTML1.html";"//html/body/table/tr[0]/td[1]/a[1]") | url2-1 |
GETDATATEXT(lsTextSource; lsPatternToRemoveBefore; lsPatternToMatch; lsPatternToRemoveAfter) |
(This function can be used in a
single-cell- or table- form. If a reaturn value is a table value AND ITS SIZE IS GREATER then a caller table (table formula or single cell formula) it returns values like "{value} #Tbl!". This is not the error.) |
GETDATATEXT("http://www.afin.net/samples/Data/ODBC/SalesInHTML/HTML1.html";"";">[a-zA-Z0-9]*[^<>]<") | (table function - table
value) {">url1<";">url2<";">url3<"} |
GETDATATEXT("http://www.afin.net/samples/Data/ODBC/SalesInHTML/Faktura.htm";"";">.*A.*X<") | (table function - table
value) {">AREX<";">JARIMPEX<";">HANIMPEX<";">DAREX<";">FRANEX<";">ANEX<";">SIANEX<"} |
GETDATATEXT("http://www.afin.net/samples/Data/ODBC/SalesInHTML/Faktura.htm";"";">\d\d\d\d-\d\d-\d\d<") | (table function - table
value) {">2004-01-03<";">2004-01-24<";">2004-02-03<";">2004-02-24<";">2004-03-03<";">2004-03-24<";">2004-04-03<";">2004-04-24<";">2004-05-03<";">2004-05-24<";">2004-06-03<";">2004-06-24<";">2004-07-03<";">2004-07-24<";">2004-08-04<";">2004-09-04<";">2004-09-25<";">2004-10-04<";">2004-10-25<";">2004-11-04<";">2004-11-25<";">2004-12-04<";">2005-01-05<";">2005-01-26<";">2005-02-05<";">2005-02-26<";">2005-03-05<";">2005-03-26<";">2005-04-05<";">2005-04-26<";">2005-06-05<";">2005-07-05<";">2005-08-05<";">2005-08-26<"} |
450,00 zł | 450 |
Frequently used HTML tags to remove from HTML document: | |
HTML5 | <!(.|\s)*?> |
HTML tags | </?[a-z][a-z0-9]*[^<>]*> |
HTML comments | <!--(.|\s)*?--> |
HTML script tags | <script.*?</script> |
HTML stylesheets | <style.*?</style> |
all above together: | <!(.|\s)*?> </?[a-z][a-z0-9]*[^<>]*> <!--(.|\s)*?--> <script.*?</script> <style.*?</style> |
Specified HTML tag | <td> <[^<>]*> |
GETDATAGSHEETS(GoogleSheetId;SheetName;RangeAddress) | (This function can be used in a single-cell- or table- form.) |
{=GETDATAGSHEETS("1CXy8JGFeREFRKE9t9WiDn82xtXh32UxagJcL4RxRQ50";"Sheet1";"A1:C4")} | (table function - table value) {"I can read"\"from"\2;"Google"\"Sheets!!!"} |
GETDATAGSHEETS("1CXy8JGFeREFRKE9t9WiDn82xtXh32UxagJcL4RxRQ50";"Sheet1";"D5") | 5 |
GETDATAFSO(strFolder; [strFilter]) | (This function has the 1-dim (vertical) table form only.) |
{=GETDATAFSO("C:\MyFolder";".xlsx")} | |
Arguments: | |
strFolder (String) | Windows file system folder to search for files and (sub)folders |
strFilter (Optional, String, Default="") | A standard filter for array of results - The function looks up only for given string, no wildcards. |
GETUNREADMAIL(strAccount; [intMaxRows]; [blnIfReadToo]) | (This function has the 2-dim table form only.) |
{=GETUNREADMAIL("\\Outlook")} | |
Arguments: | |
strAccount (String) | The account of Outlook |
intMaxRows (Optional, Integer, Default=30) | Max number of last items for searching mailbox |
blnIfReadToo (Optional, Boolean, Default=0) | It indicates whether the function is to read all the mails (the read mails too) |
GETHTMLTABLE(lsUrl; liTableNo; liMode; lsPatternToRemoveAfter; li RowNo; liColno) | (This function can be used in a single-cell- or table- form.) |
{=GETHTMLTABLE("http://www.bankier.pl/gielda";2)} | |
Arguments: | |
liMode=1 (default) : MSXML2.XMLHTTP library, own AFinScript HTML table parser (the fastest) | |
liMode=2 : Using Dataset object | |
liMode=3 : Internet Explorer library, IE's HTML table parser (standard html objects) (problems) | |
liMode=4 : Standard HTML table parser - (in process) | |
lsPatternToRemove | Default REGEX pattern removed from every table cell: "<td> <[^<>]*> ". To avoid using this default say "!" as a first character. |
GETFROMSHELL(strShellCommand) | |
Arguments: | |
strShellCommand - standard Windows Shell command - it works as standard 'cmd.exe /c {command}' but the result is: 1) the command is performed(!!!) and 2) the result value of the command is the function value. Be careful. | |
GETFROMSHELL("dir") | |
GETFROMSHELL("ipconfig /all") | |
GETFROMSHELL("copy c:\path1\* c:\path2") | |
Remarks: | |
'FORMAT' and 'SHUTDOWN' commands are blocked by default. | |
GETDATAWMI(StrWQL; StrComputerName; BlnNullRows) | The function is used as the 3-columns table function |
Arguments: | |
strWQL - Standard Windows Query Language query - help and samples are to find on internet | |
strComputerName (optional) - name of computer to examine, current one if arg omited | |
blnNullRows - 0 - only non-null values, 1 - all rows | |
{=GETDATAWMI("SELECT * FROM Win32_Desktop";;0)} | |
{=GETDATAWMI("SELECT * FROM Win32_Process WHERE Caption='EXCEL.EXE' ";;1)} | |
Remarks: | |
The table function value is (may be) not relational data - eg many objects beeing checked and described are producing many rows for each object one under the another | |
GETVAR(WhatToGet) | |
Also read a topic: "AFinScript variables" | |
This function has many ways to use: | |
If you use VBA-like object's property specification, you get it as in VBA (the full list available from the vendor) - the main rule is as follows: VAR("ObjectName_PropertyName") returns the value of ObjectName.PropertyName | |
GETVAR("ActiveWorkbook_FullPath") | The full path to the active workbook (it can change) |
GETVAR("ThisWorkbook_Name") | The name of a workbook the function is calculated |
If you use AFinScriptDB, described in INI file, you can use any values from 'Parameters' table | |
GETVAR("MyPar1") | The value of MyPar1 specified in the table 'Parameters' in AFinScripDB |
GETVAR("MyPathToData_Laptop") | Full path to your data on your laptop |
If you use redirection to the system funcion 'ENVIRON' you can get value from it | |
GETVAR("environ:windir") | C:\WINDOWS |
There are also some variables returning the state of AFinScript (the full list available from the vendor) | |
GETVAR("RegisteredTo") | Name of the rigistrar/ date of expiration |
GETVAR("NextStartTime") | If you use the automatic restart of AFinScript, you can get the time |
If the
parameter is not listed in AFinScriptDB, not listed in any library specified
above - this becomes an "user parameter" and the user is beeing
forced to put the value while the function is calculated. This value is saved
while AFinScript is running. If you don't want the parameter to be saved, use "?" as its last char. If you want to hide characters while typing, use "!" as its last char. |
|
AFinScript variables | |
Also read a topic: "GETVAR function" | |
If you use the following text "{{MyPar1}} in any parameter of any data function, this means: This parameter replaces its text with the hidden value of the GETVAR() function. This is very useful to input user names, passwords, temporal parameters and so on. | |
If there is a "?" char at end of parameter's name, the value has to be inputted every time function is calculated or process is run. Useful to use "asked parameteres" - the user can change it every process run. To hide characters while typing, use "!" as the last char. | |