Caravan Business Server>Help>Objects>File Object>
Properties
blocksize
|
Name
|
blocksize
|
Text
|
You can read or write into a structured file (e.g CSV ro txt file with delimiter separated data), with fixed
length (in blocks) data. Block size defines the number of bytes or characters that you want to read or write in
to a file. (Also check out 'block' and 'blockno' properties)
|
Syntax
|
<caravan> f(blocksize)={number of bytes} </caravan>
|
Sample
|
<caravan> file x="C:/importdata/phone.txt" ; //create a file object x f(blocksize)="512" ;// read 512 bytes at a time </caravan>
|
|
Caravan Business Server>Help>Objects>File Object>
Properties>
File
|
Name
|
File
|
Text
|
To access the contents of the file.
|
Syntax
|
<caravan>f(file)</caravan>
|
|
Caravan Business Server>Help>Objects>File Object>
Properties>
filename
|
Name
|
filename
|
Text
|
To access the name of the file.
|
Syntax
|
<caravan>f(filename)</caravan>
|
|
Caravan Business Server>Help>Objects>File Object>
Properties>
date
|
Name
|
date
|
Text
|
To access the created date of the file.
|
Syntax
|
<caravan>f(date)</caravan>
|
|
Caravan Business Server>Help>Objects>File Object>
Properties>
size
|
Name
|
size
|
Text
|
To access the size of the file.
|
Syntax
|
<caravan>f(size)</caravan>
|
|
Caravan Business Server>Help>Objects>File Object>
Properties>
urlname
|
Name
|
urlname
|
Text
|
It is a randomly generated name used to access the file as a link.
|
Syntax
|
<caravan>f(urlname)</caravan>
|
|
Caravan Business Server>Help>Objects>File Object>
Properties>
time
|
Name
|
time
|
Text
|
To access creation time of the file.
|
Syntax
|
<caravan>f(time)</caravan>
|
|
Caravan Business Server>Help>Objects>File Object>
Properties>
replace
|
Name
|
replace
|
Text
|
Set the existing file to Read and Write. Default is read only. If you want to append or write to a file, first
set this parameter.
|
Syntax
|
<caravan> f(replace) </caravan>
|
Sample
|
Append a file: //Create a file object file f="path\filename.txt"; //assuming that the file exists file addnew="path\newfile.txt" f(replace) ; //if the file exists, then it will be appended f(file)+=addnew(file) ; //this will append newfile.txt content to filename.txt //or f(file)+="hello world" ; //append the text Hello World to filename.txt
|
|
Caravan Business Server>Help>Objects>File Object>
Properties>
getline
|
Name
|
getline
|
Text
|
Read a structured file line by line. It reads the current line. The line should end with CRLF or CR or LF. Skips
more than one CRLF.
Use it to read a delimiter separated file, like a CSV or text file.
|
Syntax
|
<caravan> f(getline) </caravan> 'Getline' will only read from the current line and to read subsequent lines, use 'Nextline'.
|
Sample
|
<caravan> // This example reads a structured file with space delimiter information per line file x="C:/importdata/phone.txt" ; //create a file object x if x(getline); // if any data exists, then reading the first line will be successful loop xl (1000000); // read line by line if x(getline); // if data available. var newvalues= {x(nextline)}X{"`#~#`%\"`*`\"%\"`*`\""}:{clientnum,phone,type} ; // parse the values and assign to var newvalues. Also go to nextline to read a fresh line newvalues(clientnum) ; //display the parsed values clientnum,phone and type newvalues(phone) newvalues(type) endif repeat xl 100000 endif </caravan>
|
|
Caravan Business Server>Help>Objects>File Object>
Properties>
nextline
|
Name
|
nextline
|
Text
|
Go to the next line of a structured file. The line should end with CRLF or CR or LF. Skips more than one CRLF.
Alongwith 'Getline' use it to read a delimiter separated file, like a CSV or text file.
|
Syntax
|
<caravan> f(nextline) </caravan>
|
Sample
|
<caravan> // This example reads a structured file with space delimiter information per line file x="C:/importdata/phone.txt" ; //create a file object x if x(getline); // if any data exists, then reading the first line will be successful loop xl (1000000); // read line by line if x(getline); // if data available. // parse the values and assign to var newvalues. Also go to nextline to read a fresh line var newvalues= {x(nextline)}X{"`#~#`%\"`*`\"%\"`*`\""}:{clientnum,phone,type} ; newvalues(clientnum) ; //display the parsed values clientnum,phone and type newvalues(phone) newvalues(type) endif repeat xl 100000 endif </caravan>
|
|
Caravan Business Server>Help>Objects>File Object>
Properties>
blockno
|
Name
|
blockno
|
Text
|
Jump to the specified block number, to read or write a file.
(Also check out 'block' and 'blocksize' properties)
|
Syntax
|
<caravan> f(blockno)={number}; // default=0 </caravan>
|
Sample
|
<caravan> file x="C:/importdata/phone.txt" ; //create a file object x f(blocksize)="512" ;// read 512 bytes at a time f(blockno)="10" ; //jump to block no 10 in the file. i.e at the position of 5120 bytes (512 * 10) f(block)="This is a test message" ; //write at that position some content. </caravan>
|
|
Caravan Business Server>Help>Objects>File Object>
Properties>
block
|
Name
|
block
|
Text
|
Read or write the block of the defined size. (Also check out 'blockno' and 'blocksize' properties)
|
Syntax
|
<caravan> f(block) </caravan>
|
Sample
|
<caravan> file x="C:/importdata/phone.txt" ; //create a file object x f(blocksize)="512" ;// read 512 bytes at a time f(blockno)="10" ; //jump to block no 10 in the file. i.e at the position of 5120 bytes (512 * 10) Var newcontent newcontent(text)=f(block) ; //read 512 bytes and assign to a variable </caravan>
|
|
Home
Back
|