DBWLoadQuery with large working sets

<< Click to Display Table of Contents >>

Navigation:  »No topics above this level«

DBWLoadQuery with large working sets

Example

Suppose it is required to load a large working sets documents unique ids list from a given source table (DBW_WS_LUCA_ADM)

DBWLoadQueryLargeWorkingSetsExampleSourceTable

 

in such a case it is possible to use the following script to adapt according to customer's needs.

'x64
Sub main()
 DBWInit(TRUE)
 Set fs = CreateObject("Scripting.FileSystemObject")
 Set tfolder = fs.GetSpecialFolder(TemporaryFolder)
 queryFileName = tfolder & "\PartListSample.sql"
 '1------Get unique id's array------
 Dim i
 Dim cnn
 Dim sqlQuery
 Dim rsUids
 Dim arrUids()
 Set cnn = CreateObject("ADODB.Connection")
 cnn.Open DBWorksConnectionDSN, DBWorksConnectionUID, DBWorksConnectionPWD
 sqlQuery = "select unique_ID from DBS_WS_LUCA_ADM"
 Set rsUids = CreateObject("ADODB.RecordSet")
 rsUids.Open sqlQuery,cnn,3
 i = 0
 while not rsUids.eof
  redim preserve arrUids(i)
  arrUids(i) = rsUids.Fields(0).Value
  rsUids.MoveNext
  i = i+1
 wend
 rsUids.Close
 set rsUids = nothing
 cnn.Close
 set cnn = nothing
 '2------Write unique id's array list into temporary file (queryFileName)------
 Set a = fs.OpenTextFile( queryFileName, ForWriting, True )
 for k=0 to ubound(arrUids)
  a.WriteLine( arrUids(k) )
 next
 a.Close
 '3------Load the list of uids from the temproary file into the working set------
 call DBWShell("LoadQuery " & replace(queryFileName," ","|") & " WORKINGSET")
 if( okDBW = False ) then exit sub
End Sub

See also

Sub DBWLoadQuery