Skip to content

User defined tables#345

Merged
OwainJones merged 13 commits intomainfrom
user-defined-tables
Oct 29, 2025
Merged

User defined tables#345
OwainJones merged 13 commits intomainfrom
user-defined-tables

Conversation

@OwainJones
Copy link
Contributor

No description provided.

OwainJones and others added 13 commits September 17, 2025 10:13
…main (#317)

* Update backend.js

Updating for tables

* Added for table testing

* Some minor updates to testing

* Some updates to tables_test and added a metadata file

* Installed our locally "vendored" patched copy of sheet.js and used it to get defined tables

Excel.js only offered an async API to load files, so we couldn't use it :'-(

# Conflicts:
#	lib/importer/package.json
#	lib/importer/src/dudk/backend.js

* Licence compliance requirements for SheetJS fork

* Added html and nkj files, as well as the associated functions in function.js and sheet.js for selecting user defined tables.

* Added njk and html files as well as functions in functions.js and sheets.js to select and preview tables.

* A range of edits to fix errros that campe up when testing the table selector and to extract the header row automatically

* Several tweaks to code to get table previews to work.

* Add files via upload

* Delete backend.js

* Delete sheets.js

* Delete functions.js

* Add files via upload

* Add files via upload

* Add files via upload

* Add files via upload

---------

Co-authored-by: Alaric Snell-Pym <alaric@register-dynamics.co.uk>
…ctly, and to ensure we preserve the new header range.
…er functions to accomodate tables into the header and footer pages
moved the check for footer rows in SessionPerformMappingJob from if(row) to its
parent for loop, as we were having an issue where an empty row in the table footer
(i.e. the row immediately below the table) was giving an error.
…pData step so that we can import data without visible headers
@OwainJones OwainJones requested a review from alaric-rd October 27, 2025 14:15
Copy link
Contributor

@alaric-rd alaric-rd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some feedback, but it's all just maybes!

{% macro importerTableSelector(data, legend) %}
{% set selectedTable = data['importer.session'].table %}
{% set tables = importTablePreview(data) %}
{% set tableRowIndex = tables.length + 2 %}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd pop a comment here saying why it's +2 specifically

const rowRange = exports.GetRowRangeFromEnd(sid, sheet, count)
const rowRange = exports.GetRowRangeFromEnd(sid, sheet, count);
const wantedRows = Math.min(count, rowRange.end.row - hRange.end.row);
return backend.SessionGetInputSampleRows(sid, rowRange, 0, 0, wantedRows)[2];
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another magic number 2 that probably wants explaining in a comment :-)

@OwainJones OwainJones merged commit 148ca5b into main Oct 29, 2025
20 of 21 checks passed
@OwainJones OwainJones deleted the user-defined-tables branch October 29, 2025 09:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants