Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi all!
I would like to display something very simple on the Welcome page of my QVW : the date and time of the last reload of the application.
To do so, I included in the loading script some tests :
LET vReloadToday = Today(0);
LET vReloadTime = LocalTime();
LET vReloadNow = Now();*
Then I tried to display those variables in textboxes. Textboxes showed only : -
But in the variables are the good times and dates (see images below).
Any idea?
It looks so simple I do not explain why Qlikview is not able to display simple time stamps. I also tried the DayName() function, but no result (well, wrong date in the textbox).

Just remove the $ from in front of your expression in text box.
Your wrote =$(vReloadNow )
Should be =vReloadNow
Just remove the $ from in front of your expression in text box.
Your wrote =$(vReloadNow )
Should be =vReloadNow
OK, great, it works!
But I do not understand why. What is stored in the variable? How come that I can call a variable without using $()?
When your using let no need $,
When using Set you can use $
'$' is required when you need expansion (that means something which is itself like an expression). But in your case, the variables hold the value itself after the load. So there is nothing to expand out of a value itself. Hope, this gives you an idea.
for better understanding, from help:
Dollar-sign
expansions are definitions of text replacements used in the script or in
expressions. This process is known as expansion - even if the new text is
shorter. The replacement is made just before the script statement or the
expression is evaluated. Technically it is a macro expansion.
A macro expansion always begins with '$(' and ends with ') ' and the content
between brackets defines how the text replacement will be done. To avoid
confusion with script macros we will henceforth refer to macro expansions as
dollar-sign
expansions.
Note!
Macro expansion is unrelated
to script macros (VB or Java script defined in the script module).
Note!
A dollar-sign expansion is
limited in how many macro expansions it can calculate. Any expansion over 1000
will not be calculated!
When using a variable for text replacement in the script or in an expression,
the following syntax is used:
$(
variablename )
$( variablename) expands to
the value in variablename. If variablename does not exist the expansion will be the empty
string.
For numeric variable expansions, the syntax $( variablename ) will generate a number using the regional
decimal separator, i.e. for many countries a decimal comma. Such an expansion
should not be used for numbers inside the script since these must use decimal
point. Instead the expansion $(# variablename ) should be used. (Note the hash
sign). It always yields a valid decimal-point representation of the numeric
value of variablename, possibly with exponential
notation (for very large/small numbers). If variablename does not exist or does not contain a numeric
value, it will be expanded to 0 instead.
Example:
After
execution of the following script:
SET DecimalSep=',';
LET X = 7/2;
$(X ) will expand to 3,5 while $(#X ) will expand
to 3.5.
Examples:
set Mypath=C:\MyDocs\Files\
...
load * from $(MyPath)abc.csv;
set CurrentYear=1992;
...
select * from table1 where Year=$(CurrentYear);
Parameters can be used in variable expansions. The variable must then contain
formal parameters, such as $1, $2, $3 etc. When expanding the variable, the
parameters should be stated in a comma separated list.
Examples:
set MUL=’$1*$2’;
set X=$(MUL(3,7)); // returns '3*7' in X
let X=$(MUL(3,7)); // returns 21 in X
If the number of formal parameters exceeds the number of actual parameters
only the formal parameters corresponding to actual parameters will be expanded.
If the number of actual parameters exceeds the number of formal parameters the
superfluous actual parameters will be ignored.
Examples:
set MUL=’$1*$2’;
set X=$(MUL); // returns '$1*$2' in X
set X=$(MUL(10)); // returns '10*$2' in X
let X=$(MUL(5,7,8)); // returns 35 in X
The parameter $0 returns the number of parameters actually passed by a call.
Example:
set MUL='$1*$2 $0 par';
set X=$(MUL(3,7));
// returns '3*7 2 par' in X
Expressions can be used in dollar-sign expansions.
The content between the brackets must then start with an equal sign:
$( =expression )
The expression will be evaluated and the value will
be used in the expansion.
Example:
$(=Year(Today())); // returns e.g. '2008'
$(=Only(Year)-1); // returns the year before the
selected one
File inclusions are made using dollar-sign expansions.
The syntax is then:
$( include=filename )
The above text will be replaced by the content of
the file specified after the equal sign. This feature is very useful when
storing scripts or parts of scripts in text files.
Example:
$(include=C:\Documents\MyScript.qvs);
Easier to understand now, thanks!