Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

save test.txt to server?

hi.

qvw generate test.txt,test.txt are saved to the local.

save test.txt to server.I can't find a way to set it ,

Are there any other methods?

thanks!

maro:

sub Writes

    Const ForAppending=8,TristateFalse=0

    Set fso= CreateObject("Scripting.FileSystemObject")
    fso.CreateTextFile("c:/test" & ".txt")  '默认是桌面
    set sfile=fso.OpenTextFile("c:/test.txt",ForAppending,TristateFalse)
   
    set val=ActiveDocument.Fields("[QlikView User]").GetPossibleValues
    for i=0 to val.Count-1
       user=user&val.Item(i).Text
    next
    sfile.WriteLine "用户为:"&user
    set table = ActiveDocument.GetSheetObject( "CH01" )
    sfile.WriteLine "明细表的行数为:"&table.GetRowCount-1  '把表头去掉
    sfile.WriteLine "明细表"
    CellRect = ActiveDocument.GetApplication().GetEmptyRect()
    CellRect.Top = 0
    CellRect.Left = 0
    CellRect.Width = table.GetColumnCount
    CellRect.Height = table.GetRowCount
    set CellMatrix = table.GetCells( CellRect )
    set CellMatrix = table.GetCells( CellRect )
    for RowIter=CellRect.Top to CellRect.Height-1
       for ColIter=CellRect.Left to CellRect.Width-1
          sfile.Write CellMatrix(RowIter)(ColIter).Text&"   "
       next
          sfile.WriteLine ""  '换行
    next
    sfile.Close
    set fso=Nothing
    set sfile=Nothing
end sub

4 Replies
Anonymous
Not applicable
Author

Is "Allow macro execution on server" on the Enterprise Management Console > Server > Security turned on ?

Jonathan

danielrozental
Master II
Master II

You can't save a file on the server through a regular macro as macros are executed client side.

A way you could do this is by calling serversideexport on an chart object.

Not applicable
Author

hi   Daniel Rozental

Can you give an example for me?

thanks

Anonymous
Not applicable
Author

QlikView reference manual has this to say:

"It is possible to export the content of any chart to a text file on the server by using a Macro connected to a Button. This feature has to be added in the QlikView document and then the macro can be executed from the QlikView Server directly in the web browser."

The API Guide has the following example on a StraightTableBox Class's ServerSideExport member:

set tb = ActiveDocument.GetSheetObject("CH01")

tb.ServerSideExport "C:\test.skv" , ";" , 0       'ANSI

Jonathan