Please excuse this long-winded post ? but there is no short way to explain this. Now that my recent grumpiness has abated (sorry), I?m back to worrying about the List CSV Import/Export feature. I don?t give up easy - on myself or Fabrik.
As I?ve mentioned in other posts, my project provides surveys that collect ?compensation data? (basic numeric wage/salary data for job positions) for the healthcare industry. I find it hard to believe that no one has ever had the need to do what I want to do with Fabrik, as Hugh suggested to me last week. Or maybe they have, but soon came to realize that the Fabrik CSV Import/Export tool doesn?t allow them to do it???
For some quick background? Until I came along, my client/boss was providing these (similar) surveys to her clients (thousands of them) as Excel spreadsheets - which allowed them to complete the surveys offline, at their leisure, using the tools available with Excel and/or similar software used within their organization.
So I need to provide these ?Export? files as valid Excel files (xls xlsx). I have created some php code that uses the phpExcel Library to convert the CSV generated by Fabrik into a true Excel Workbook/Worksheet.
However, there are many problems ? or at least hurdles ? that I must overcome in order to work with the standard List CSV Export/Import feature of Fabrik ? which would make it a LOT easier than having to hard-code all of it.
Export
1. These ?Excel CSV? files that are exported as ?Excel compatible? files by Fabrik are very confusing when opened in Excel. Anyone who has ever tried this knows what I mean. That is why I need to convert them to true Excel files first.
2. The CSV export does not provide a means to format the numeric data properly. E.g. An hourly wage of $23.20 appears as 23.2 (aligned-left) rather than 23.20 (aligned-right). Nor does it allow me to freeze the header, lock cells, hide columns, format cells, etc. That?s where the magic of phpExcel comes in to play.
3. All of the survey data is stored in one ?master? file that is used to create reports/visualizations. So, although, I use the same file to collect and store the data, there are 7 different Menu configurations to set the correct pre-filters on the elements needed for the various types of surveys. However, the Export options that are setup in the Fabrik List params are not changeable on a per-page/per-menu-item basis. It would be optimal to allow the setup for the filters to be controlled by the menu params, not the List params ? although I suppose I can work around that by writing some php code to identify what menu option is being used.
4. These exported files are also being stored online, in the user?s ?personal files area? (using jsmallfib) ? so every file generated needs to have a unique file name and needs to be stored in a unique ?user? folder, depending on the user and the type of survey data it contains. Some users might have a dozen different, surveys ? for different survey types and for different facilities. E.g. they might be entering data for 3 different hospitals, 3 different Hospice facilities, etc. - and that data needs to be identifiable yet separated.
So I have written some post-processing code that converts the exported CSV into the type of Excel file the user wants, formats and re-names it appropriately, and stores it in the appropriate folder in their ?Personal files area?. The users now have an Excel Worksheet every bit as user-friendly? as the Excel surveys my client had been sending them for years.
5. However, the big problem with the CSV export is that the ?Front end options? are not configurable ? other than to show them or not show them. It?s all or nothing. The CSV export popup that is shown if ?Front end options? is set to ?Yes? allows the user to change what is already setup in the List params ? and to make matters worse, the options in that popup don?t even default to the values that have been set in the List parameters! (I just posted some code at github that fixes that and hopefully it will get added to the Fabrik core.) That way I can at least hide the options via javascript that I don't want them to change.
6. If the list includes a joined table and the Lists CSV 'Front End options' is set to 'Yes', the fields are generated in the expected column order (as set in the 'Show in list' parameter) - but if the 'Front end options' parameter is set to 'No', the fields for the joined table are always added as the last columns.
7. That 'Front end options' popup also includes options for ?Form fields? (elements not shown in the list) ? something I don?t want the user to be able to add to their exported file. In other words, I want the Export to ALWAYS include ONLY the elements that are ?Visible? (shown in the list) ? and there is really no way to do that, unless I use 'Allow front options' and give the user the options to change everything else too - something I don't want, not to mention it only confuses the end-user (like they would have any idea what the table_names and 'Form fields', etc. really are).
So the List parameters are useless for me as is. Yet I don?t see it being too difficult to fix these issues and accommodate the changes needed to make this work - for me and any other past, present or future Fabrik developers.
Import
1. The user is able to upload more data in their Import than was included in the Export. I NEVER want the user to be able to include more rows than were included in the exported file. In other words, the export and import file will always have the same number of rows with the same PK IDs (which I can hide in the spreadsheet when the file is converted via the phpExcel library). And the import must ignore any rows other than those that are already included in the list (filtered for that user/facility). It seems those rules could easily be set in the list or menu parameters.
2. Right now, the import is adding ?default values? to elements ? for those elements not included in the import (those not visible/shown in list). Just because there is no value for every element in the list does not mean that the row updated on import (when ?Overwrite? is set to yes) needs to have the values for those non-included elements reset to their ?default value?!
3. As mentioned, in my situation, the file that is Imported needs to ALWAYS be an ?Overwrite?. HOWEVER, the user interface for CSV Import always shows the ?Overwrite? option, allowing the user to change that. And again, that Overwrite option always defaults to ?No? - when for me, for this list anyhow, it should always default to ?Yes? (so I can at least hide it from the user via javascript and prevent them from changing it).
It seems to me that is can?t be too difficult to write some code that will set those Import options (on the front end) to default to whatever is set in the List parameters (like I just changed for the Export ?Front end options? popup). But as is now, those List Parameters are only used if the ?Front end option? is set to ?No?. However, in that case, the ?Overwrite? option is set to ?No? also. So there?s no way to change it without allowing the user to change all the other options that I don?t want changed! I?m stuck here between a rock and hard place.
In a follow-up post, I?m going to attach some screen captures showing the additional fields I added to the list parameters to handle all this, in the hopes that I can work with the Fabrik team to get this working the way I need it to work. There I will explain what each new parameter does and why (I feel) it wouldn?t really be that difficult to incorporate them into the Fabrik core.
If anyone sees this as something they too would like to see implemented, PLEASE speak up and respond to this thread so that Rob, Hugh, and the rest of the Fabrik team recognizes that it?s not just something that only I would ever use, or think that it?s not worth the effort to implement. Many of the things I listed are not just 'my problem' - they are things that just don't work right and should be fixed.
As I?ve mentioned in other posts, my project provides surveys that collect ?compensation data? (basic numeric wage/salary data for job positions) for the healthcare industry. I find it hard to believe that no one has ever had the need to do what I want to do with Fabrik, as Hugh suggested to me last week. Or maybe they have, but soon came to realize that the Fabrik CSV Import/Export tool doesn?t allow them to do it???
For some quick background? Until I came along, my client/boss was providing these (similar) surveys to her clients (thousands of them) as Excel spreadsheets - which allowed them to complete the surveys offline, at their leisure, using the tools available with Excel and/or similar software used within their organization.
So I need to provide these ?Export? files as valid Excel files (xls xlsx). I have created some php code that uses the phpExcel Library to convert the CSV generated by Fabrik into a true Excel Workbook/Worksheet.
However, there are many problems ? or at least hurdles ? that I must overcome in order to work with the standard List CSV Export/Import feature of Fabrik ? which would make it a LOT easier than having to hard-code all of it.
Export
1. These ?Excel CSV? files that are exported as ?Excel compatible? files by Fabrik are very confusing when opened in Excel. Anyone who has ever tried this knows what I mean. That is why I need to convert them to true Excel files first.
2. The CSV export does not provide a means to format the numeric data properly. E.g. An hourly wage of $23.20 appears as 23.2 (aligned-left) rather than 23.20 (aligned-right). Nor does it allow me to freeze the header, lock cells, hide columns, format cells, etc. That?s where the magic of phpExcel comes in to play.
3. All of the survey data is stored in one ?master? file that is used to create reports/visualizations. So, although, I use the same file to collect and store the data, there are 7 different Menu configurations to set the correct pre-filters on the elements needed for the various types of surveys. However, the Export options that are setup in the Fabrik List params are not changeable on a per-page/per-menu-item basis. It would be optimal to allow the setup for the filters to be controlled by the menu params, not the List params ? although I suppose I can work around that by writing some php code to identify what menu option is being used.
4. These exported files are also being stored online, in the user?s ?personal files area? (using jsmallfib) ? so every file generated needs to have a unique file name and needs to be stored in a unique ?user? folder, depending on the user and the type of survey data it contains. Some users might have a dozen different, surveys ? for different survey types and for different facilities. E.g. they might be entering data for 3 different hospitals, 3 different Hospice facilities, etc. - and that data needs to be identifiable yet separated.
So I have written some post-processing code that converts the exported CSV into the type of Excel file the user wants, formats and re-names it appropriately, and stores it in the appropriate folder in their ?Personal files area?. The users now have an Excel Worksheet every bit as user-friendly? as the Excel surveys my client had been sending them for years.
5. However, the big problem with the CSV export is that the ?Front end options? are not configurable ? other than to show them or not show them. It?s all or nothing. The CSV export popup that is shown if ?Front end options? is set to ?Yes? allows the user to change what is already setup in the List params ? and to make matters worse, the options in that popup don?t even default to the values that have been set in the List parameters! (I just posted some code at github that fixes that and hopefully it will get added to the Fabrik core.) That way I can at least hide the options via javascript that I don't want them to change.
6. If the list includes a joined table and the Lists CSV 'Front End options' is set to 'Yes', the fields are generated in the expected column order (as set in the 'Show in list' parameter) - but if the 'Front end options' parameter is set to 'No', the fields for the joined table are always added as the last columns.
7. That 'Front end options' popup also includes options for ?Form fields? (elements not shown in the list) ? something I don?t want the user to be able to add to their exported file. In other words, I want the Export to ALWAYS include ONLY the elements that are ?Visible? (shown in the list) ? and there is really no way to do that, unless I use 'Allow front options' and give the user the options to change everything else too - something I don't want, not to mention it only confuses the end-user (like they would have any idea what the table_names and 'Form fields', etc. really are).
So the List parameters are useless for me as is. Yet I don?t see it being too difficult to fix these issues and accommodate the changes needed to make this work - for me and any other past, present or future Fabrik developers.
Import
1. The user is able to upload more data in their Import than was included in the Export. I NEVER want the user to be able to include more rows than were included in the exported file. In other words, the export and import file will always have the same number of rows with the same PK IDs (which I can hide in the spreadsheet when the file is converted via the phpExcel library). And the import must ignore any rows other than those that are already included in the list (filtered for that user/facility). It seems those rules could easily be set in the list or menu parameters.
2. Right now, the import is adding ?default values? to elements ? for those elements not included in the import (those not visible/shown in list). Just because there is no value for every element in the list does not mean that the row updated on import (when ?Overwrite? is set to yes) needs to have the values for those non-included elements reset to their ?default value?!
3. As mentioned, in my situation, the file that is Imported needs to ALWAYS be an ?Overwrite?. HOWEVER, the user interface for CSV Import always shows the ?Overwrite? option, allowing the user to change that. And again, that Overwrite option always defaults to ?No? - when for me, for this list anyhow, it should always default to ?Yes? (so I can at least hide it from the user via javascript and prevent them from changing it).
It seems to me that is can?t be too difficult to write some code that will set those Import options (on the front end) to default to whatever is set in the List parameters (like I just changed for the Export ?Front end options? popup). But as is now, those List Parameters are only used if the ?Front end option? is set to ?No?. However, in that case, the ?Overwrite? option is set to ?No? also. So there?s no way to change it without allowing the user to change all the other options that I don?t want changed! I?m stuck here between a rock and hard place.
In a follow-up post, I?m going to attach some screen captures showing the additional fields I added to the list parameters to handle all this, in the hopes that I can work with the Fabrik team to get this working the way I need it to work. There I will explain what each new parameter does and why (I feel) it wouldn?t really be that difficult to incorporate them into the Fabrik core.
If anyone sees this as something they too would like to see implemented, PLEASE speak up and respond to this thread so that Rob, Hugh, and the rest of the Fabrik team recognizes that it?s not just something that only I would ever use, or think that it?s not worth the effort to implement. Many of the things I listed are not just 'my problem' - they are things that just don't work right and should be fixed.
Last edited: