The Form Tools forums are no longer active, but the old posts have been archived here. Please see the Help page on how to get help / report issues.

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to display number counter in excel export?

Previously I asked on how to display a number field(auto increment/updated) in the table column.
I figure this is too complicated and i'm using API forms.

Is it possible to display an auto-increment number(No.) when exporting to excel?
No. ColumnName
1 entry
2 entry
3 entry

Maybe somewhere at the export manager here:
{* display the column headings *}

I guess this will also work for html tables.

Hi Ferri,

Sorry for the wait!

Sure, no problem. You're quite right: the solution I posted *was* complicated - but it's nice in that it keeps everything sorted and consistent in the database. To do it simpler, with just having a numbered list on the outputted Excel output, just create a new Export Type (in the Export Manager module) for the Excel Export Group with the following code.


<table cellpadding="2" cellspacing="0" width="100%" class="print_table">
{* display the column headings *}
  {foreach from=$display_fields item=column name=row}

{* loop through all submissions in this current result set, and display each item in a manner
   appropriate to the field type *}
{foreach from=$submissions item=submission name=row}
    {foreach from=$display_fields item=field name=col_row}
      {assign var=field_id value=$field.field_id}
      {assign var=field_type value=$field.field_info.field_type}
      {assign var=col_name value=$field.col_name}
      {assign var=value value=$submission.$col_name}
      {if $field_type == "select" || $field_type == "radio-buttons"}
        {smart_display_field_values field_id=$field_id selected=$value}
      {elseif $field_type == "checkboxes" || $field_type == "multi-select"}
        {smart_display_field_values field_id=$field_id selected=$value multiple=true}
      {elseif $field_type == "system"}
        {if $col_name == "submission_id"}
        {elseif $col_name == "submission_date"}
        {elseif $col_name == "last_modified_date"}
        {elseif $col_name == "ip_address"}
      {elseif $field_type == "textarea"}




And that's it! All the best Smile

- Ben


Forum Jump:

Users browsing this thread: 1 Guest(s)