Display the contents of the active table and any related tables
DISPLAY
open database southwind
use products order categoryid
display
display all
seek 2
display productid, productname while categoryid = 2
https://www.lianja.com/doc/index.php/DISPLAY
List the contents of the active table and any related tables
LIST
open database southwind
use products order categoryid
seek 2
list productid, productname while categoryid = 2
// rsp example
<%@ Language=VFP %><% if not isServer() ? "" else ? "" endif %>
<% text raw function editCustomerID(customerid) { Lianja.showDocument("page:page1?action=search&text="+customerid); }; endtext save datasession open database southwind use customers list html off ; fields customerid,companyname,contacttitle,contactname,address,region,city,country ; onclick "customerid","editCustomerID('{}')" restore datasession %>
https://www.lianja.com/doc/index.php/LIST
Display the structure of the active table
LIST STRUCTURE
use patrons
list structure
Display the structure of the active table
DISPLAY STRUCTURE
use patrons
display structure
Fill an array with field descriptions
ADESC
declare headings[fcount()]
adesc(headings)
https://www.lianja.com/doc/index.php/ADESC()
Count fields contained in a table
FCOUNT
use accounts
do while i <= fcount()
? field(i)
++ i
enddo
https://www.lianja.com/doc/index.php/FCOUNT()
Field name
FIELD
use payroll
declare fname[fcount()]
for n=1 to fcount()
fname[n] = field(n)
?fname[n]
next
?
use demo
go top
? field(1,1,1)
ACCOUNT_NO,C,5,00046
https://www.lianja.com/doc/index.php/FIELD()
String containing comma-separated information about a specified field
FIELDINFO
open database southwind
use example
astore(a_info,fieldinfo(1,1),",")
display memory
https://www.lianja.com/doc/index.php/FIELDINFO()
Field name
FIELDNAME
use payroll
declare fname[fcount()]
for n=1 to fcount()
fname[n] = fieldname(n)
?fname[n]
next
?
use demo
go top
? fieldname(1,1,1)
ACCOUNT_NO,C,5,00046
https://www.lianja.com/doc/index.php/FIELDNAME()
Comma separated list of field names
FLDLIST
open database southwind
use customers
fieldList = fldlist()
https://www.lianja.com/doc/index.php/FLDLIST()
Count fields contained in a table
FLDCOUNT
use accounts
do while i <= fldcount()
? field(i)
++ i
enddo
https://www.lianja.com/doc/index.php/FLDCOUNT()
Table file name
DBF
use patrons
? dbf()
patrons.dbf
dbfname = dbf()
? dbfname
patrons.dbf
? len(dbfname)
11
use
dbfname = dbf()
? len(dbfname)
0
https://www.lianja.com/doc/index.php/DBF()
Field description
LABEL
close databases
clear
open database southwind
use example
for i = 1 to fldcount()
? "Field: " + field(i) + " - Description: " + label(i)
next
?
https://www.lianja.com/doc/index.php/LABEL()
Numeric field count
NFCOUNT
use accounts
? nfcount()
3
https://www.lianja.com/doc/index.php/NFCOUNT()
Date of last table update
LUPDATE
use patrons
? lupdate()
02/02/2000
https://www.lianja.com/doc/index.php/LUPDATE()
Fill an array with table structure details
AFIELDS
open database southwind
use customers
? afields(myarr)
display memory
https://www.lianja.com/doc/index.php/AFIELDS()
All the fields in the current row as a string
RTOS
use backup in 0
use accounts in 0
nrecs=reccount()
for i = 1 to nrecs
if rtos(accounts) != rtos(backup)
debug("record "+recno()+" doesn't match")
endif
next
https://www.lianja.com/doc/index.php/RTOS()
Number of records in table
RECCOUNT
use accounts
? reccount()
2500
? fcount()
18
declare aAccounts[reccount(),fcount()]
copy to array aAccounts for empty(paid_date)
https://www.lianja.com/doc/index.php/RECCOUNT()
Record size
RECSIZE
use accounts
if header() + reccount() * recsize() > 100000
dialog box "Database too big for backup disk."
endif
https://www.lianja.com/doc/index.php/RECSIZE()
Table header size
HEADER
use mytable
size = header() + reccount() * recsize()
https://www.lianja.com/doc/index.php/HEADER()
Number of records in table, excluding deleted records and those not in the active filter
ROWCOUNT
use accounts
? reccount()
2500
delete first 10
? rowcount()
2490
https://www.lianja.com/doc/index.php/ROWCOUNT()
Number of records in table, excluding deleted records and, if the table is open, those not in the active filter
TABLEROWCOUNT
open database southwind
? tablerowcount("orders")
823
https://www.lianja.com/doc/index.php/TABLEROWCOUNT()
Check whether a specific column exists
COLUMNEXISTS
if columnexists("southwind","customers","customerid",5,0)
open database southwind
use customers
else
open database southwind
alter table customers (...)
endif
https://www.lianja.com/doc/index.php/COLUMNEXISTS()
Determine if a table is open
INUSE
? inuse("customers")
.T.
? inuse("products")
.T.
https://www.lianja.com/doc/index.php/INUSE()
Determine if a table is open readonly
ISREADONLY
open database southwind
use customers in 1
use orders in 2 noupdate
? isreadonly(1) // .F.
? isreadonly(2) // .T.
? isreadonly("customers") // .F.
? isreadonly("orders") // .T.
? isreadonly() // .F.
https://www.lianja.com/doc/index.php/ISREADONLY()
Check whether table exists
TABLEEXISTS
if tableexists("southwind","customers")
open database southwind
use customers
else
open database southwind
create table customers (...)
endif
https://www.lianja.com/doc/index.php/TABLEEXISTS()
Current property settings for a table or cursor
CURSORGETPROP
open database southwind
use customers
? cursorgetprop("Buffering")
3
https://www.lianja.com/doc/index.php/CURSORGETPROP()
Define current property settings for a table or cursor
CURSORSETPROP
close databases
clear
set exclusive off
open database southwind
use customers
// Set to known value before start
replace customerid with "ALFKI"
cursorsetprop("Buffering", 5, "customers")
messagebox("Buffering set to " +etos(cursorgetprop("Buffering")))
? "Original customerid value: " + customerid
? "Curval(): " + curval("customerid")
? "Oldval(): " + oldval("customerid")
? "Fieldstate at start: " + getfldstate("customerid")
replace customerid WITH "LIANJ"
// Alter in another session
// update southwind!customers set customerid = 'MULTI' where recno() = 1
? "Someone else just updated the record!"
? "New customerid value: " + customerid
? "Curval(): " + curval("customerid")
? "Oldval(): " + oldval("customerid")
? "Fieldstate after replace: " + getfldstate("customerid")
tablerevert(.T.)
? "Reverted customerid value: " + customerid
? "Curval(): " + curval("customerid")
? "Oldval(): " + oldval("customerid")
? "Fieldstate after revert: " + getfldstate("customerid")
replace customerid WITH "LIANJ"
? "New customerid value: " + customerid
tableupdate(.T.)
? "Updated customerid value: " + customerid
? "Curval(): " + curval("customerid")
? "Oldval(): " + oldval("customerid")
? "Fieldstate after replace and update: " + getfldstate("customerid")
?
https://www.lianja.com/doc/index.php/CURSORSETPROP()
String containing the specified field’s autosuggestionheaders column constraint
FIELDAUTOSUGGESTIONHEADERS
open database southwind
use customers
? fieldautosuggestions("customers","contacttitle")
select distinct contacttitle,contactname from customers
? fieldautosuggestionheaders("customers","contacttitle")
Title,Name
? fieldautosuggestions(1,"contacttitle")
select distinct contacttitle,contactname from customers
? fieldautosuggestionheaders(1,"contacttitle")
Title,Name
https://www.lianja.com/doc/index.php/FIELDAUTOSUGGESTIONHEADERS()
String containing the specified field’s autosuggestions column constraint
FIELDAUTOSUGGESTIONS
open database southwind
use customers
? fieldautosuggestions("customers","contacttitle")
select distinct contacttitle,contactname from customers
? fieldautosuggestionheaders("customers","contacttitle")
Title,Name
? fieldautosuggestions(1,"contacttitle")
select distinct contacttitle,contactname from customers
? fieldautosuggestionheaders(1,"contacttitle")
Title,Name
https://www.lianja.com/doc/index.php/FIELDAUTOSUGGESTIONS()
String containing the specified field’s choices column constraint
FIELDCHOICES
open database southwind
use order_details
? fieldchoices(1,"productid")
select productname from products order by productname
? fieldchoices("order_details","productid")
select productname from products order by productname
https://www.lianja.com/doc/index.php/FIELDCHOICES()
Check if a field has been modified
GETFLDSTATE
close databases
clear
set exclusive off
open database southwind
use customers
// Set to known value before start
replace customerid with "ALFKI"
cursorsetprop("Buffering", 5, "customers")
messagebox("Buffering set to " +etos(cursorgetprop("Buffering")))
? "Original customerid value: " + customerid
? "Curval(): " + curval("customerid")
? "Oldval(): " + oldval("customerid")
? "Fieldstate at start: " + getfldstate("customerid")
replace customerid WITH "LIANJ"
// Alter in another session
// update southwind!customers set customerid = 'MULTI' where recno() = 1
? "Someone else just updated the record!"
? "New customerid value: " + customerid
? "Curval(): " + curval("customerid")
? "Oldval(): " + oldval("customerid")
? "Fieldstate after replace: " + getfldstate("customerid")
tablerevert(.T.)
? "Reverted customerid value: " + customerid
? "Curval(): " + curval("customerid")
? "Oldval(): " + oldval("customerid")
? "Fieldstate after revert: " + getfldstate("customerid")
replace customerid WITH "LIANJ"
? "New customerid value: " + customerid
tableupdate(.T.)
? "Updated customerid value: " + customerid
? "Curval(): " + curval("customerid")
? "Oldval(): " + oldval("customerid")
? "Fieldstate after replace and update: " + getfldstate("customerid")
?
https://www.lianja.com/doc/index.php/GETFLDSTATE()
Information about a table, virtual table or view
TABLEINFO
open database mytables
// Standard Lianja table
? tableinfo("ltable")
Table
// View
? tableinfo("lview")
View|select * from customers
// Virtual Table
? tableinfo("lvirtual")
VirtualTable|lvirtual|awhr|currencycode||select * from sales.currency
https://www.lianja.com/doc/index.php/TABLEINFO()
Count records in the active table that satisfy a specified condition
COUNT
use patrons
count to nResult for event = "CHOPIN" and date = date()
https://www.lianja.com/doc/index.php/COUNT
Number of records in table
LASTREC
use accounts
? lastrec()
2500
? fcount()
18
declare aAccounts[reccount(),fcount()]
copy to array aAccounts for empty(paid_date)
https://www.lianja.com/doc/index.php/LASTREC()
Filetype of the active table or the table in a specified workarea
FILETYPE
use demo
? filetype()
Lianja
https://www.lianja.com/doc/index.php/FILETYPE()