Export from custom table to Excel using CommandMenu is empty.

I've created a custom screen showing sale records based on specific project criteria. (see example below)
But when I use the standard export to Excel function in the CommandMenu, I get an empty excel file!

When I remove the project criteria my excel file contains sale records. Why?

SearchEngine example:

SearchEngine seSales;
seSales.addField("sale.sale_id");
seSales.addField("sale.heading");
seSales.addField("sale.contact_id.name");
seSales.addField("sale.associate_id.name");
seSales.addField("sale.project_id");
seSales.addField("sale.project_id.name");
seSales.addField("sale.project_id.userdef_id.long19");
seSales.addField("sale.project_id.userdef_id.long20");
seSales.addField("sale.project_id.userdef_id.long21");
seSales.addField("sale.project_id.userdef_id.long22");
seSales.addField("sale.project_id.endDate");
seSales.addCriteria("sale.project_id.status_idx.name", "OperatorEquals", projectStatus, "OperatorAnd", 0);
seSales.addCriteria("sale.project_id.endDate", "OperatorGte", enddateFrom, "OperatorAnd", 0);
seSales.addCriteria("sale.project_id.endDate", "OperatorLt", enddateBefore, "OperatorAnd", 0);

for (seSales.execute();!seSales.eof();seSales.next())
{
// Some code

............

// Fill grid with values from search engine

  grid.setFieldValue("addRow", Map()
                     .insert("id=", saleId));

  grid.setFieldValue("addCell", Map("label=" + saleId));
  grid.setFieldValue("addCell", Map("label=" + listEndUsers.get(projectId)));
  grid.setFieldValue("addCell", Map("label=" + listProducts.get(projectProduct)));
  grid.setFieldValue("addCell", Map("label=" + listProcesses.get(projectProcess)));
  grid.setFieldValue("addCell", Map("label=" + listCountries.get(projectCountry)));
  grid.setFieldValue("addCell", Map("label=" + projectMonthYear));
  grid.setFieldValue("addCell", Map("label=" + projectHours));
  grid.setFieldValue("addCell", Map("label=" + listChances.get(projectChance)));
  grid.setFieldValue("addCell", Map("label=" + projectName));
  grid.setFieldValue("addCell", Map("label=" + saleContact));
  grid.setFieldValue("addCell", Map("label=" + saleHeading));
  grid.setFieldValue("addCell", Map("label=" + saleAssociate));
}

Example screen result (with project criteria):

Example export result (with project criteria):

When I remove the project criteria from search engine my export result looks like this:

Any suggestions?

RE: Export from custom table to Excel using CommandMenu is empty.

Late response, but I just figured this out myself, while having experienced the same issue as you described above Brian.

You need to add your cgiVariable(s) from your URL to the "Hidden Variables" tab in your custom screen, so the export to Excel function can actually use those values to calculate the correct output. Without adding those values, the cgiVariable(s) are missing, therefore the output remains empty. Your searchengine results are probably empty without the actual values of your cgiVariable(s).

Af: Bas Kreijveld 17. mar 2021

RE: Export from custom table to Excel using CommandMenu is empty.

Bas is right, or you can add persistent=true to your static table config to make it work as well.

Af: Dennis Pabst 22. mar 2021