Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
Hannah_M
Contributor
Contributor

QV to QS Migration - script issue

Hi,

I am migrating an app from QV to QS and this section of script works fine in QV but I am getting script errors in QS.  Can someone please tell me what needs to change?  Thanks!

Screenshot 2022-07-05 160522.png

Labels (1)
3 Replies
Lisa_P
Employee
Employee

If your Path and QVD variables are valid within Qlik Sense syntax, the next thing is what is it testing using this if condition ? If QvdCreateTime of that QVD is what

Hannah_M
Contributor
Contributor
Author

Hi Lisa,

Thanks for your response.  The path variable is correct.  That is my question as well.  I did not create this script and the person who did no longer works here.  But what I do not understand, is I can run the app in QV, and it runs without any errors.

Here is the full script, if that helps.

Sub UpdateQVD(xFile)
//*****************************************
//Based on file name, determine file type and define variables for incremental loading

//Assign File Type a Number for Switch Statement
Let xFileName = Subfield(SubField('$(xFile)','\',-1),'.',1);
Let xFileType = Match(Left('$(xFileName)',3),'CUW','Foc','Hit');
Let xPeriod = Right('$(xFileName)',6);
//Assign QVD name, Excel Document Prefix, Excel Sheet Name, and Period Suffix to file based on Type
Switch xFileType

Case 1 //Exceptions Summary

Set xQVD = 'ExceptionsSummary.qvd';
Set xExcel = '$(vExceptions)';
Set xSheet = '$(vExceptionsSheet)';

Case 2 //Policy Summary

Set xQVD = 'PolicySummary.qvd';
Set xExcel = '$(vPolicy)';
Set xSheet = '$(vPolicySheet)';

Case 3 //Hit Rate

Set xQVD = 'HitRate.qvd';
Set xExcel = '$(vHitRate)';
Set xSheet = '$(vHitRateSheet)';

EndSwitch

//*****************************************
//Incremental Load
If QvdCreateTime('$(vQVDPath)/$(xQVD)')
//OldData
Data:
Load * From "$(vQVDPath)/$(xQVD)" (qvd) WHERE Period <> '$(xPeriod)';
ENDIF

//NewData
Data:
Load '$(xPeriod)' as Period, *
FROM
"$(vFilePath)/$(xExcel)$(xPeriod).xlsx"
(ooxml, embedded labels, table is [$(xSheet)]);

//Store Data and Drop Table
Store * from Data into "$(vQVDPath)/$(xQVD)";

Drop Table Data;

ENDSUB

marcus_sommer

Sense requires within the standard-mode specified connections to the sources which are then called with lib - I assume that's not done yet. Alternatively you may enable the legacy-mode which accept the previous QlikView syntax.

- Marcus