Qlik Community

QlikView Deployment

Discussion Board for collaboration related to QlikView Deployment.

Not applicable

Exporting ServerSide with Macro

Hi,

Qlikview 8.5, end users access the application throught the IE plugin.

I've a macro that allows the end user to export data. The export needs to go to the server side for further processing.

For an entire object it is easy. Instead of using

set doc = ActiveDocument.getsheetobject("TB01")
doc.export "d:\data\export\test.csv",";"

I use

set doc = ActiveDocument.getsheetobject("TB01")
doc.ServerSideExportEx "d:\data\export\test.csv",";",1

Is there also an equivalent of:
'create file
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objExportFile = objFSO.CreateTextFile("D:\data\export\test.csv",true,true)

'Get data and write to the file
SubmissionDate= ActiveDocument.GetVariable("vToday").GetContent.String
objExportFile.Write "Submission Date: " & SubmissionDate & vbNewline

'write other stuff to the file

'close file
objExportFile.Close

The above does not allow the end user to write server side. Is there an equivalent that allows the end user (client) to write line-by-line to the server?

All help is much appreciated.

Thanks

Anton

9 Replies
pover
Honored Contributor

Exporting ServerSide with Macro

Anton,

If your application is not on the internet you should be able to use the UNC format. So instead of D:\ you would use \\servername\.

Also the ServerSideExportEx function does have an append to file option that you define in the 5th parameter.

Regards.

Not applicable

Exporting ServerSide with Macro

Karl,

My application is on the internet - end users access the application through the IE plug-in.

I probably did not state my question clearly: The problem does not lie in de location where the file should be exported to (D:\ or \\servername) but in the fact that client does not have writing rights on our servers.

For exporting complete object this can be solved by using ServerSideExportEx. Is it also possible to let the end user write to the server, equivalent to the 'ordinary' CreateTextFile and Write as in the example below?

'create file
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objExportFile = objFSO.CreateTextFile("D:\data\export\test.csv",true,true)

'Get data and write to the file
SubmissionDate= ActiveDocument.GetVariable("vToday").GetContent.String
objExportFile.Write "Submission Date: " & SubmissionDate & vbNewline

'write other stuff to the file

'close file
objExportFile.Close

Thanks

Anton

pover
Honored Contributor

Exporting ServerSide with Macro

Anton,

Hopefully somebody can answer your question in this forum, but I have to admit that when I have a question about VBScript and not the QlikView API, I usually have better luck looking in looking in google for a forum where my question is almost always already answered.

My point on the QlikView ServerSideExportEx is that you're correct in saying that that funtion is for exporting complete objects, but don't limit the definition of a complete object. You can make a easily make a listbox with the value of avariable or fixed text and append it to an existing file using the ServerSideExportEx function.

Regards.

Not applicable

Exporting ServerSide with Macro

Karl,

I tried googling VB script sites, but no luck so far - of course it is pretty specific to QV, isn't it?

You're right that the ServerSideExport can be used to append different object into one, but my macro needs to loop through a straight table, and select lines to be exported. I cannot just filter out the unwanted lines, because the in- or exclusion depends on the values of fields of the previous line in the table (using the above function to determine those values).

Again: any help is appreciated.

Anton

Not applicable

Exporting ServerSide with Macro

Anton, did you ever find a solution for this? I find myself with exactly the same problem

danielrozental
Honored Contributor II

Exporting ServerSide with Macro

Only ServerSideExport runs on the server side, creating text files only runs locally in the clients computer.

Not applicable

Exporting ServerSide with Macro

Thanks Daniel, I was able to replicate what I wanted in the text file using the append boolean on ServerSideExportEx, my problem now is I take these files I have exported to the server, performed some processing on them and generated a new file I want to give back to the client, any idea how this is possible?

my basic plan is as follows

Client clicks a button which triggers a macro

The macro generates some files on the server and waits

Server side these files are processed and a new file generated

Then comes my problem, how do I allow the macro to see the new server side file and give it to the client?

any help is much apreciated, thanks

danielrozental
Honored Contributor II

Exporting ServerSide with Macro

The way I do things like that is I get the macro to trigger a task in publisher using EDX (or QMS API).

Process could then copy the file to a network shared folder the user has access to.

Not applicable

Exporting ServerSide with Macro

Hi Luke,

No, I never solved the problem.

This is the workaround that I use now:

The object is Exported to CSV ServerSide by a user induced macro.

On the server, a script runs every 5 minutes to see if new exports have arrived.

This script picks up the csv and processes it (i.e. line by line assesment if the line should be in the export).

The processed export is then procesed further.

My problem was that I couldn't get a user induced macro to write a file serverside line by line from an object.

The line-by-line treatment is now done by a script on the server and not in QV.

Not so nice, but it works.

As for your specific problem:

Either run a script on the server that send the exported file to an sftp location for you client to pick it up, or build a QV application that reads the exported file and let your client download it from the QV app

Anton

Community Browser