
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
for each loop on a field
Hello,
Would it be possible to use "for each" loop on a field of a table?
Like:
Let vfileList = Some_Kind_of_Function('fieldName'); //fieldName is a field of a table
for each vfile in $vfileList
Do something....
next
Thanks,
Josh
- Tags:
- qlikview_scripting


- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Use this code pattern:
For i = 0 To NoOfRows('tableName') - 1
Let vVal = Peek('fieldName', i, 'tableName');
// do something ....
Next
Edit - added the '-1'

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Can you please explain the scenario?
Data:
Load Field1,
Field 2
From Table
let vFieldValueCount = FieldValueCount ('Field1');
For i=1 to $(vFieldValueCount)
let vFieldValue = FieldValue('Field1',$(i));
...
...
Next i

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
Thanks for answer.
Sorry I forgot the mention he point.
I want to drop the table as soon as the field is set to a list variable.
Thanks,
Josh


- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
OK, so add the line
Drop Table tablename;
What precisely do you mean by "list variable"?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Data:
Load Field1,
Field 2
From Table
let vFieldValueCount = FieldValueCount ('Field1');
For i=1 to $(vFieldValueCount)
let vFieldValue = FieldValue('Field1',$(i));
...
...
Next i
drop table Data;
