SQL request with textselect field

More
1 year 5 months ago #84018 by bendeb
Bonjour,
J'utilise un champ de type textselect pour afficher dans le formulaire une liste basée sur une requête SQL (Editing >>> Form field >>> Element mode = SQL Query).

Si je mets cette requête, ça fonctionne bien :
Code:
SELECT f.value, f.value AS text FROM #__flexicontent_fields_item_relations AS f JOIN #__flexicontent_items_tmp AS i ON f.item_id = i.id WHERE f.field_id = '628' AND f.value != '' AND i.created_by = '554' AND i.catid = '218' GROUP BY f.value

Ca récupère bien les valeurs du champ 628 des articles qui sont dans la catégorie 218 ajoutés par l'utilisateur 554.

Mais cette requête quant à elle ne fonctionne pas :
Code:
SELECT title FROM #__content WHERE title != '' AND created_by = '554' AND catid = '218'

Je souhaite récupérer les titres des articles de la catégorie 218, créés par l'utilisateur 554.
Cette requête fonctionne bien dans phpmyadmin, ça renvoie bien des valeurs.
Mais pas quand je l'insère dans la requête SQL du champ textselect.

Y a-t-il une limitation dans les paramètres de ce champ qui empêche de récupérer les valeurs d'autres tables que #__flexicontent_fields_item_relations ?

Merci pour votre aide.


 

Flexicontent 4.1.0b1
Joomla 3.9.18

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

More
1 year 5 months ago #84020 by micker
non cela vient du fait que tu definir 2 variables 1 pour la valeur (value) et 1 pour l'étiquette (title)

FLEXIcontent is Free but involves a very big effort on our part.
Like the our support? (for a bug-free FC, despite being huge extension) Like the features? Like the ongoing development and future commitment to FLEXIcontent?
-- Add your voice to the FLEXIcontent JED listing reviews. Thanks![/size]

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

More
1 year 5 months ago #84022 by bendeb
Pourtant, ce genre de requête fonctionne bien, alors qu'elle est plus complexe :
Code:
SELECT c.title AS value, c.title AS text FROM #__flexicontent_fields_item_relations AS f JOIN (     SELECT SUBSTRING_INDEX(f2.value, ':', 1) AS value_id     FROM #__flexicontent_fields_item_relations AS f2     JOIN #__flexicontent_items_tmp AS i2 ON f2.item_id = i2.id     WHERE f2.field_id = '921'     AND f2.value != ''     AND i2.created_by = '554'     AND i2.catid = '234'     GROUP BY value_id ) AS sub ON SUBSTRING_INDEX(f.value, ':', 1) = sub.value_id JOIN #__content AS c ON CAST(sub.value_id AS CHAR) = CAST(c.id AS CHAR) JOIN #__flexicontent_items_tmp AS i ON f.item_id = i.id WHERE f.field_id = '921' AND f.value != '' AND i.created_by = '554' AND i.catid = '234' GROUP BY value

Flexicontent 4.1.0b1
Joomla 3.9.18

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

More
1 year 5 months ago #84023 by micker
le soucis n'ets pas la longueur mais le fait que tu ne definie pas la valeur et le titre
il te faut un as value et as title pour que flexi puisse generer la liste coté backend

FLEXIcontent is Free but involves a very big effort on our part.
Like the our support? (for a bug-free FC, despite being huge extension) Like the features? Like the ongoing development and future commitment to FLEXIcontent?
-- Add your voice to the FLEXIcontent JED listing reviews. Thanks![/size]

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

More
1 year 5 months ago - 1 year 5 months ago #84024 by bendeb
Super, merci beaucoup, ça fonctionne bien à présent

Voici ma requête avec as value indiqué :

Code:
SELECT title AS value FROM #__content WHERE title != '' AND created_by = '{item->created_by}' AND catid = '234'



Merci.

Flexicontent 4.1.0b1
Joomla 3.9.18
Last edit: 1 year 5 months ago by bendeb.

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

More
1 year 5 months ago #84025 by micker
cool

FLEXIcontent is Free but involves a very big effort on our part.
Like the our support? (for a bug-free FC, despite being huge extension) Like the features? Like the ongoing development and future commitment to FLEXIcontent?
-- Add your voice to the FLEXIcontent JED listing reviews. Thanks![/size]

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

Moderators: vistamediajoomlacornerggppdk
Time to create page: 0.360 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