Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
qlikviewforum
Creator II
Creator II

QVW to create bat file which contain the copy command for all the QVD's used in the QVW. Help on this!

Hi,

To verify the data of a dashboard in Development after our changes we usually copy all the QVD's from Production environment to the Development environment and then we refresh the dashboard in Development with these QVD's to make sure that the data in

the dashboard is matching with Production.

Development: \\GRRTYRTSDDGDFH\QVSTORAGE_DEV\QV\APP\QVD\Sales.qvd

Production: \\TRUTRUSDGEDRUYER\QV\APP\QVD\Sales.qvd

In my case since difference between the Development and Production environment is only the root path. I was trying to create a batch file using the below code to create the copy command for all the files that exists in the dashboard. So when we run the batch

file which was created it would copy all the files from Production to Development.

Since double quotes(") required start and end of the source/destination files. I was trying to add the double quotes but I am getting extra double quotes in the start and end of the source/destination files.

Below is the code which I have written for this. Can someone please help on this?

mytable:
LOAD
'COPY /Y   ' & '"'&Replace(Upper(Discriminator),'\\GRRTYRTSDDGDFH\QVSTORAGE_DEV\QV\','\\TRUTRUSDGEDRUYER\QV\') & '"'&'   ' &'"'&Upper(Discriminator) & '"'as CopyCommand
FROM [\\TRUTRUSDGEDRUYER\QV\APP\QVW\Medical_Sales.qvw](XmlSimple, Table is [DocumentSummary/LineageInfo])
where right(Discriminator,3)='qvd'
;

store * from mytable into myfile.bat (txt);

13 Replies
qlikviewforum
Creator II
Creator II
Author

Any update from anyone on this?

marcus_sommer

I'm not sure if a copy-handle on file-level and then generated per qv-load is an effective and stable way. I think you should use rather tools like robocopy: http://www.wintotal.de/robocopy-der-kopier-gigant/ on folder-level. The link-content is in german but you could translate it with google translator and I'm sure you will find other sites with similar content in english and other languages.

- Marcus

qlikviewforum
Creator II
Creator II
Author

Thank you! I don't want to use any tools. I would like to create batch file so that it can executed manually so that it can copy the files from source to destination.

marcus_sommer

This would work if your data-path haven't spaces and other special chars which requirre quotes for the batch-statement. I don't know if copy worked with unc-path, if not try it with xcopy/robocopy and similar. If you want execute the batch indepently from the qvw remove the execute-statement.

BatchStatement:
Load
    'COPY /Y ' & Upper(Discriminator) & ' ' & Replace(Upper(Discriminator),'D:\DATA\','D:\') as [Echo Off]
FROM (XmlSimple, Table is [DocumentSummary/LineageInfo]) 
where right(Discriminator,3)='qvd';

store BatchStatement into (txt, no labels, delimiter is ';', msq );

sleep 500;

Execute cmd.exe /C "D:\BatchStatement.cmd";

- Marcus

Anonymous
Not applicable

Here in this pivot table i m having the issue with the Performance Total it is varying .

It should be Sum([Coperate SLP])*[Performance])

Means (103*106)+(0*111)=109.18 but its displaying as 111 that is the problem over here.

mon.PNG

marcus_sommer

Hi bunnyqlik,

what had your comment to do with the topic from this post? Please delete this and create a new posting for it.

Anyway, you need to react on null-values, maybe with rangesum() or alt() and for the calculation for the totals you might need aggr()  - http://community.qlik.com/blogs/qlikviewdesignblog/2013/08/06/it-s-all-aggregations.

- Marcus

qlikviewforum
Creator II
Creator II
Author

Thanks Marcus

Data path may have or may not have spaces but it should work in any of the cases. As discussed earlier is there is any other way to create the copy command as per the request. I don't wish to use anyother tool.

marcus_sommer

I don't understand what your use-case is? Like above mentioned I would prefer a copy or synchro on folder-level to reach a rather long-term solution. Tools like robocopy are very flexible to include/exclude folder/files/extensions and so on.

Within qv I would rather load a list of qvw's (per inline or filelist-statement) and store whose source-qvd's in a txt-file which would be read in a loop from a batch- or vbs-file for further actions.

- Marcus

qlikviewforum
Creator II
Creator II
Author

My use case was to create a copy command for all the QVD's that has been used in the QVW using QV program instead of using any tools.

As you have explained above how this can be taken care in QV. Can you share some sample application on how this can be achieved? Please help!