Timestamp / Symbols in texte after csv import

If you're a new user of AppGini, feel free to ask general usage questions, or look for answers here.
Post Reply
manolo_1
Posts: 5
Joined: 2016-05-22 14:27

Timestamp / Symbols in texte after csv import

Post by manolo_1 » 2016-09-06 18:56

Hello,
Complete newbie here :mrgreen:
Made my first (and simple) DB via AppGini and pretty proud about the result so far :)

I have two questions, and I wonder if any one could help on this.

1/ When I want to add a new record in de detail view, a field which I called "time_reg" automatically fills out the current timestamp. (ex 00:00:00). Yet I would like this field to be empty when I add a new record, so I am able to fill out the time myself in a 00:00 format and avoid mistakes. My tabel is called "t_basis". I've looked in AppGini itself, because I thought this would be easy to fix, but I didn't found it yet.

2/ I've imported a list of ports via csv in a separate table. This actually works fine when I add new records. Yet I notice that the symbols in names (è, ñ, à, é,... etc) are changed into question marks (?) and stuff. I guess this has something to do with the language settings. I have been searching on this (even via phpmyadmin) but I don't really seem to get in done. It gives problems when I do a search. Don't want to change the symbols manually neither, since this list has more then 16000 records...

Thank you very much for your help !

grimblefritz
AppGini Super Hero
AppGini Super Hero
Posts: 336
Joined: 2015-12-23 16:52

Re: Timestamp / Symbols in texte after csv import

Post by grimblefritz » 2016-09-06 22:59

Welcome to the AppGini community!

1. When you make the field type 'time', it informs AppGini to generate a field with a timepicker. There is no control over the timepicker from within AppGini - you get what you get. You can also set the default time to the current time by making the field default value 0. However, I think what you want is simply a varchar field into which you can type the time. It won't be formatted or validated, but it will give you what you need.

2. Not something I've dealt with, so I'll let others chime in.

Back to your #1, if you check out the timepicker.js options, and done mind some coding, then you can alter how time fields are presented. It will require learning the AppGini hooks system, along with the timepicker.js options. Or, you could use a varchar field and add a masked input plugin.

As I'm not sure of your interest in coding, I'll skip the details for now. If you want more guidance, please ask.

peebee
AppGini Super Hero
AppGini Super Hero
Posts: 352
Joined: 2013-03-21 04:37

Re: Timestamp / Symbols in texte after csv import

Post by peebee » 2016-09-06 23:45

Q2. This is all guesswork as I don't deal with foreign special characters myself but I'm certain the issue will be related to character encoding and the format of the CSV you are importing.

As far as I'm aware UTF-8 should handle all special characters OK. Apart from AppGini character encoding settings and your database collation, you will also need to make sure that your CSV file for import is character encoded (Unicode UTF-8) accordingly too.

If you can enter/save data with special characters into new records without issue, then the problem would appear to exist in the CSV import process?

Not sure where you are sourcing your CSV file from but I'm going to assume it is Excel? That being the case, you will likely need to ensure that the exported CSV file is Unicode UTF-8 character encoded.

Here's some Google hints how to do that: https://www.google.com.au/webhp?sourcei ... code+utf-8+

If your CSV is not coming from Excel, I'd just Google whatever it is being generated by and how to ensure the output is UTF-8 encoded.

Hope that helps.

manolo_1
Posts: 5
Joined: 2016-05-22 14:27

Re: Timestamp / Symbols in texte after csv import

Post by manolo_1 » 2016-09-08 19:08

@ grimblefrits
Thanks a lot for your help. Changed it into VARCHAR and limited the number of characters. Works perfect for me, since nog time calculations etc has to be done ;-)

manolo_1
Posts: 5
Joined: 2016-05-22 14:27

Re: Timestamp / Symbols in texte after csv import

Post by manolo_1 » 2016-09-08 19:13

@ peebee
Thanks for your reply.
Tried out a few things changing excel 2013 file into unicode utf8 and even with open office calc, yet it seemed that the unicode kept presenting question marks on à, è, é etc. I even had an idea of changing the whole column into CAPS, yet the symbols stayed and an import gave the same result with (?) all over.
So what I did was, I downloaded ASAP utilities and cleaned out all this specials accents in a few second in excel. Then I imported the csv file in de database and BINGO, it worked ! No more annoying ??? :-)

grimblefritz
AppGini Super Hero
AppGini Super Hero
Posts: 336
Joined: 2015-12-23 16:52

Re: Timestamp / Symbols in texte after csv import

Post by grimblefritz » 2016-09-08 19:39

Have a look at peebee's post here:

http://forums.appgini.com/phpbb/viewtop ... mask#p6353

With the techniques there, you should be able to control the VARCHAR input very well.

manolo_1
Posts: 5
Joined: 2016-05-22 14:27

Re: Timestamp / Symbols in texte after csv import

Post by manolo_1 » 2016-09-08 20:07

@ grimblefritz
Thanks for the tip ! Will do that.

Aya Adel
Posts: 7
Joined: 2016-08-08 07:29

Re: Timestamp / Symbols in texte after csv import

Post by Aya Adel » 2016-09-25 11:50

1. Make sure that the CSV file is encoded as utf-8 Unicode to accept the special characters like that:

Code: Select all

function tableName_dv($selectedID, $memberInfo, &$html, &$args){
                /* if this is the print preview, don't modify the detail view */
        if(isset($_REQUEST['dvprint_x'])) return; 

        ob_start(); ?>

        <script>
            $j(function(){
                <?php if(!$selectedID){ ?> 
                $j('#time').val("00:00:00 AM");

                <?php } ?>
            });


        </script>

        <?php
        $form_code = ob_get_contents();
        ob_end_clean();

        $html .= $form_code;


    }
2. Also make sure that the encoding is set to Unicode in your AppGini project before generating the application.

Post Reply