This javascrip functions run in server (database host). It a part of VX+
It used in Webpage HTM to connect from Remote to Database in Server VX+.
You can used all javascrip functions in webpage htm and some add javascript functions by VX+ :
To using this add javascript functions you need insert script vx.js to header of you webpage htm, like:
<head>
<script src="../sys/vx.js" type="text/javascript"> </script>
</head>
Add Javascrip Functions in vx.js:
1. Basic Javascrip functions in vx.js:
* Importal, this javascript functions not need connect to webserver.
- encodeUtf8(b) - Convert utf-8 string b to html
- myDate(idObj) - Return now date to id object
- nowDate() - Return now date
- nowTime() - Return now time
- openTab(htmPage) - Open new blank tab htmlPage
form functions/ file / folder and print:
- uploadFile(subdir) - Upload files to Subdir on server.
- extractFileName(pathname) - Extract File Name from Pathname
- getDir(subdir,tar) - Get file list in subdir to IFrame.
- getLink(filename) - Create Link from Filename
- printDiv(idDiv,toTarget,bimg) - Print Div (IdDiv is Div Name) to Target with Background Image.
totarget : ( _top,_blank.VX+) or name of iFrame. Bimg is link url to file image (.bmp,.png,.jpg) .
tag, number, str:
- saveDoc(idDiv) - Write a DIV to MYDOC
- numberedGet(serial,idObj) - Get order and return result to idObj
- extractTag(tag,str) - Extract str bettewn 2 tag, example str= <0> abc 0> and function extractTag('0',str) = abc
- formatNum(num) - Create format for a number. Example formatNum(123000.12) = 123,000.12
- stringToNum(str) - Create a number from a str. Example stringToNum('123,000.12') = 123000.12
Cookie functions:
- setCookie(cname, cvalue, exdays) - Set Cname with Cvalue to Cookie.
- getCookie(cname) - Get Cname of cookie.
- saveSet(username,password) - To save Username and Password to Cookie when login.
- getHtmlDiv(idDiv,myvar) - Get context of Div.
- getHtmlFrame(idFrame) - Get context of Iframe.
- putHtmlDiv(idDiv,str) - Assign Str to idDiv.
- putHtmlIFrame(idFrame,str) - Assign Str to idFrame.
- showElement(element) - Show element- hideElement(element) - Hide element - replicate(s,n) - Repeat a Str with n number of times.
- dotSpace(value,n) - Create n dot space.
- dotSpaceBr(value,n) - Change dot to n space.
- underStr(value,n) - Change underline symbol to string.
2. Basic Ajax javascrip functions using in Webpage to connect Database in Server VX+:
* Importal, use string symbol ' , don't use " .
* Importal, this functions need connect to webserver. It control by steps:
a. logToSer(idObj,username,password) - Login to webserver.
b. checkServer(str) - Check is connect to webserver.
c. helloVX(idObj) - Send Welcomme Echo to webserver.
d. getTableA(idObj) - Return list database openning in webserver. Otherwise not open
Usage added javascript functions:
idObj/idDiv is name : 'demoDiv' is name of Div.
"demoDiv" is wrong.
Alias of data : 'chart' is name alias of database CHART openning in server.
"chart" is wrong.
Fieldname of Alias: 'number' is fieldname of alias is openning on server.
"number" is wrong.
Str : String Value.
Greeting server
- logToSer(idObj,user,pass) - Login to Webserver and return to idObj with string Username and string Password.
See VX+: html(<login username=user;password=pass;>)
- helloAVX() - Alert greeting Server.
See VX+: html(<echo src=Welcome to server; >)
- helloVX(idObj) - Greeting to idObj.
See VX+: html(<echo src=Welcome to server; >)
- checkServer(str) - Check Server is Connect, Str is welcome string. If Connect return Str.
See VX+: html(<echo src=str; >)
System Server
- isAppendA() - Return true if check server have permision append new record. Otherwise return false.
See VX+: sys();
- isWriteA() - Return true if check server have permision write. Otherwise return false.
See VX+: sys();
- isAliasA(alias) - Return true if check Alias is openning on server. Otherwise return false.
See VX+: alias();
- isFieldnameA(alias,fieldname) - Return true if check Fieldname of Alias is exist. Otherwise return false.
See VX+: field();
- isFieldtype(stype) - Check Fieldtype is (char.memo,date,logic,number).
Database functions:
- skipNextA(alias,idObj) - Skip Next Record of Alias.
Example: skipNextA('chart','demoDiv') - Skip Next Alias chart and return result to demoDiv.
See VX+: skip(alias,1)
- skipLastA(alias,idObj) - Skip Last Record of Alias.
See VX+: skip(alias,-1)
- goTopA(alias,idObj) - Go top of Alias.
See VX+: recno(alias,'top')
- goBottomA(alias,idObj) - Go bottom of Alias.
See VX+: recno(alias,'bottom')
- goRecA(alias,recno,idObj) - Go to Record of Alias.
See VX+: recno()
- locateCondA(alias,condision,idObj) - Locate to Record of Alias for Condition.
See VX+:locate()
- appendRecA(alias,idObj) - append 1 blank record
See VX+ : appendrec()
- replaceFieldA(alias,fname,ftype,value,idObj)
See VX+ : replace()
- reportA(alias,freport,page,cond,idObj) - Report form report from page of Alias for condision.
See VX+ : report()
- reportAF(alias,freport,idObj) - Report field Type of Alias.
- labelA(alias,flabel,cond,idObj) - Label form label of Alias for condision.
See VX+ : label()
- labelAF(alias,flabel,idObj) - Label field Type of Alias.
- selectA(alias,fieldlist,res,cond,idObj) - Return select Fieldlist response Res for Condision and create select tag.
See VX+ : html(<select alias=... >)
- tableDataA(alias,fieldlist,cond,idObj) - Return TableData FieldList of Alias for condision.
See VX+ : html(<table alias=... >)
- tableJsonA(alias,fieldlist,cond,idObj) - Return TableJson FieldList of Alias for condision.
See VX+ : html(<json alias=... >)
- tableTextA(alias,fieldlist,cond,idObj) - Return TableText FieldList of Alias for condision.
See VX+ : html(<jtext ... >)
- editEmbedA(alias,fedit,idObj) - Edit a record by Form edit embed on Alias
- getFieldA(alias,fieldname,varname,idObj) - Return Fieldname Value of Alias at current record and create Varname in server.
See VX+ : field()
- getCellA(alias,fieldname,query,varname,idObj) - Return Fieldname Value of Alias for Query condision and create Varname in server
See VX+ : cell()
- getVarA(varname,idObj) - Return Varname value on Server
See VX+ : =varname
- getTagA(varname,tagname,idObj) - Return Tagname value of a Varname on server
See VX+ : gettag()
- getMemA(idObj) - Return list varnames created on server.
See VX+ : var()
- getTableA(idObj) - Return list Alias openning on server.
See VX+ : alias()
- getAliasA(alias,stype,idObj) - get structure of Alias (report/label/edit/field)
See VX+ : report() / label() / edit() / field()
- getFieldtypeA(alias,fieldname) - Return Fieldtype of Alias.
See VX+ : field()
- matrixA(stype,alias,idObj) - Return matrix of Alias type : DETERM,TRANSPOSE,INVERSE,MIN,MAX,CROSS,SUB,EVEN,SUM,MULT,COEF
See VX+ : matrix()
- sumA(alias,fieldname,cond,idObj) - Return sumary a number Field of Alias for Condition is true.
See VX+ : sum()
- averageA(alias,fieldname,cond,idObj) - Return average a number Field of Alias for Condition is true.
See VX+ : average()
- countA(alias,cond,idObj) - Return count record of Alias for Condition is true.
See VX+ : count()
- chartA(alias,style,cond,w,h,view3d,legend,cmark,scolor,idObj) - Show Style chart of Alias .
style=bar,hbar,line,area,point,pie,fline
See VX+ : chart()
- delf(fname,subdir,user) - Delete file in server on ly use Admin.
See VX+ : deletefile()
Run Function and Tag in server
- commandLineA(comline,idObj) - run a function VX+ from remote
See VX+ : html('')
Javascript Functions for Admin:
- putVarDateA(varname,value,idObj) - Assign Date Value to Varname (Date Varname created on server). Used for Admin.
See VX+ : varname=value
- runTagA(alias,tag,idObj) - run Tag of Alias. Used for Admin.
See VX+ : script()
- runSubTagA(alias,tag,sub,idObj) - run Sub Tag of Alias. Used for Admin.
See VX+ : script()
- runPrgA(prgname,para,idObj) - Run a program Prgname with Parameter. Used for Admin.
See VX+ : html(<prg program=prgname;parameter=para; >)
End Javascript Functions for Admin.
Load a webpage to idObj or idFrame
- loadHtmA(htmlname,idObj) - Load a webpage html to idObj.
See VX+ : html(<a href=htmlname >)
- loadHtmF(htmlname,idFrame) - Load a system webpage htmlname.htm (program system) to idFrame.
See VX+ : html(<a href=psname >)
- loadSysPs(psname,idFrame) - Load a system webpage Psname.ps (program system) to idFrame.
See VX+ : html(<a href=psname >)