Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Good Morning,
I am new to Qlikview.
I hope someone will help with the following exercise.
I load a table from an Excel spreadsheet "Numeri e Lettere.xls" then I want to create a table with two numbers (i.e.: 4 and 5)
Numeri | Lettere |
1 | a |
2 | b |
3 | c |
4 | d |
5 | e |
6 | f |
7 | g |
8 | h |
9 | i |
10 | j |
This is the script:
NumerieLettere:
Load
Numeri
,
Lettere
FROM
[Numeri e Lettere.xls]
(
biff, embedded labels, table is [Foglio1$]);
tempNumberLetter:
LOAD
Numeri
as Numbers,
Lettere
as Letters
Resident
NumerieLettere;
NumberLetterTable:
LOAD
Numbers
Resident
tempNumberLetter;
for
let
load
'$(varmyNumber)' as myNumberCharacterAutoGenerate
(1);
next
DROP
Table tempNumberLetter; varmyNumber = peek('Numbers', $(a), '[NumberLetterTable]');[Lista Numeri e Lettere]:
a=3 to 4as you can see only the number 4 is shown:
I will appreciate your help
Thanks
Antonio
Perfect it works
Thank you all
for a=3 to 4
//let varmyNumber = peek('Numbers', $(a), '[NumberLetterTable]');
[Lista Numeri e Lettere]:
load '$(a)' as myNumberCharacter
//load '$(varmyNumber)' as myNumberCharacter
AutoGenerate(1);
next
Hello,
Unless there is no other way to get what you want, I'd avoid the use of loops because of poor performance and ease of use of alternatives.
Anyway, the Peek() function takes in its three parameters version, both field and table name as literal (string). So changin your current line to this one (removing square brackets from [NumberLetterTable]) should return as expected:
peek('Numbers', $(a), 'NumberLetterTable');
Hope that helps.
Hi Miguel,
Yours is a very valid point. may be my understanding was not exact, i suggested the solution assuming that the data (3,4) is not there in the loaded data(as i explained in my prev post too), so autogeneration(generate the data of your own) is the only option and loop is a consequent. Otherwise you are right.
Regards, tresesco
I restored "peek" and got rid of the brackets and everything works fine:
Thank you all
Antonio