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

Announcements
Qlik GA: Multivariate Time Series in Qlik Predict: Get Details
cancel
Showing results for 
Search instead for 
Did you mean: 
dmohanty
Partner - Specialist
Partner - Specialist

Export Table Box data to Users Desktop - HOW?

Hi All,

I have a successfully running Macro code which exports the Table Box data in QlikView into a Notepad at desired path mentioned in a Server/ Repository. (Below code).

Highlighted sections are path defined in the QVW.

Now I want to replace the path with something like - User's Desktop. User will click the button (to run macro), so that the table Box data can be exported in to their personal desktop from any environment.

function Export() {

var dt = new Date();
var yr = dt.getYear(); 
var m = dt.getMonth()+1; 
var d = dt.getDate(); 
var hh = dt.getHours(); 
var mm = dt.getMinutes(); 
var ss = dt.getSeconds(); 

var vExportTime = dt.getYear()+((m<10?'0':'')+ m)+((d<10?'0':'')+d)+' '+((hh<10?'0':'')+hh)+':'+((mm<10?'0':'')+mm)+':'+((ss<10?'0':'')+ss); 

var doc = ActiveDocument;
var vDocName = doc.GetVariable('vDocName').GetContent().String;
var vRootFileLocation = doc.GetVariable('vRootFileLocation').GetContent().String;  
var vQVDs = doc.GetVariable('vQVDs').GetContent().String;

obj = doc.GetSheetObject("TB_Export");
obj.ServerSideExport( vRootFileLocation + vQVDs + 'Delete_' + vDocName + '_' + yr + m + d + hh + mm + ss + '.txt' , 1) ;

How to replace the existing highlighted path with User's Desktop path. Please suggest?



5 Replies
jagan
Partner - Champion III
Partner - Champion III

Hi Dicky,

Check this script to get Desktop path

set WshShell = WScript.CreateObject("WScript.Shell")
strDesktop
= WshShell.SpecialFolders("Desktop")
wscript
.echo(strDesktop
)


Source:windows - What's the environment variable for the path to the desktop? - Stack Overflow

dmohanty
Partner - Specialist
Partner - Specialist
Author

jagan‌,

Hey Jagan,

Thank you for the help here.

I am defining the path in the script itself with a variable and using the same variable in Macro.

Can your script somehow converted like that or in a JScript please? My whole above in JScript, so would be easy for that. ( can you help here Petter?petter-s)

Regards!

jagan
Partner - Champion III
Partner - Champion III

This piece of code will give you the desktop path.

set WshShell = WScript.CreateObject("WScript.Shell")
strDesktop
= WshShell.SpecialFolders("Desktop")


Debug and check whether it is working properly.


Regards,

Jagan.

dmohanty
Partner - Specialist
Partner - Specialist
Author

Thanks jagan‌ for this.

But am not able to fit this in my existing JScript macro. This VB needs to be converted to a JScript format. A bit novice in JScript. Couldn't use the appropriate keywords.

jagan
Partner - Champion III
Partner - Champion III

Check for any converters available, some websites are there which converts from one language to another.  Like Java to .NET etc.