Forums

Database column type problems for Excel

Timka 03 Oct, 2010
Hi,

I've made a multi-page form with a link to a database. This all works fine. I receive emails and the records get saved. However, I have got two problems with the way chronoforms saves the input.

1. Date format.
The date gets stored like this: 2010-09-22 - 15:17:13

I need to get rid of the dash (-) for excel to understand that it's a date. This is important for my formulas in the sheet I copy these in. My form gets thousands of records every month so it is an enormous task to edit every line manually.

Is there a way to code it so the dash isn't created?


2. Currency format.
I tried different column types like: varchar(255) and decimal but both dont completely work.

Varchar(255) doesn't get stored as a number and Decimal seems to round the numbers up to a whole number instead of a decimal number. Really weird because my understanding is that the Decimal column type is especially meant for this.

Does anyone know how to fix this?

Any help would be much appreciated.

Greetings,

Timka
Max_admin 04 Oct, 2010
Hi Timka,

#1- Try to set a new field for the date and use PHP to send the current date in the format you want (using JRequest::setVar , examples on forums), ignore (or drop) the default Chronoforms date field from your table.

#2- did you try to use float ? I think that should work.

Regards,
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
GreyHead 04 Oct, 2010
Hi Timka,

You need to specify the field as DECIMAL(x, 2) to get two decimal places (x can be from 2-65 depending on the size of number you expect - something like 12 is probably good.

You may need to use PHPMyAdmin to specify this for the column.

Bob
Timka 14 Oct, 2010
The Decimal type worked when I put in (10,2) in PhpMyAdmin. Really quite logical now that I've done it.

The Date problem solved it's own so I didn't needed to code that.

Now my only problem seems to be that chronoforms uses a dot (.) as a decimal sign and thise doesnt coop with excel. I found this topic about a guy who managed (with the help of greyhead) to recode it so that it would be comma's that be decimal signs.

He posted the eventual coding but I can't seem to figure out where to paste it and what to add. My understanding is that he only needs it for 1 form but I want it to be that way in all my forms.

Here is the link to his topic:
http://www.chronoengine.com/forums/index.php?option=com_chronoforums&cont=posts&f=5&t=16108&p=41944&hilit=decimal+comma#p41944

Can you tell me where to put the coding?

Again, thank you so much for helping me with the last question. This saves me hours of work retyping in excel.

Greeting,

Timka
GreyHead 14 Oct, 2010
Hi Timka,

This isn't really a question of how ChronoForms handles the data but of how you get the data stored in the MySQL table into Excel. The code that you linked to was about validating data input using the comma as a decimal point.

The easy answer - from my end - is to set the spreadsheet to use a . as the decimal point.

Otherwise I think you need to build a custom exporter that will read the data from the table and convert the format before exporting to Excel.

Bob
This topic is locked and no more replies can be posted.