Qlik Community

QlikView Documents

Documents for QlikView related information.

Announcements

Breathe easy -- you now have more time to plan your next steps with Qlik!
QlikView 11.2 Extended Support is now valid through December 31, 2020. Click here for more information.

Source files in my script

Not applicable

Source files in my script

Hello all,

I often want to find what files I am using in a script which means either a 'find' within the script or File>Export to script file from within the script editor.

I believe that from v10 this can be achieved using meta data but I am still on v9

The attached vbs will prompt for the name of a .txt or .qvs (exported script file) and a string to search for (default = 'from') and then present the line numbers and the full line containing the search string in a .txt created in the 'temp' folder. The search is performed 'caseless' and it doesnt matter about leading spaces in the lines being searched. The .txt file can be saved and perhaps loaded with others into a .qvw to help documentation. I could have written it to interface with the standard file browser but this only seems to work with XP.

Anyways, if its of any value here it is. As with any vbs I would recommend you review the code before running to make sure you are happy with what it will do.

Regards,

Gordon

Labels (2)
Attachments
Comments
flipside
Not applicable

Hi Gordon,

You can also do this in a Qlikview macro to directly query the qlikview documents load script without the need for .txt files. Script could do with tidying up a bit ...

sub SearchScripts

srch = lcase(inputbox("Search for ...")) 'case sensitive, set to lcase for comparison
user = inputbox("User name") 'admin username to pass thru
passwd = inputbox("password") 'admin password to pass thru

set App = ActiveDocument.GetApplication
set newdoc = App.OpenDoc("C:\Doc .... .qvw",user,passwd)

set docprop = newdoc.GetProperties

If InStr(lcase(docprop.Script),srch) then  'add deeper inspection

'Count CR chars (lines)
arrCount = Split(docprop.Script, chr(13), -1, 1)
CharacterCount = UBound(arrCount)

LineStart = 1
LineEnd = InStr(docprop.Script, chr(13))

for s = 1 to CharacterCount
  LineCheck = mid(docprop.Script,LineStart,LineEnd-LineStart) ' returns a single line to check
  If InStr(LineCheck,"///$tab") then ' trap the tab name in case a match is found
   CurrTab = LineCheck
   DeductLines = s ' reset the row count so it shows as row per tab, not total row
  End if
  If InStr(lcase(LineCheck),srch) then
   msgbox "String [" & srch & "] found in " & newdoc.Name & chr(13) & CurrTab & chr(13) & "Line " & s-DeductLines & ": " & chr(13) & LineCheck
  End If
LineStart = LineEnd + 1
LineEnd = InStr(LineStart,docprop.Script, chr(13))
next

else
Msgbox srch & " not found"
end if

newdoc.closedoc

end sub

flipside

Not applicable

Hi ,

i tried below line to place "$(Include=d:\vqd eat\text\test.txt);" in edit script "Main 2" tab, but it is creating new tab "Main 2" and adding the line.

what to modify in below line for adding line in existed tab "Main 2" ?

docprop.Script = docprop.Script & Chr(13) & "///$tab Main 2" & Chr(13) & "$(Include=d:\vqd eat\text\test.txt);"

Thanks

Version history
Revision #:
1 of 1
Last update:
‎03-24-2012 07:21 AM
Updated by: