Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us in Toronto Sept 9th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

How to create several reduced qvw documents - no Publisher available

Dear all,

Again, bothering all you guys with a question that is killing me!

I have this macro:


sub Reducir
Dim texto
set k=ActiveDocument.Fields("DM_EMPLOYEE_NAME")
set UrvFtg=k.GetPossibleValues
For i= 0 to UrvFtg.Count-1
k.select UrvFtg.Item(i).Text
ActiveDocument.ReduceData false
ActiveDocument.SaveAs "C:"&UrvFtg.Item(i).Text&".QVW"
msgbox(UrvFtg.Item(i).Text)
next
end sub


In order to generate several QVW files (one for each value in DM_EMPLOYEE_NAME field), this with the purpose to give a local QVW file for each DM User in my company (that will be opened with Analyzer+, but that's another story). Obviously for the trained eye (the eye of all experts of this forum), this macro will not fail but will generate only one reduced qvw, since when run the next for sequence will not find any value, because the active document will become the reduced one, not the original.

How can I solve this? I know that I can set up a batch task in publisher that reload and publish reduced qvw, but now we don't have budget to buy the publisher license and I'm urged to develop a solution.

Thanks in advance for any comments that you can provide.

Regards!

Andrés A. Jején P.

1 Solution

Accepted Solutions
blaise
Partner - Specialist
Partner - Specialist

http://guerrillabi.com/publisher_with_external_users

View solution in original post

7 Replies
blaise
Partner - Specialist
Partner - Specialist

http://guerrillabi.com/publisher_with_external_users

Not applicable
Author

Andres,

How about using 'Section Access' to control what data an individual user sees instead?

Regards,

Gordon

Not applicable
Author

Hi Gordon,

This will not work because I want to physically distribute offline cubes to all my users, the master cube weights about 30 MB and the reduced cubes will not be over than 1 MB so it will be easy to send to every users... But thanks for your answer!!!

Hi Blaise!

The script that you sent will only work as a vbs script or I can use the engine inside Qlik View?

Regards and thanks for your answer

Andrés A. Jején P.

Not applicable
Author

Andres,

You could do this outside of Qlikview. See this .vbs file that opens a QV document, exports a table then closes Qlikview:

' Start QlikView and open the document
set Qv = CreateObject("QlikTech.QlikView")
Set QvDoc = Qv.OpenDoc ("E:\QVApplications\QVTest\ONPOSTRELOAD.QVW","","")

' Activate the Main sheet and object CH01
QvDoc.Sheets("Main").Activate
set oSheetObj=QvDoc.GetSheetObject("CH01")

' Let the macro sleep for 20 seconds to make sure
' the chart is calculated before export
WScript.Sleep 20000
oSheetObj.ExportBIFF "E:\QVApplications\QVTest\qvexport.xls"

Set oSheetObj = Nothing
Set QvDoc = Nothing

' Close QlikView
Qv.quit

once you have the document, you could add

QvDoc.ReduceData

QvDoc.SaveAs "E:\................."

and set a loop up to do this for each of your users.

Regards,

Gordon

blaise
Partner - Specialist
Partner - Specialist

yes you can use Qlikview "VB engine"

Not applicable
Author

Blaise, Gordon... Thanks a lot for this! It works like a dream and saved me a lot of money!!!

Regards

Not applicable
Author

You could also email your newly created QV documents like this:

Set objMessage = CreateObject("CDO.Message")

objMessage.Subject = "CustomerData.csv has been downloaded"
objMessage.From = "itsupport.vcegb@volvo.com"
objMessage.To = "gordon.savage@volvo.com"
objMessage.TextBody = "The data file has been succesfully generated by the Qlikview Customer Segmentation document."
objMessage.AddAttachment "E:\QVApplications\QVTest\test.doc"

objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2

objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "your email server"

objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25

objMessage.Configuration.Fields.Update

objMessage.Send

Regards,

Gordon