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
something got wrong in the copy paste.
I meant
....
for
let .....
a=3 to 4unfortunately the copy paste does not go in the right way
I hope you understand
Hello,
Why don't you use a WHERE clause?
NumerieLettere:Load Numeri, LettereFROM [Numeri e Lettere.xls](biff, embedded labels, table is [Foglio1$])WHERE Match(Numeri, 4, 5);
That should load from your excel file only records where field "Numeri" has values "4" or "5".
Hope that helps.
Thanks Miguel
hi,
here it unfortunately doesn't work as you hope. not very clear what you are trying to achieve. try to explain a bit more. and if you try to include a code in your post, follow
http://community.qlik.com/forums/p/15789/61380.aspx
with this your code would come well formatted.
Regards, tresesco
Thanks Tresesco.
Let's see if I can do it.
I would like to fill the new table with the values assigned to "a" in the "for" statement, so if I say "for a=3 to 4" I should see the numbers 4 and 5 but in my table I see only the number 4, I can't fill the new table.
Thanks all for helping
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 a=3 to 4
let varmyNumber = peek('Numbers', $(a), '[NumberLetterTable]');
[Lista Numeri e Lettere]:
load '$(varmyNumber)' as myNumberCharacter
AutoGenerate(1);
next
so you have done it !
what you are trying using PEEK - telling the position from where (which of the pre-loaded records) to be picked. if this is what you want (positioned based values to pick), your code is probably to the right direction. if you are trying the exact numeric values (3 and 4) to pick then Miguel's suggestion is to be followed (provided the values are there in loaded data). i find one more possibilty you could attempt to : you might try to generate those values your own, in that case you have to rewrite the code somewhat like :
Load $(a) as MyNumberChar
Autogenerate (1);
Next
Probably PEEK would not be required.
Regards, tresesco
sorry it came as a repeatation
Thanks Tresesco
I will work on your suggestion
Antonio