Using/Access Selected Value on Query Language

My Blueprint

    label: Predefineds
    type: structure
            label: Attribute
            type: select
            required: true
            default: dropdown
            width: 1/3
            options: query
            query: site.find("attributes").children

            label: Values
            type: tags
            options: query
            query: site.find("attributes").children.find(THIS.BASEATTRIBUTE).pluck("values", ",", true)
            width: 2/3

My Pages

  • Attributes
    • Brand
      • BrandA
      • BrandB
    • Color
      • Black
      • White

In above example;

I have attributes pages that have pre defined attributes.
I want query on "values fields of attributes pages" based on other field selected value as baseAttribute.

So i need access selected value like that:

query: site.find("attributes").children.find(THIS.BASEATTRIBUTE).pluck("values", ",", true)


Have you tried find(page.basethingy)?

I tried but returns all attributes values.

  1. page.baseAttribute doest make sense. Because baseAttribute is structure field, not directly page field and not saved btw. baseAttribute field is dynamic . So it’s path: page.predefined[n].baseAttribute

  2. When i select baseAttribute as “Brand”, baseValues should be query/list “Attributes > Brands > Values field”.

Hope, i can explain.

For example, following line works but it is manual:

query: site
        .filterBy("uid", "brand") // need access like "" any field value
        .pluck("values", ", ",true)

I think you probably have to do your query via some JavaScript, i.e. get the field value of the baseattribute field on the client side, then fetch the values from the selected page and inject in your baseValues field. Trying to get these values via a blueprint query doesn’t make sense, imo.

You understood correctly!

Which plugin type do I need to use for using javascript? Making a new panel field or extending panel js without new field? Any Idea?

Probably a panel field with a custom route that returns the page values.

1 Like

Faced the same problem, is there any example of code for implementing this case?

@brzov Are you also trying this inside a structure field? Or just two different fields?

But I’m not aware of any code solution, unless @ahmetbora: Have you ever implemented this?

I couldn’t find a solution for structure field but it will work if the dynamic query is not bound to the structure field.


Sample usage


    type: select
    required: true
      notes: Notes
      photography: Photography

    type: pages

That’s true, but it only works after saving, not on the fly.

1 Like