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
Table Migration
First of all, incredible upgrade! Thanks a million for your hard work! I love the Export Manager feature!

Here's my scenario...

I have a table within my database, which stores my "live" data. This data is displayed on a page within my site. Visitors have the ability to complete a form which will add themselves to this database. Due to database integrity, I simply have this data saved within Form Tools, where I can "approve" each entry...export it...and re-import it into my "Live Data" table.

After seeing the new Export Manager feature, it got me thinking. Before I jump into this project... how complex do you think it would be to add a "Direct Export/Import" option. Basically, upon data can be merged/moved from Form Tools into my "live data" table.

Thanks again for an incredible system Ben!
Thanks! I rather like this module too... Smile Awfully powerful.

Quote:how complex do you think it would be to add a "Direct Export/Import" option. Basically, upon data can be merged/moved from Form Tools into my "live data" table.

Interesting idea...! One solution would be to create an "SQL" Export Type in the Export Manager that generates the data in a giant list of SQL insert statements. This much would be pretty simple. You could then rig it up to generate that information on a file on your server, which you could then use (say on a cron job / scheduled task) to be imported to the "live" database. Do-able, definitely, but dealing with the cron stuff would be rather fussy... plus there's no good way to merge the information - you'd probably end up empting the table right and then re-insert all values.

But from what you've told me so far, perhaps this solution may be a whole lot simpler:

1. Drop the "live" table altogether.
2. Add a "live" field to your form (which is only accessible by you, the administrator to set to "yes" or "no").
3. That's pretty much it! That information (i.e. the live data) can then be displayed on your website using the API. I wrote a couple of functions for exactly this purpose: ft_api_show_submissions and ft_api_show_submission.

You can customize them to show the information in whatever manner you want - e.g. showing a subset of the fields, only in a specific order.

You may well have other reasons to keep the live table, in which case this is rather moot. But let me know if I can help at all!

- Ben
(Mar 4th, 2009, 2:41 PM)admin Wrote: 2. Add a "live" field to your form (which is only accessible by you, the administrator to set to "yes" or "no").

Interesting. So if I'm understanding you correctly...

The "yes" or "no" field would function something like this... A checked "yes" means data will be displayed on the live page, and a checked "no" means data is not live yet? That sounds simple enough...really exactly what I'm looking for. I simply need the ability to "approve" what's being entered, before the whole world see's it!

Thanks for your response! I'm planning on tackling this project this afternoon. We'll see how it goes!
Good luck!

[And yes, that was exactly what I had in mind - very simple].
Ok...I finally got a chance this morning to tackle this small project. I figured the first step is to check out your API to display my submissions on a page within my site. I'm returning the following error message...

Fatal error: Smarty error: [in evaluated template line 17]: syntax error: unrecognized tag 'smart_display_field_values' (Smarty_Compiler.class.php, line 590) in htdocs/admin2/global/smarty/Smarty.class.php on line 1095

I'm sure it's something fairly basic, but I'm a bit puzzled on this one.

Thanks Again!

Ah yes, I think the problem is just the export type content. I made several bug fixes to the Smarty content in the export types but couldn't include a fix for them in the upgrade because it would potentially overwrite custom mods that people could have made.

Could you post the contents (the Smarty content) of the export type that you're using in your API call? It's found in Export Manager -> Edit Export Group -> Export Types Tab -> Edit Export Type -> Smarty Template value.

- Ben

  {* escape the CSS so it doesn't confuse Smarty *}
  <style type="text/css">
  body { margin: 0px; }
  table, td, tr, div, span { font-family: verdana; font-size: 8pt; }
  table { empty-cells: show }
  #nav_row { background-color: #efefef; padding: 10px; }
  #export_group_name { color: #336699; font-weight:bold }
  .print_table { border: 1px solid #dddddd; }
  .print_table th { border: 1px solid #cccccc; background-color: #efefef; text-align: left; }
  .print_table td { border: 1px solid #cccccc; }
  .page_break { page-break-after: always; }

  <style type="text/css" media="print">
  .no_print { display: none }


<div id="nav_row" class="no_print">

  <span style="float:right">
    {* if there's more than one export type in this group, display the types in a dropdown *}
    {if $export_types|@count > 1}
      <select name="export_type_id" onchange="window.location='{$same_page}?export_group_id={$export_group_id}&export_group_{$export_group_id}_results={$export_group_results}&export_type_id=' + this.value">
      {foreach from=$export_types item=export_type}
        <option value="{$export_type.export_type_id}" {if $export_type.export_type_id == $export_type_id}selected{/if}>{eval var=$export_type.export_type_name}</option>
    <input type="button" onclick="window.close()" value="{$LANG.word_close|upper}" />
    <input type="button" onclick="window.print()" value="{$LANG.word_print|upper}" />

  <span id="export_group_name">{eval var=$export_group_name}</span>

<div style="padding: 15px">


Ah! That's actually the Smarty template for the main export group - that pulls in all export TYPES within the group. Could I get the Smarty template for the particular TYPE that you're using? (it'll probably be "HTML / Printer-friendly" or one of those).

thx !

- Ben
(Mar 9th, 2009, 12:32 PM)admin Wrote: Ah! That's actually the Smarty template for the main export group

My sincere apologize! This would be my adult A.D.D kicking in... with my extreme lack of paying attention to clear instructions! Smile

I believe this is what you really needed...


{* loop through all submissions in the current result set *}
{foreach from=$submissions item=submission name=row}
<table cellpadding="2" cellspacing="0" width="100%" class="print_table">

  {* loop through all fields in the current View *}
  {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}
      <th width="140">{$field.field_title}</th>
        {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"}

<br />
Huh! Turns out that it looks just fine!

What version of the module and Core are you running? You can find this out on the Settings -> Main tab and the Modules page, respectively.

You may want to try just going to your Settings > Main Tab and clicking on the "Check for Updates" button. That will link you to the FT website where you have the option of upgrading whatever components you want.

It *sounds* like you're running an older version of the Export Manager, but I'm not 100% positive just yet...

If you're all up to date, I may need to debug the problem directly.

Sorry for the long response on all this! We should have you up and running soon. :-)

Forum Jump:

Users browsing this thread: 1 Guest(s)