Menu

#293 Problem when importing ASCII files if comma is the decimal separator

next
closed
nobody
4normal
2021-03-12
2017-01-12
Fellype
No

If you try to import an ASCII file, as numeric data, that uses comma as the decimal separator SciDAVis will not read correctly the values (will read as zero), unless you define the decimal separator as comma in Edit -> Preferences -> General -> Numeric format

E.g:
The file to be imported contains:
1,00 1
2,00 2
3,00 3
4,00 4
5 5

The data will appear in the table as:
0 1
0 2
0 3
0 4
5 5

When the correct should be:
1 1
2 2
3 3
4 4
5 5

This occurs even if you choose the appropriated decimal separator (1.000,0 or 1 000,0) in the import dialog.

Steps to reproduce the bug (using the attached file):
- Go to Edit -> Preferences -> General -> Numeric format, and set the decimal separator as 1,000.0 (the default option)
- Go to File -> import ASCII and:
-- Check the 'Numeric data' checkbox
-- Change the 'Decimal Separators' to 1.000,0 (or 1 000,0)
-- Select a file that contains numbers using comma as decimal separators
-- Click the 'Open' button -> the numbers with comma as decimal separators will appear as zero in the table

This bug was verified in SciDAVis 1.14, under Slackware Linux, and in SciDAVis 1.D13, running on WINE.

1 Attachments

Discussion

  • High Performance Coder

    • Group: 1.D13 --> next
     
  • gbm

    gbm - 2019-08-21

    Try attached patch

     
    • Fellype

      Fellype - 2019-08-21

      Hi Miquel.
      The patch does not work for me.

       

      Last edit: Fellype 2019-08-21
  • gbm

    gbm - 2019-08-21

    Fellype,
    The patch works for me in a Qt5.12.4-python-3.7.4 build
    It works partially in a Qt4.8.7-python-2.7.16 build.
    Partially means it works for importing into new Table, not for Overwrite current table.
    I assume that you use Qt4-python2.
    Can you check if the patch works for importing into new Tables?

     
    • Fellype

      Fellype - 2019-08-21

      I assume that you use Qt4-python2.

      Yes, this is my config.

      Sorry for my previous report... I tried to import an ascii file using the importASCII python command.. In that case the cells are filled with ' - ' instead of zeros for the numbers with comas.

      Running new tests using the import ASCII dialog:
      Importing to a new table works as expected if the appropriated decimal separator (' , ') is chosen. But not if decimal separators remain the default (' . ') - the zeros appear in the cells in this case.
      Importing to an existing table does not work even if the decimal separator are appropriated: the table remains empty. The same for the options to import to new columns or rows.

       
    • Fellype

      Fellype - 2019-08-21

      I believe the problem originally reported is solved ... But we ended up finding others.
      I'll be out for 10 days, but I can examine the other bugs and create reports after that.

       
  • gbm

    gbm - 2019-08-21

    Please check if attached patch fixes the bug also for Qt4-python2

     
    • Fellype

      Fellype - 2019-08-22

      Miquel,
      Using the last patch all import options in the importASCII dialog work fine - new table, new columns/rows and overwrite existing table.
      Good job and thank you for the effort in solve the issue.

       
  • Suthiro

    Suthiro - 2021-03-12
    • status: open --> closed
     
  • Suthiro

    Suthiro - 2021-03-12
     

Log in to post a comment.