How can I retrieve items with an empty field?

More
4 years 9 months ago #78125 by grabit
Another problem with the query is that in the answer I receive all the items where this field is not used as false positive (about 3500 items)

An Apple a days keeps the doctor away

Please Log in or Create an account to join the conversation.

More
4 years 9 months ago #78213 by grabit
Just pushing it up because this issue is a real problem for me

An Apple a days keeps the doctor away

Please Log in or Create an account to join the conversation.

More
4 years 9 months ago - 4 years 9 months ago #78214 by ggppdk
Hello

i missed your last answer

here is the query to only include items that have an item types using the field
(field appears in the item forms of the items)

SELECT c.id, c.title
FROM PPP_content AS c
JOIN PPP_flexicontent_items_ext AS e
ON (c.id = e.item_id)
JOIN PPP_flexicontent_fields_type_relations AS f
ON (e.type_id = f.type_id AND v.field_id = 57)
LEFT JOIN PPP_flexicontent_fields_item_relations AS v
ON (c.id = v.item_id AND v.field_id = 57)
WHERE v.item_id IS NULL;


-- Flexicontent is Free but involves a big effort on our part.
Like the our support? (for a bug-free FC, despite having a long list of functions) Like the features? Like the ongoing development and future commitment to FLEXIcontent?
-- Add your voice to the FLEXIcontent JED listing with a 5-star...
Last edit: 4 years 9 months ago by ggppdk.

Please Log in or Create an account to join the conversation.

More
4 years 9 months ago #78215 by grabit
Here is my sql request with the right field_id and type_id
Code:
SELECT c.id, c.title FROM nwps5_content AS c JOIN nwps5_flexicontent_items_ext AS e ON (c.id = e.item_id) JOIN nwps5_flexicontent_fields_type_relations AS f ON (e.type_id = 2 AND v.field_id = 22) LEFT JOIN nwps5_flexicontent_fields_item_relations AS v ON (c.id = v.item_id AND v.field_id = 22) WHERE v.item_id IS NULL;

and I got an error:
#1054 - Champ 'v.field_id' inconnu dans on clause

An Apple a days keeps the doctor away

Please Log in or Create an account to join the conversation.

More
4 years 9 months ago - 4 years 9 months ago #78225 by ggppdk
Hello

the table alias is f

so instead of
Code:
ON (e.type_id = f.type_id AND v.field_id = 57)
try
Code:
ON (e.type_id = f.type_id AND f.field_id = 57)

Now full query should be
Code:
SELECT c.id, c.title FROM PPP_content AS c JOIN PPP_flexicontent_items_ext AS e ON (c.id = e.item_id) JOIN PPP_flexicontent_fields_type_relations AS f ON (e.type_id = f.type_id AND f.field_id = 57) LEFT JOIN PPP_flexicontent_fields_item_relations AS v ON (c.id = v.item_id AND v.field_id = 57) WHERE v.item_id IS NULL;


-- Flexicontent is Free but involves a big effort on our part.
Like the our support? (for a bug-free FC, despite having a long list of functions) Like the features? Like the ongoing development and future commitment to FLEXIcontent?
-- Add your voice to the FLEXIcontent JED listing with a 5-star...
Last edit: 4 years 9 months ago by ggppdk.

Please Log in or Create an account to join the conversation.

More
4 years 9 months ago #78235 by grabit
Yes it works perfectly.

Do you think it is possible to implement that on the backend of Joomla as I don't want to give access at the server directly.

Kind regards

An Apple a days keeps the doctor away

Please Log in or Create an account to join the conversation.

Moderators: vistamediajoomlacornerggppdk
Time to create page: 1.152 seconds
Save
Cookies user preferences
We use cookies to ensure you to get the best experience on our website. If you decline the use of cookies, this website may not function as expected.
Accept all
Decline all
Essential
These cookies are needed to make the website work correctly. You can not disable them.
Display
Accept
Analytics
Tools used to analyze the data to measure the effectiveness of a website and to understand how it works.
Google Analytics
Accept
Decline