I’m trying to export ALL records from a Visual Collection to excel.
My code looks like:
Imports System.Runtime.InteropServices.Automation
Namespace LightSwitchApplication
Public Class Assignacions_GR_a_DPT_o_IR_manuals
Private Sub ExportacioExcel_Execute()
Try
...
For Each GR In Me.A_LIGHTSWITCH_QUERY
rowCount += 1
excel.Cells(rowCount, 1).Value = GR.ToString
But only currently A_LIGHTSWITCH_QUERY showed records in grid are exported. Is there a way to get all query records?
Code is wrote in Screen Command Bar Execute Code.
EDITED
About your point 1,3 in Yann answer:
Screen has 2 queries: MAIN_QUERY and LOOKUP_QUERY.
First one, MAIN_QUERY, is binded to a grid.
LOOKUP_QUERY is a query to lookup values for a MAIN_QUERY field (Choices on an AutoComplete BOX).
For each loop iterates over LOOKUP_QUERY:
For Each GR In Me.LOOKUP_QUERY
And only LOOUP_QUERY items that appear in screen are retrieved from loop.
Sample:
MAIN_QUERY = ORDER LINE (QTY, Product, Order, ...)
LOOKUP_QUERY = PRODUCT (NAME, ...)
For Each P In Me.PRODUCT
Only retrieve product that appear in selected order, I need ALL products.
Notice that I can disable page, but if order does not contains at least a line for each product some products will be missed on export.
Answerd by Matt Evans at Visual Studio LightSwitch – General Questions forum: