11 years ago
Topic

Hi

The cascade select dynamic field is great. It is quite simple to use if your SQL queries are only in a single table.

AS for the Select Dynamic field you have the 'free' SQL possibility. However it seems these feature is not active. Whatever I write as the free SQL query, the field only reads the first method query!

Another question  is : how should I use the PARENT field in the free sql query? Do I only have to set any field as PARENT (ex: SELECT title as TEXT, id as VALUE, toto as PARENT ... ?)

thanks a lot


cyril

Get a Book for SEBLOD
11 years ago
0
Level 1

Hi

I just purchased the 1.1.0 SELECT DYNAMIC CASCADE (http://www.seblod.com/products/2997) and now the free SQL query works but I don't know how I can use the PARENT parameter in the WHERE statement of the  free SQL query.

Can Octopoos give an example please?

thanks

cyril

11 years ago
2
Level 1

Hi Cyril,

Here is an example:

SELECT my_name AS text, my_id AS value FROM #__my_table WHERE my_parent_id = [parent]

Thanks & Regards,
Saba

11 years ago
1
Level 2

Thanks SAba, it's better, thanks !

We spent a while before we understood the PARENT field should also be filled with the exact field we put in the sql query:


for a more complex SQL query such as

select CONTENT.id as id, CONTENT.title as text  from #__content AS CONTENT inner join #__cck_store_form_table AS TABLE  TABLE.id = CONTENT.id  where TABLE.linkingfield = [parent]

the PARENT field should be set to linkingfield

now it's working!


thanks for your help

cyril


127 Posts
Cappu
10 years ago
0
Level 3

Thank you, thank you, thank you cyril for this hint!!!! This saved my day! 

This 'manual' query seems to be necessary if your data is in #__content table.

Just notised a missing ON. The following query worked for me:

SELECT c.id AS value, c.title AS text FROM #__content AS c INNER JOIN #__cck_store_form_mytable AS t ON (t.id=c.id) WHERE t.linkingfield = [parent]

Hey, Seblod-Team. Could you add this information on SQL query for #__content to the documentation of the Select Dynamic Cascade Plugin. Please!

9 years ago
2
Level 1

Help Please!

I'm just trying to do this with the Dynamic cascading fields: 

 Only one flat table, :  [id] [make] [model] [year] [price]

I want to populate the first field with make, the second with model  (models of the selected make )

I used the following as my for the first (make) field:

SELECT DISTINCT make AS text, make AS value FROM #__cck_store_form_mcars

I could use the construct for the second field (model)  with make as the parent and it works but gives duplicates.

I tried:

SELECT DISTINCT model AS text, model AS value FROM #__cck_store_form_mcars WHERE make=[parent]

for the second, but it did not populate with the models. 

What would be the correct syntax for the free sql statement?

9 years ago
1
Level 2

Managed to find a work-around using the Construction method. 

To eliminate duplicates I entered this in the WHERE field:

1 GROUP BY model

The code apparently always adds an "AND" where there is something in the WHERE field.  In order to get around that, I added the "1" (constructs "WHERE  [...] AND 1 ") then used GROUP BY to eliminate the duplicates.  

9 years ago
0
Level 3

Hi shoshanaz,

In your SQL query you can modify "WHERE make=[parent]" by "WHERE make = #parent_id#".

Regards,
Mehdi

103 Posts
shubhaanshu
8 years ago
0
Level 1

Thank you Cyril, Saba, Mehdi, Shoshanaz and Cappu!

This topic is really very helpful, I just solved my problem with the help of your posts. I think it should be marked as solved.

I am very grateful to "SEBLOD", it's Team and the community.

Get a VIP membership