This topic has been edited with new information’s!
I’m working on a project that has over 20 calendars, each of which can be selected from a menu within the menu-application. These calendars are linked to individual user groups.
After using this project for a few years, we’ve noticed that the names on some menu items have become outdated.
Is there a way to implement a lookup of the label on the MENUITEMS from another table that has records for all the calendars, along with their unique IDs and corresponding names?
This would help keep everything consistent and up-to-date without have to deploy a new menu-application every time there is a change.
What I have tried until now, which is not working:
The lookup table:
CREATE TABLE tbl_calendar_settings (
calendar_setting_id int(11) NOT NULL,
calendar_setting_menu_name varchar(45) NOT NULL
);
The sc_lookup, in the Load Event as I expect it will look like:
// SQL Query Calendar 1
$sql_1 = “SELECT calendar_setting_menu_name FROM tbl_calendar_settings WHERE calendar_setting_id = 1”;
// Execute the SQL query
sc_lookup(rs, $sql_1);
// Check if query returned a result
if (isset({rs[0][0]})) {
// Assign the value to a label field
{item_17} = {rs[0][0]};
} else {
{item_17} = ‘No data found’;
}
// SQL Query Calendar 2
$sql_2 = “SELECT calendar_setting_menu_name FROM tbl_calendar_settings WHERE calendar_setting_id = 2”;
// Execute the SQL query
sc_lookup(rs, $sql_2);
// Check if query returned a result
if (isset({rs[0][0]})) {
// Assign the value to a label field
{item_18} = {rs[0][0]};
} else {
{item_18} = ‘No data found’;
}
Etc.
The item_17 and item_18 are of course not the right field to be assigned but is the only unique value for the MENU ITEM.
In the browsers source the MENU ITEM 17 looks like this:
“item_17”:{“label”:“Calendar1”}