Query Error in Blueprint

I intend to filter the Page Collection

query: site.find(‘private travel’, ‘group travel’, ‘travel modules’).children

by a field named ‘country’ and value ‘laos’. The ‘country’ field is a comma separated field. When I issue the following query in the blueprint, I get the error ‘Invalid query result data’. Here is the query:

query: site.find (‘private travel’, ‘group travel’, ‘travel modules’). children.filterBy (‘country’, ‘myanmar’, ‘,’);

What am I doing wrong?

Where are the pages in your file tree that you are trying to find? And you cannot use spaces in your page ids.

Dear Texnixe,

yes I already tried to find the pages. It worked. The spaces come from the Google translator because I’m not too fit in English. hier is the original line from my blueprint:

query: site.find(‘privatreisen’, ‘gruppenreisen’, ‘reisebausteine’).children.filterBy(‘country’, ‘Myanmar’, ‘,’);

As said, without the filterby-option it worked.

Don’t use a semi-colon at the end of your query string

Dear Texnixe,

Yes, you are right, my mistake! It was the semi-colon. Now the query works fine! Since the query works fine now, I have two further questions:

Here is a part of my blueprint:

countries:
    label: Reiseländer
    type: tags
    options:
      - Indien
      - Kambodscha
      - Laos
      - Myanmar
      - Thailand
      - Vietnam

 topics:
    label: Reisethemen
    type: tags
    options:
      - Familie
      - Trekking
      - Strandurlaub
      - Kultur
      - Natur
      - Kombinationsreisen

  travels:
    label: Reisen
    type: multiselect
    min: 5
    options: query
    query: site.find('privatreisen', 'gruppenreisen', 'reisebausteine').children.filterBy('country', 'Laos', ',')

1st: How can I combine several countries and/or travel topics in the query? e.g. ‘country’ = ‘Myanmar’ and/or ‘Laos’ and ‘topics’ = ‘Familie’ and/or ‘Kultur’
2nd: How can I pass the selections from the tags fields ‘countries’ and ‘topics’ into the query?

Sincerly Lutz

You can use an array with in

filterBy('country', 'in', ['Laos', 'Myanmar'], ',')

Values from other fields will only be available after saving. If you want to listen to changes in real time, you would need a custom field.

If you can live with the data only available after saving, you would have to fetch the arrays from both fields and combine them in a custom method, then use that method instead of the hardcodes array above.

Dear Texnixe,

The ‘in array’ filter works fine. Thank you for that.
It would of course be great if I could read the data from the tags fields in real time, but first I will try the custom field variant with saving the field values. If I don’t get the variant under control, I’ll get in touch with you again.

Dear Texnixe,

I have taken up your suggestion from Custom Field Methods and have already implemented it. But it became a custom page method because I don’t need any field filtering. So far so good. The only flaw is that the panel does not refresh after saving. I think I can do that with the page.update:after hook. I just don’t know the command to refresh the panel. Can you help me there?

Sincerly Lutz

Hey Lutz, your question has already been answered in this other thread: Refreshing panel after saving - #2 by pixelijn

From the PHP side of things, there is no way to refresh the Panel.

Please try not to double-post…