Record Count
I need to print a text object that says 'Carton X of Y' on a label where 'Y' will be total number of rows in my data source. The data source is a text file.
How can I access the count of records in my data source via vbscript ?
How can I access the count of records in my data source via vbscript ?
0
-
This seems more to be a general VBScript programming question, more than a BarTender related problem, but I've found the following VBScript code which will count the number of lines of a certain text file. I hope this helps:
const filename="abc_test.txt" 'make your input
set fso=createobject("scripting.filesystemobject")
set ofile=fso.opentextfile(filename)
strcontents=ofile.readall
ofile.close
set ofile=nothing
set fso=nothing
acontents=split(strcontents,vbcrlf)
wscript.echo "Number of line : " & cstr(ubound(acontents)+1)
Instead of writing to the screen, the last line of your VBScript could be:
value = cstr(ubound(acontents)+1)
Hope this helps.0
Vous devez vous connecter pour laisser un commentaire.
Commentaires
1 commentaire