Questions tagged [query]

The tag has no usage guidance.

21 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
2
votes
0answers
274 views

Advanced queries with Super Table

I have three channels: Events, stages and artists. An artist is added to a timetable super table field in the stage channel. In the event, I have a stages field where I select stages. Events also ...
2
votes
0answers
112 views

What's the most performant way to get reverse related entries within an Element Query?

What's the most performant way to get reverse related entries within an Element Query? Here's a contrived example of this. I have thousands of "book" entries and thousands of "collection" entries. I ...
1
vote
0answers
32 views

Order element query by number of related categories

I'm building an entry template that displays related entries to the current entry. To be related, an entry needs to be the same type as the current entry and share at least one category in one of two ...
1
vote
0answers
207 views

Filter entries in GraphQL

I'm using Craft with Gatsby. I'd like to query a featuredpost, and filter that in my entries. I'm getting the featuredPost slug in gatsby-node, and passing that to createPage, to send a variable to my ...
1
vote
0answers
120 views

Database Query in debugger consistently showing over 2000ms

In trying to optimize my Craft 3 site, I have discovered that it's apparently taking longer than expected to query my database. The duration for the apparent culprit is typically between 1900 and ...
1
vote
0answers
180 views

How to get url from related entry in another site

I'm relating entries from another site in my installation, and I'm having issues getting the correct URL for the entry. This is an example of what I currently have: {% set carouselEntries = entry....
1
vote
0answers
69 views

Order entries by a matrix field category

I have a lot of trouble in understanding the database/model structure and how to work with the query builder. I tried playing a bit with leftJoins but i cannot seem to make complex queries in craft 3. ...
1
vote
0answers
30 views

Paginate entries based on related status

So, let's assume I have two channels. events and movies, being events the screening time of each movie. In the admin, in the event entry, you can select one movie. The movie could be disabled. The ...
1
vote
0answers
80 views

Check the field type of all the attributes of an entry

Here's the whole picture: I'm trying to make an API endpoint which should output everything from an entry: First I did this: public function transform(Entry $entry) { return $entry-...
1
vote
0answers
584 views

Category counts for query results

I'm trying to display results from a search. I want to display the categories represented by the search results and the entry count for that category. Think of how Amazon's "refine results" sidebar ...
1
vote
0answers
68 views

Combine multi-tiered loop into a single query (via plugin)

I am very new to Craft so forgive me if I knacker how this is asked. I have a set of IDs in an array. I try sending that into a relatedTo statement (which yields a series of locations...see below ...
1
vote
0answers
20 views

Can I use relational parameters that query as items on their own?

I am running a craft site on craft 2.6.2997 and latest craft commerce. I am building a url query that allows the user to add query params to the url with a bit of js. The url structure is as follows ...
1
vote
0answers
97 views

How to insert data with the querybuilder?

Is it possible to insert data with the query builder if so how? I want to make (backend) fields by queries. What is the easiest way to do this? Or do I have to use regular mysql queries?
0
votes
0answers
37 views

how to retrieve any/all related entries?

I have list of banks(institutions) that each one has branches. I'm using GraphQL API. By the bellow code I can get the branches with associated bank(institutions): query branches { entries(limit: ...
0
votes
0answers
27 views

GraphQL API query to load all related data

How to write a query to load entries with its category or any other related data. For example I have cars that related to the BMW category. How I can access the category data in the query that fetch ...
0
votes
0answers
9 views

Query date field, timezone not taken into consideration

I'm trying to query a custom table on a DATETIME field. My timezone is UTC+2 and the dates stored in the database are UTC. shiftEnd in database: note that the shifts ends at 08:35 UTC, in my timezone ...
0
votes
0answers
33 views

Query Entry where number field is conditional to value

I am trying to get entries where a specific number field is bigger than the given value. But Craft is giving me the following response: Am i missing something or is this not supported for number ...
0
votes
0answers
69 views

Search Entries by Post Date

Is there a way to direct Craft to include entry.postDate in the search? I'm using a simple query to search entries. {% set entries = craft.entries.section('mySection').search('*' ~ query ~ '*').limit(...
0
votes
0answers
83 views

How can I use 'where' in an advanced search query?

I came across this handy tip for search queries on Twitter: https://twitter.com/nystudio107/status/1354815792638955524/photo/2 {% set entry = craft.entries({ section: 'blog', where: ['like', 'title', '...
0
votes
0answers
30 views

Hiding enclosing div if all matrix block fields are empty (although they do exist because of another language)

I have an entry with matrix fields. If I add blocks in the main language, but its fields only contain data in one language, the block query (the for loop) still finds these empty fields since they do ...
0
votes
0answers
38 views

Output Entry with Super Table, Matrix, Table for Element API

I'm trying to output a table within a matrix of a SuperTable for element API. I fail to output $projectList, I keep getting the error 'Invalid argument supplied for foreach()' or 'Trying to get ...