dbr.import broken?

(5 posts) (2 voices)

Tags:

  1. eugfri, Member

    hi,

    I am wondering if maybe dbr.import could be broken after the latest update(s)?
    I have the simplest code possible and its not working, while before I have been using dbr.import without any problem.

    CREATE PROCEDURE `sp_DBR_TestUpload`() BEGIN SELECT 'dbr.import.options', 'format', 'tab'; SELECT 'dbr.import', 'sp_DBR_SerialsScansUpload_do'; END

    CREATE PROCEDURE `sp_DBR_SerialsScansUpload_do`(vLine varchar(50)) BEGIN INSERT INTO ssn.partserialsstagingupload (lineitem) VALUES (vLine); END

    My table has only only column named lineitem which is varchar(50).
    I upload a single column file (saved as tab delimited from Excel) with the following content:
    werwrrt eryuuyu weqewre asddasfbf sdewrrt qrewtret qrtrqet

    and the screen message after upload looks like this:

    Summary
    ["werwrrt"] [["vLine","string","50"]]
    Total rows Errors
    7 1

    Initially I thought indicating tab format of the file is now mandatory in options and added it, but it did not help.

    Please advise.

    Thank you
    Eugene

  2. myDBR Team, Key Master

    The issue has been fixed. You can run the automatic updater. Thank you for pointing this out.

    --
    myDBR Team

  3. eugfri, Member

    Thank you! It works after patching.

    Just a follow up - in one of the old threads you have mentioned the plan to add ability to have javascript callback for dbr.import.finish, so there would be an easy way to refresh the screen after file upload is completed. It would be very helpful in cases when the table which data is imported into is displayed right below the file upload dialog box so user can see immediate effect of the data import.
    This is not listed neither in html or pdf docs, so I figure you have never gotten to add this. So if this feature is not available, how would you recommend to refresh the page automatically?

    I.e. with my code example above it would be:

    CREATE PROCEDURE `sp_DBR_TestUpload`() BEGIN SELECT 'dbr.import.options', 'format', 'tab'; SELECT 'dbr.import', 'sp_DBR_SerialsScansUpload_do'; SELECT * FROM ssn.partserialsstagingupload; END

    How can i auto refresh display of my table to reflect all the rows including the new ones from import?
    Adding dbr.import.finish procedure with dbr.refresh inside of it does not help.

    Thank you

  4. eugfri, Member

    In this old thread:
    https://mydbr.com/forums/topic.php?id=2083#post-6257
    you said return from dbr.import.finish proc should be not only text but can now be javascript.

    It does not seem to work - it prints my javascript on the screen like text.

    CREATE PROCEDURE `sp_DBR_TestUpload`() BEGIN

    SELECT 'dbr.javascript', "function refreshStaging() { $('#staging').load(location.href + '#staging'); }"; SELECT 'dbr.import.options', 'format', 'tab'; SELECT 'dbr.import.finish', 'sp_DBR_TestUpload_finish'; SELECT 'dbr.import', 'sp_DBR_SerialsScansUpload_do'; SELECT 'dbr.html','<div id="staging">'; SELECT * FROM ssn.partserialsstagingupload; SELECT 'dbr.html','</div>';

    END

    CREATE PROCEDURE `sp_DBR_TestUpload_finish`() BEGIN

    SELECT 'dbr.javascript','refreshStaging()';

    END

    However, look like javascipt to execute refreshStaging() is interpreted as text and is simply printed on the screen like html.

  5. myDBR Team, Key Master

    Eugene,
    as the dbr.import.finish output is treated as text, you can include the JavaScript into the text.

    So if you want to show the results after the import, you create an invisible report-button which shows the results. You can click the button from the dbr.import.finish.

    The import code:

    select 'dbr.import.finish', 'sp_DBR_import_end_action';
    
    select 'dbr.import', 'sp_DBR_import_do';
    
    select 'dbr.button', 'Show import result', 'invisible import_result';
    select 'dbr.report', 'sp_DBR_import_show_result', 'results_div[]'; select 'dummy'; select 'dbr.embed_object', 'results_div';

    sp_DBR_import_end_action:

    select concat('dbr.html:Import done<script>$(".import_result")[0].click();</script>');

    Btw, the latest builds include the preliminary support for xlsx imports.
    --
    myDBR Team


Reply

You must log in to post.