How to have dynamic metadata block session or How to set default value for my custom metadata

58 views
Skip to first unread message

Zhang Yue

unread,
Aug 1, 2025, 5:39:55 PMAug 1
to Dataverse Users Community
Dear all, 

Here I am facing a problem:

I need to design an custom metadata which:

1. have 4 sub-section with each of which containing some mandatory fields. However I would like to make only 1 of the sub-sections available when I create a new dataset. Thus, the mandatory fields in other 3 sub-sections do not need to be filled. Is this possible?

2. How to set a default value on all mandatory fields on my custom metadata, just as newly-creating dataset has a default author name "Admin, Dataverse" for admin account.

If you find any solutions or suggestions, please let me know.

Sincerely,
Yue
     

Philip Durbin

unread,
Aug 4, 2025, 10:34:12 AMAug 4
to dataverse...@googlegroups.com
Hi Yue,

I think your #2 is easier to answer. Dataset templates will let you pre-fill whatever values you want. Please see https://guides.dataverse.org/en/6.7.1/user/dataverse-management.html#dataset-templates

As for your #1, conventionally, in the old/current JSF UI, mandatory/required (we tend to use the word "required") means required. If you mark a field as required, it must be filled in. It can't be hidden from the "create dataset" form. That said, the API does allow datasets to be created with "incomplete metadata", if you enable that feature. Please see https://guides.dataverse.org/en/6.7.1/api/native-api.html#submit-incomplete-dataset . This setting has no bearing on the JSF UI, however. Perhaps in the future the new React UI (which calls into the API) could make use of it, but I don't believe we've talked about it.

I'd like to add that others on this list have much more practical experience designing and deploying metadata blocks so they might have better information or a clever workaround I'm not thinking of!

I hope this helps,

Phil

--
You received this message because you are subscribed to the Google Groups "Dataverse Users Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email to dataverse-commu...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/dataverse-community/fb224a35-a17b-459f-8e64-8d08082c7c9cn%40googlegroups.com.


--

Zhang Yue

unread,
Aug 13, 2025, 9:07:54 AMAug 13
to Dataverse Users Community
Hi Philip,

Thank you for your advice on #2 approach.

It somehow works on my sitation.

Thanks.

Sincerely,
Yue

Zhang Yue

unread,
Aug 22, 2025, 7:40:57 AMAug 22
to Dataverse Users Community
Hi Philip,

Another small questions: Can a mandatory int fields has a pre-filled text value like "null"? Or the pre-fill should be a number?

Thanks,

Best,
Yue

Philip Durbin

unread,
Aug 25, 2025, 8:14:19 PM (12 days ago) Aug 25
to dataverse...@googlegroups.com
I don't believe you can express a null in a dataset template but you are welcome to try! If it doesn't work, please feel free to open an issue.

paul...@dans.knaw.nl

unread,
Aug 26, 2025, 10:30:40 AM (11 days ago) Aug 26
to Dataverse Users Community
Be carefull with null, you never know what will happen; https://www.wired.com/story/null-license-plate-landed-one-hacker-ticket-hell/
;-)


Op dinsdag 26 augustus 2025 om 02:14:19 UTC+2 schreef pdu...@g.harvard.edu:
Reply all
Reply to author
Forward
0 new messages