Skip to main content
Announcements
Accelerate Your Success: Fuel your data and AI journey with the right services, delivered by our experts. Learn More
cancel
Showing results for 
Search instead for 
Did you mean: 
jjustingkm
Creator
Creator

print table column value to the log

I am trying to write a loop to print out  each row of the field  in a table to the log.

Thanks for the help.

Labels (1)
1 Solution

Accepted Solutions
rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

The TRACE statement can write to the script log. You need to get your value of interest into a variable and then use the variable in a TRACE statement. 

If you want to print the distinct values of a field (eg "Name"), you can do it like this:

For i = 1 to FieldValueCount('Name')
  Let vName = FieldValue('Name', i);
  TRACE $(vName);
Next i

If you want to print the value of a field "Name" for each row of a resident table (eg "Transactions") you can do so like this:

For i = 0 to NoOfRows('Transactions')-1
  Let vName = Peek('Name', i, 'Transactions');
  TRACE Row: $(i) Name: $(vName);
Next i

-Rob
http://www.easyqlik.com
http://masterssummit.com
http://qlikviewcookbook.com

View solution in original post

1 Reply
rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

The TRACE statement can write to the script log. You need to get your value of interest into a variable and then use the variable in a TRACE statement. 

If you want to print the distinct values of a field (eg "Name"), you can do it like this:

For i = 1 to FieldValueCount('Name')
  Let vName = FieldValue('Name', i);
  TRACE $(vName);
Next i

If you want to print the value of a field "Name" for each row of a resident table (eg "Transactions") you can do so like this:

For i = 0 to NoOfRows('Transactions')-1
  Let vName = Peek('Name', i, 'Transactions');
  TRACE Row: $(i) Name: $(vName);
Next i

-Rob
http://www.easyqlik.com
http://masterssummit.com
http://qlikviewcookbook.com