Relation display blank

I want to search skills inside “landing page” file collection from fullWorks collection but the result is always void

pages file collection:

  - label: "Pages"
    name: "pages"
    files:
      - file: "src/pages/index.md"
        label: "Landing Page"
        name: "index"
        editor:
          preview: false
        fields:
          - {label: "Title", name: "title", widget: "string"}
          - {label: "Greeting", name: "greeting", widget: "string" }
          - {label: "Name", name: "name", widget: "string"}
          - {label: "Heading", name: "heading", widget: "string"}
          - {label: "Description", name: "description", widget: "text"}
          - {
             label: "Cv",
             name: "cv",
             widget: "file",
             default: "/uploads/cv.pdf",
            }
          - {label: "Linkedin", name: "linkedin", widget: "string", pattern: ['[(https:\/\/www\.linkedin.com)]{20}\.[a-z]{2,6}\b([-a-zA-Z0-9@:%_\+.~#?&\/=]*)+', "Must be Linkedin URL"]}
          - {label: "Github", name: "github", widget: "string", pattern: ['(https?://github.com/[a-zA-Z0-9-]*/?)', "Must be Github URL"]}
          - {label: "Skills Section Heading", name: "skillsSectionHeading", widget: "string"}
          - label: "Skillset"
            name: "skillset"
            widget: "list"
            fields:
              - {label: "Skillset Head", name: "skillsetHead", widget: "string"}
              - label: "Skills"
                name: "skills"
                widget: "list"
                fields:
                  - {label: "Skill", name: "skill", widget: "string"}
                  - label: "Icons"
                    name: "icons"
                    widget: "list"
                    min: 1
                    max: 4
                    fields:
                      - {label: "Icon", name: "icon", widget: "image"}
                      - {label: "Image Alt", name: "imageAlt", widget: "string"}
                      - {label: "Image Title", name: "imageTitle", widget: "string"}
          - {label: "Works Heading", name: "worksHeading", widget: "string"}
          - label: work
            name: work
            widget: relation
            required: false
            multiple: true
            collection: fullWorks
            search_fields: ["name"]
            display_fields: ["name"]
            value_field: "*"
          - {label: Contact Heading, name: contactHeading, widget: string}
          - {label: contactEmail, name: contactEmail, widget: string, pattern: [ "[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?", "Enter valid email address"]}

full work collection:

  - name: 'fullWorks'
    label: 'Full Works'
    folder: "src/pages/fullWorks"
    create: true
    editor:
      preview: false
    slug: 'index'
    media_folder: ''
    public_folder: ''
    path: '{{name}}/index'
    fields:
      - { label: name, name: name, widget: string}
      - {label: "type", name: "type", widget: "select", options: ["featured", "personal"]}
      - {label: "status", name: "status", widget: "select", options: ["online", "offline"]}
      - label: Stack
        name: stack
        widget: relation
        multiple: true
        collection: pages
        file: index
        search_fields: ["skillset.*.skill"]
        value_field: "skillset.skills.skill"
        display_fields: ["skillset.skills.skill"]
      - {label: Link, name: link, required: false, widget: string, pattern: ["[-a-zA-Z0-9@:%_\\+.~#?&//=]{2,256}\\.[a-z]{2,4}\\b(\\/[-a-zA-Z0-9@:%_\\+.~#?&//=]*)?", "Must be and URL"]}
      - {label: Github Repository, name: githubRepository, required: false, widget: string, pattern: ["(https?://github.com/[a-zA-Z0-9-]*/[^!@#$%^&*()_+-={}\\[\\];:'\",<.>/?`~]+/?)", "Must be Github Repo URL"]}
      - {label: Preview Image, name: previewImage, widget: image, allow_multiple: false}
      - {label: Preview Description, name: previewDescription, widget: text}
      - {label: description, name: description, widget: string}
      - label: Top Columns
        name: topColumns
        widget: list
        fields:
          - {label: Column Heading, name: columnHeading, widget: string}
          - label: Column List
            name: columnList
            widget: list
            fields: 
              - {label: Item, name: item, widget: string}
              - label: icons
                name: icons
                required: false
                widget: list
                fileds:
                  - {label: Icon, name: icon, widget: image}
                  - {label: Alt, name: iconAlt, widget: string}
                  - {label: Title, name: iconTitle, widget: string}
      - {label: Paragraphs, name: paragraphs, widget: markdown}

result UI:

I think this is the culprit:

The value field determines what field from the fieldWorks collection is going to be saved to your page collection. I think"*" isn’t a valid property in this case, as I don’t believe you’re targeting a list right?

value_field : (required ) name of the field from the referenced collection whose value will be stored for the relation. For nested fields, separate each subfield with a . (e.g. name.first ). For list fields use a wildcard * to target all list items (e.g.

I need to get skill, skill is composed by a list of icons and a title

but “skills” is a list

Right, so in that case you’d have to target "skills.*". I’m not entirely sure if that works with a folder collection though.

search_fields: ["skillset.skills.*"]
value_field: "skillset.skills.*"
display_fields: ["skillset.skills.*"]

still not work, but thank you very much for the support

I think that functionality is meant for file collections with nested list, not for folder collections (which is kind of a list itself)

If there are nested list you need to consider every items in every list with wildcard * for every single list, in my case:

        search_fields: ["skillset.*.skills.*.skill"]
        value_field: "skillset.*.skills.*.skill"
        display_fields: ["skillset.*.skills.*.skill"]
2 Likes

Thanks for circling back and sharing your solution!

1 Like