Hello.
I’m trying to find a solution how to pass a parameter into @SELECT query of the Input Option Values of the listbox.
There is a custom MIGXdb table “modx_listing_categories” with fields: id, name, parent_id, etc. Categories with parent_id=0 are root categories.
I’m trying to configure MIGXdb formtab field “parent_id” of type listbox (single select) so that the listbox contain all categories excluding the category which is currently edited in the CMP.
Input TV type: listbox,
Input Option Values:
@SELECT "- ROOT -" AS name, 0 AS id UNION SELECT name, id FROM modx_listing_categories WHERE id != "[[+current_record_id]]" ORDER BY name
Is there any way to pass the currently editing record id (modx_listing_categories.id) into the SQL Select query?
Here is the formtabs config:
{
"formtabs":[
{
"MIGX_id":14,
"caption":"General",
"print_before_tabs":"0",
"fields":[
{
"MIGX_id":97,
"field":"id",
"caption":"_id",
"description":"",
"description_is_code":"0",
"inputTV":"",
"inputTVtype":"",
"validation":"",
"configs":"",
"restrictive_condition":"",
"display":"none",
"sourceFrom":"config",
"sources":"",
"inputOptionValues":"",
"default":"",
"useDefaultIfEmpty":"0",
"pos":1
},
{
"MIGX_id":91,
"field":"parent_id",
"caption":"Parent Category",
"description":"",
"description_is_code":"0",
"inputTV":"",
"inputTVtype":"listbox",
"validation":"",
"configs":"",
"restrictive_condition":"",
"display":"",
"sourceFrom":"config",
"sources":"",
"inputOptionValues":"@SELECT \"- ROOT -\" AS name, 0 AS id UNION SELECT name, id FROM modx_listing_categories WHERE id !=\"[[+current_record_id]]\" ORDER BY name",
"default":"0",
"useDefaultIfEmpty":"0",
"pos":3
},
{
"MIGX_id":92,
"field":"name",
"caption":"name",
"pos":4
},
{
"MIGX_id":93,
"field":"alias",
"caption":"alias",
"pos":5
},
{
"MIGX_id":94,
"field":"published",
"caption":"Published",
"description":"",
"description_is_code":"0",
"inputTV":"",
"inputTVtype":"checkbox",
"validation":"",
"configs":{
"allowBlank":true,
"displayAsSwitch":true
},
"restrictive_condition":"",
"display":"",
"sourceFrom":"config",
"sources":"",
"inputOptionValues":"Set As Published==1",
"default":"0",
"useDefaultIfEmpty":"0",
"pos":6
},
{
"MIGX_id":95,
"field":"deleted",
"caption":"Deleted",
"description":"",
"description_is_code":"0",
"inputTV":"",
"inputTVtype":"checkbox",
"validation":"",
"configs":{
"allowBlank":true,
"displayAsSwitch":true
},
"restrictive_condition":"",
"display":"",
"sourceFrom":"config",
"sources":"",
"inputOptionValues":"Set As Deleted==1",
"default":"",
"useDefaultIfEmpty":"0",
"pos":7
}
],
"pos":1
}
],
...
}