WriteActualGrid

<< Click to Display Table of Contents >>

Navigation:  Programming Mechworks PDM > DBWCommandShell > Commands Reference > Browser >

WriteActualGrid

Description

This command allows the creation of a txt file output with the content of the Browser's active grid

Syntax

call DBWShell("WriteActualGrid outputTXTfile [ListOfFields]")

Parameters

outputTXTfile

any valid txt file path

ListOfFields

Optional.
A comma separated list of fields to be outputted into the txt file

See also

WriteActualGrid
WriteActualTree
WriteTree

Example

sub main()

 DBWInit(TRUE)
 Set fs = CreateObject("Scripting.FileSystemObject")
 Set tfolder = fs.GetSpecialFolder(TemporaryFolder)
 'assign the proper output file and list of fields
 outputTxtFile = tfolder & "\myGridOutput.txt"
 listOfFields = "UNIQUE_ID,T,ID,DESCRIPTION,CONFIGURATION,FILE_DIRECTORY,FILE_NAME"
 'invoke the DBWorks API
 DBWShell("WriteActualGrid " & replace(outputTxtFile," ","|") & " " & listOfFields )
 'read the generated output file
 Dim tokens
 Set f = fs.OpenTextFile( outputTxtFile, ForReading, True )
 Do While f.AtEndOfStream <> True
  'read one line from the text file
  line = f.ReadLine
  'split into an array the comma-limitated arguments
  tokens = Split( line, "," )
  'cut the begin/end quote characters
  for i=0 to ubound(tokens)
   tokens(i) = mid(tokens(i),2,len(tokens(i))-2)
  next
  'display the recordset
  uid= tokens(0)
  t= tokens(1)
  id= tokens(2)
  description= tokens(3)
  configuration= tokens(4)
  fileDir= tokens(5)
  fileName= tokens(6)
  DBWMsgBox _
   "uid=" & uid & vbcrlf &_
   "t=" & t & vbcrlf &_
   "id=" & id & vbcrlf &_
   "description=" & description & vbcrlf &_
   "configuration=" & configuration & vbcrlf &_
   "fileDir=" & fileDir & vbcrlf &_
   "fileName=" & fileName
 Loop
 f.Close
end sub