Forums

Delete selected records

Marks 30 May, 2020
I am using a row selector in a table, and am selecting table entries into an array created with the default checkbox name gcb[]. Let's say the underlying table is tablex

Each entry in the gcb[] array is the aid of a record in the table, so there may be any number of entries in the array, from none to many. An example array might be, where 4 entries have been selected in the form table:
 [gcb] => Array
        (
            [0] => 4
            [1] => 9
            [2] => 10
            [3] => 11
        )
Now I'd like to delete the 4 (in this case) records from tablex, so I am using a Delete action. Does anybody know please how to set up the WHERE clause to do something like this logic?

For each value in gcb[]
DELETE * from tablex WHERE aid = val(gcb[]);

I think I should be using the IN operator, but have no idea how to set the value of the DELETE condition.

Many thanks in advance for any offers on this!
Max_admin 30 May, 2020
Answer
{data:gcb} will return the list of aids, you can use that in a where condition in the "Delete Data" action.
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
Marks 30 May, 2020
Thanks Max- simple in the end, wasn't it! I had tried {data:gcb[]} and was scratching my head....
Max_admin 30 May, 2020
1 Likes
no problem, I would also suggest you try ChonoForms v7 because it has a better listing features!
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
This topic is locked and no more replies can be posted.