Skip to content

Conditional link field

Description

The conditional link field can restrict values based on the selected records from the parent field.

Shacl definition in the RecordType

A conditional field needs to have two fields, one normal link field and the field which restricts records based on the previous option.

sh:property  [ 
    rdfs:label  "Fonds" ;
    dash:editor memorix:LinkedRecordEditor ;
    sh:group    image:ArchivalContextGroup ;
    sh:nodeKind sh:IRI ;
    sh:or       ( [ sh:class recordtypes:Fonds ] ) ;
    sh:order    1.0 ;
    sh:maxCount 1 ;
    sh:path     image:fondsLink 
] ;
# Conditional field files will be restricted to chosen Fonds
sh:property  [ 
    rdfs:label              "File" ;
    dash:editor             memorix:ConditionalLinkFieldEditor ;
    # this is the sh:path to the parent field of the recordtype
    memorix:conditionalLinkField  image:fondsLink ;
    # field to restrict the results with the record chosen in the parent field
    memorix:linkField [
        memorix:hasRecordType recordtypes:File ;
        memorix:path file:fonds ;
    ] ;
    sh:group                image:ArchivalContextGroup ;
    sh:nodeKind             sh:IRI ;
    sh:or                   ( [ sh:class recordtypes:File ] ) ;
    sh:order                2.0 ;
    sh:maxCount             1 ;
    sh:path                 image:fileLink 
] ;

"Conditional link field in the UI"