Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi Everyone!
All my project related files/qvd's/qvs/etc are stored in D:\Data1\<file names>
So, I am using an variable as
SET v1= '.\'
But, what if the file is located in the C:\<file name> how write the path to store into an variable.
If I am using SET v2='\' it is searching in the 'D:\' and throwing an error as 'File not found D:\Data1\<File Name>'
Can any one help in understanding the same and what is the difference between
SET v1='..\' and SET v1='.\'
Because the .QVW is saved on the D-drive.
..\ is a relative path. the relative path is based on the location of the .QVW.
Hi,
if you want to add drive as well you can keep a separate file contains all the variable with full path.
include the file and use it. if you want to change the drive just change the filename which is contains correct paths
Hope it might useful
Hi @parvez933,
You can use SET and LET to define a variable. With SET you just basically enter the text, while with the help op LET you can make it dynamic.
As far as I understood I think there are two solutions
1. use an IF statement in the script.
Table: LOAD * FROM Datasource;
IF $(v1) <> TO '????' THEN
STORE Table into $(v2) ;
ELSE
STORE Table into $(v1);
END IF
2. Make the variable dynamic.
LET v3 = IF('D:\Data\'<> '????','E:\Data\','D:\Data\';
STORE Table into $(v3);
Hi @parvez933,
You could check the error message, en when it exists then you pull the data from v2.
SET ErrorMode = 0;
LOAD * FROM $(v1);
// Check the error message
Errors:
LOAD
'$(ScriptError)' AS Error
AutoGenerate (1);
IF LEN(PEEK('Error',-1,'Errors'))>0 THEN
// In case of error:
LOAD * FROM $(v2);
END IF
Hey Thank You for the response!
But I am looking for something else.
Can I know! How can we read the data from 2 different files which are stored in different Drives , and how to store the path into an variable.
Ex:
File1---> D:\Data\Datasource\File1
Since, my project is store in the same folder of D drive. I will store the path into a variable as
SET v1='..\' or SET v1='.\'
and I will use load * from $(v1)File1
It is working good as the project and file is located in the same folder of Data source.
The File2---> D:\Else\Doing\File2
For which I used SET v2= '..\'
It is also working. Here the main thing is I want the Drive Names [D:\ or E:\] should be removed
In the same way! how can I store the file path which is stored in E drive without using the Drive name
Ex:
File3----> E:\Dumb\nosense\File3
How to write it to avoid using the DRIVE name
Set v3='.\' or '..\' or '\Dumb\Nonsense\'
Because the .QVW is saved on the D-drive.
..\ is a relative path. the relative path is based on the location of the .QVW.