Skip to content

Studio export to csv/Excel truncates String values longer than 30 characters #721

Closed

Description

@vic0824

ArcadeDB Version: v22.11.1

JDK Version: openjdk 11.0.12 2021-07-20 LTS

OpenJDK Runtime Environment Corretto-11.0.12.7.1 (build 11.0.12+7-LTS)
OpenJDK 64-Bit Server VM Corretto-11.0.12.7.1 (build 11.0.12+7-LTS, mixed mode)

OS: CentOS release 6.9 (Final)

Expected behavior

The export to csv/Excel generates a file which include the same values stored in the database

Actual behavior

the csv/Excel export includes ellipsis for values longer than 30 characters.
This does not seem to be linked to the browser and screen settings, because if I open a side window (e.g. developer tools), all the table columns shrink but the amount of text displayed stays the same, it just wraps around.
The attached screenshot "Studio table view" shows that the Studio table view shows the value "CS_OPER_AUX_WNDCHE_00000000T00..." for the "name" property
The attached screenshot "json table view" shows that the actual value of the name property for that record is "CS_OPER_AUX_WNDCHE_00000000T000000_99999999T999999_0001.DBL"

Steps to reproduce

  1. Create a type
  2. create a property "name" of type String
  3. insert a value longer than 30 characters for the "name" property, e.g. 'property_name_longer_than_30_ch', which is 31 characters long.
  4. issue a select query for the type
  5. verify that the table view shows ellipsis "..." at the end of the value, e.g. 'property_name_longer_than_30_c...'
  6. click the json view and verify that the name property has value = property_name_longer_than_30_ch
  7. export to csv or Excel
  8. open the file and verify that the value is truncated and it contains ellipsis and the end, e.g. "property_name_longer_than_30_c..."

Studio Table view
Studio json view

Activity

  1. lvca commented on Dec 30, 2022

    @lvca
    Member

    Find the issue:

    value = value.toString().substr( 0, 30) + "...";

    Any column longer than 30 chars is truncated. Since the table doesn't scroll on the right (overflow) like OrientDB Studio, it's challenging to keep long values. Any advice?

    1. Remove any truncation and let the table scroll to the right if overflows
    2. Like (1) but make it configurable with a checkbox like "Fit values in the page" checked by default, but you can disable it. We should save this settings into the localStorage, so you don't have to reset the same option every time. Probably we should save other things, like the current database in the localStorage....
    3. Leave like it's now, but re-render the table on CSV/Excel export, so it's not truncated

    WDYT?

  2. lvca commented on Dec 30, 2022

    @lvca
    Member

    I moved ahead and implemented both as new options in the "Settings" menu under Table:

    image

    Now you can select:

    • truncate values (30 characters)
    • fit the table in the page

    Also these settings are saved in the browser's storage, together with the database name, so once you change your settings they are persistent (unless you clear web browser's local storage)

  3. lvca commented on Dec 30, 2022

    @lvca
    Member

    @vic0824 you can try now to remove "Truncate long values" and export in CSV/Excel.

  4. self-assigned this
    on Dec 30, 2022
  5. added this to the 23.1.1 milestone on Dec 30, 2022
  6. vic0824 commented on Dec 31, 2022

    @vic0824
    Author

    Excellent, thanks.
    We could go one step further and set "table-layout: auto" + "word-break:break-all" when "Fit table in page" mode is selected. If necessary, min-width could be specified for the @Rid, it's probably the only column we don't want to ever wrap around.
    The rationale is that the contents of some of the columns is often going to be shorter than others, e.g. the @Rid and @type columns take up too much space and they are not the most important information.
    Other, more aggressive, optimizations, could be:

    • move the main menu to the top, i.e. lay it out horizontally on the top, instead of vertically on the side
    • reduce the font
    • remove redundant columns (e.g. the @type in table view: if I do a select on a type, I already know what the type is, and repeating the same value for each record is a waste of space)
  7. lvca commented on Dec 31, 2022

    @lvca
    Member

    Hey @vic0824, could you please send a PR about the first part once you tested and work better?

    About the more aggressive optimizations, you can always reduce the font by zooming in and out with your browser if you need it. The main menu on the top is an option, especially because we don't have so many options to justify a vertical tab.

    About the removal of @type is not a good idea, because you could do a select from Customer and the resultset not only has Customer but also all the instances from sub-classes: types are polymorphic.

  8. vic0824 commented on Jan 1, 2023

    @vic0824
    Author

    I have downloaded the entire content of the "static" folder (from the main branch) and patched the server jar, but it does not seem to work for me. When I execute a query, it hangs and the browser console displays a js error message (see attached screenshot). What am I doing wrong?
    Studio error

  9. lvca commented on Jan 1, 2023

    @lvca
    Member

    Hard to tell. If you forked the project, could you please create a PR of your changes so I can see them?

  10. vic0824 commented on Jan 2, 2023

    @vic0824
    Author

    Tested it with v23.1.1-SNAPSHOT (build 1b37118/1672647527307/main).

    It works, more or less.
    The functionality is there (see attached "fit table in page" screenshot and "Studio export" csv file, and I have verified it also for Excel, PDF, copy and print), but the checkboxes do not behave correctly:

    1. the default configuration is "fit table in page", but none of the two options is selected by default (see attached "Studio setting default none selected" screenshot)
    2. It is possible to select both options (see attached "Studio setting both selected" screenshot)
    3. Clicking on the checkbox itself does not have any effect: it is necessary to click on the text. This might be an intrinsic feature of the css/javascript libraries, but it is nevertheless not consistent with the usual behavior of checkboxes.

    By clicking around I've managed to select only "Fit table in page".
    I have then refreshed the browser, logged in again and verified that "Fit table in page was selected".
    This makes me think that the code sets the checkbox status based only on the value in the local storage, and if it doesn't find any (because it is the first time that page is displayed by that browser or because the cache has been cleared), then it does not select any.
    I suggest to modify the javascript code so that if it doesn't find a value in the local storage, it selects the "Fit table in page" checkbox, which would then be consistent with the default behavior, i.e. to fit the table in the page.

    fit table in page
    Studio export.csv
    Studio setting default none selected
    Studio setting both selected

  11. vic0824 commented on Jan 2, 2023

    @vic0824
    Author

    Hold on, there are more behaviors, probably because it is possible to select both options and deselect both options, but depending on the order in which they are applied, they produce different results.

    The "default behavior" (when no option is selected) seems to be: values are not truncated and the column widths adjust to the content, corresponding to "table-layout: auto"

    I think the default behavior make the best use of the space, by using table-layout: auto, so I propose that, apart from fixing the problems with the selection, both options use "table-layout: auto" instead of "table-layout: fixed"
    default behavior

  12. reopened this on Jan 2, 2023
  13. 3 remaining items

  14. reopened this on Jan 2, 2023
  15. lvca commented on Jan 2, 2023

    @lvca
    Member

    Too early. The saved values are not correct, and as you noticed, clicking on the actual checkbox doesn't work.

  16. lvca commented on Jan 2, 2023

    @lvca
    Member

    Ok, I hope this is the good one. Checkboxes now work and the settings are correctly saved and displayed at the opening. Please confirm when you can, in case there is still an issue, we can reopen this issue. Thanks in advance.

  17. vic0824 commented on Jan 3, 2023

    @vic0824
    Author

    Tested it with v23.1.1-SNAPSHOT (build 8c8df17/1672742152255/main).

    Clicking on the checkbox now works, but maybe I misunderstood the design: did you intend for the two checkboxes to be mutually exclusive or not?
    If not, then it works as expected.
    Screenshots:

    • "default view": table-layout = auto, word-wrap = break-word, values are not truncated, no checkbox is selected
    • "Fit table in page": table-layout = fixed, word-wrap = break-word, values are not truncated, the correct checkbox is selected
    • "truncate long values": table-layout = auto, word-wrap = break-word, values are truncated, the correct checkbox is selected
    • "both selected": table-layout = fixed, word-wrap = break-word, values are truncated, both checkboxes are selected

    Anyway, I think it's good enough, it's not worth spending more time on it.

    default view
    Fit table in page
    truncate long values
    both selected

  18. lvca commented on Jan 3, 2023

    @lvca
    Member

    They are not mutually exclusive, one is to truncate values no matter the layout. If you have any suggestions to make it better don't hesitate to comment here.

  19. lvca commented on Jan 6, 2023

    @lvca
    Member

    @vic0824 I think I finally understood what you mean. Just fixed. Not if "Fit In Page" is not selected, the table scrolls to display all the columns.

  20. vic0824 commented on Jan 13, 2023

    @vic0824
    Author

    Great, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions