For Each widget annoying warning

There is a very annoying warning on the For Each widget.

- I have a query in Preparation, and it's binded to a TableRecords widget.
- The TableRecords widget only shows 15 records at a time;
- The screen has an ExportToExcel action that must export all the query records (and not only the records presented on the table at the time);
- The Excel must have custom column names, so I've create a structure;

For me, the best approach would be to use a RefreshQuery widget on the Action, before the export, and then fill the structure using a For Each widget.

What is the Problem?
If I assign the query to the For Each widget, and because it is binded to a TableRecords, I get the annoying "Scalability Suggestion Warning" saying that:

"For Each 'Start Index' should be set with 'List_Navigation_GetStartIndex(Table.Id, False)', and the 'Maximum Iterations' should be set with 'Table.LineCount' to match the number of displayed records."

But, if I accept the suggestion, my action will not export all the query records but only the records that are visible in the TbaleRecords, because it "forced" me to set the Maximum Iterations to the line count of TableRecords.

What solutions do I have?
Normally I see only two:
1. Hide the warning
2. Create a second query in ExportToExcel action

Personally I don't like both. I don't like warnings at all, and hate to hide them. And create a second query is a very bad approach, because if I'm using advanced queries, everytime I change the first query I also need to fix the export query.

My question is... why is the For Each widget so rigid? Why can't we use it the way we want\need without having warnings that sometimes don't even have a purpose.
In this case, the solution provided by the warning is not valid, because the final result is not the same I was trying to achieve.

This is nothing new. It just bothered me again, and decided to create the thread to discuss it :)
Hi Carlos,

The correct solution is the "2".
The warning is for optimization purposes, because in the normal scenario your preparation query only needs to return 15 results.
If you have a For Each with more iterations then it must result all results and send everything to the Viewstate (to the browser and sent back on all requests).

So the ideal is to create a second query specifically for the ExportToExcel.

Note that there is also a "3" option of using a local variable to hold the result of the query. But is as bad for the optimizer as hiding the error and will cause you more complications if your screen has Ajax refresh/List Append operations.

João Rosado
I am getting the same error on submit action. I am just using appened list to copy data from one list to other. any way to fix this warning? The suggestion in warning does not work.

Scalability Suggestion
For Each 'Start Index' should be set with '0', and the 'Maximum Iterations' should be set with 'systemListRecords.LineCount' to match the number of displayed records.