How to use default values for DynamicTable
when creating extension?
#39
Unanswered
tuanpham96
asked this question in
Q&A
Replies: 1 comment 1 reply
-
@tuanpham96 Unfortunately, In the meantime, you can create a custom API class that should be able to set default values. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I am trying to define a
DynamicTable
in an extension, and want to have certain required columns have default values so that when usingadd_row
, those columns would take such values if not defined. I believe using a custom API would achieve this but I was wondering if that could already be done at the extension creation step. Here's what I've tried.Minimal example
Step 1. Create extension
Spec files
Step 2. Load extension
Output of
get_docval(TestDynTbl.__init__)
However, printing out
TestDynTbl.__columns__
reveals nodefault*
fields for these column metadata:Step 3. Usage & issues
Attempting to add just
col_1
to see ifcol_2
can be defaulted❌ This is not possible
This is of course possible, but no way to actually use
col_2
originaldefault_value=3.14
❌ And adding the optional column
col_3
(hasdefault_value=0
) to that table cannot "back-add" such default value to the first rowTraceback for the above error
Attempt to first initialize with all columns then
add_row
❌ Adding new row with columns that do not have
default_value
defined in schema (col_1, col_4
) did not work.❌ Adding new row with the required columns (
col_1, col_2
) and the non-schema-required column that doesn't havedefault_value
(col_4
) did not work.System
Beta Was this translation helpful? Give feedback.
All reactions