dsmenu

With the dsmenu in the dynamic menu, I know it’s a dataset for the sc_lookup.
sc_lookup(Dataset, “SQL Command”, “Connection”)
http://www.comf.com.br/scriptcase/devel/help/macros/en_us/macros/sc_lookup.html

Is there any restrictions to the dataset, like number of columns? When I use
foreach ({dsmenu} as $arr_menu)

I get an invalid argument for foreach.

My SQL statement is correct, it will run as a view.

sc_lookup(dsmenu, " SELECT
If(
((SCT_Linker_SubGroup != ‘’) && (SCT_Linker_SubGroup != Null)),
CONCAT(Course_Name , ’ (’ , SCT_Linker_SubGroup + ‘)’),
Course_Name
) AS CName,
CONCAT( Student.Student_Korean_FirstName_EN , ’ ', Student.Student_Korean_LastName_EN ) AS StudentName,
Semester_Course.SC_End_Date,
Semester.Semester_Student_SchoolSemesterID,
Employee.Employee_ID
FROM
Course RIGHT JOIN
(
(
(Student LEFT JOIN Semester ON Student.Student_ID = Semester.Semester_Student_ID)
LEFT JOIN Semester_Course
ON Semester.Semester_ID = Semester_Course.SC_Semester_ID
) LEFT JOIN (
Employee RIGHT JOIN SCT_LinkerID ON
Employee.Employee_ID = SCT_LinkerID.SCT_Linker_Employee_ID
) ON Semester_Course.SC_ID = SCT_LinkerID.SCT_Linker_Semester_Course_ID
) ON Course.Course_ID = Semester_Course.SC_Course_ID
WHERE
(((Semester_Course.SC_End_Date) is Null))
ORDER BY
CONCAT(Student_Korean_FirstName_EN, ’ ', Student_Korean_LastName_EN)
)");

Re: dsmenu

This is the code I use on my tree on the onLoad event:

===============================================================================================================
$app_menu = ‘menu_principal’;
sc_appmenu_reset($app_menu);
sc_appmenu_create($app_menu);
//ADD-Entitati ----------------------------------------------------------------------------
$Item_id = ‘item_a1’;
$Label = ’ Adauga Entitate’;
$Application = ‘form_entitati_ADD_EDIT’;
sc_appmenu_add_item($app_menu,$Item_id,$Label,$Application,par_entitate_id=9999999999999,‘folder_open_add2_16.png’);
//END#ADD-Entitati ------------------------------------------------------------------------

//Cauta-Entitati --------------------------------------------------------------------------
$Item_id = ‘item_b1’;
$Label = ’ Cauta Entitate’;
$Application = ‘grid_lista_entitati_istoric’;
sc_appmenu_add_item($app_menu,$Item_id,$Label,$Application,‘view_16.png’);
//END#Cauta-Entitati ----------------------------------------------------------------------

//Entitati --------------------------------------------------------------------------------
$sql_entitati_select = "
SELECT DISTINCT
CONCAT(‘f_’,oc_common_entitati.ID) AS ID ,
oc_common_entitati.Denumire,
oc_common_entitati.ID
FROM
oc_common_entitati
INNER JOIN oc_common_entitati_ramuri
ON ( oc_common_entitati.ID = oc_common_entitati_ramuri.entitate_id)
ORDER BY
oc_common_entitati.Denumire;";
sc_select(oc_entitati_ds, $sql_entitati_select);

while(!$oc_entitati_ds->EOF){

$Item_entitate_id = $oc_entitati_ds->fields[0];
$Label = ’ '.$oc_entitati_ds->fields[1];
$Id_real_entitate = $oc_entitati_ds->fields[2];
sc_appmenu_add_item($app_menu,$Item_entitate_id,$Label,‘folder_open_16.png’);

//Ramuri ------------------------------------------------------------------------------
$sql_ramuri_select = "
SELECT
CONCAT(‘r_’,ID) AS ID,
CONCAT(‘f_’,entitate_id) AS entitate_id,
NumeRamura,
ID
FROM
oc_common_entitati_ramuri
WHERE
entitate_id = $Id_real_entitate
ORDER BY
NumeRamura ASC;";

sc_select(oc_ramuri_ds, $sql_ramuri_select);

while(!$oc_ramuri_ds->EOF){

$Item_Ramura_Id = $oc_ramuri_ds->fields[0];
$Id_Parent = $oc_ramuri_ds->fields[1];
$Label = ' '.$oc_ramuri_ds->fields[2];
//$Label = ' '.$oc_ramuri_ds->fields[2].' '.$Item_Ramura_Id;
$Id_Real_Ramura = $oc_ramuri_ds->fields[3]; //Pt. - lista de salariati & Add Contract
sc_appmenu_add_item($app_menu,$Item_Ramura_Id,$Id_Parent,$Label,,,'folder_open_go_16.png');

// CONTRACTE MUNCA -----------------------------------------------------------------
$Item_cm_id ='item_'.createRandomKey(5);
$Id_Parent = $Item_Ramura_Id;
$Label = ' '.'Contracte Munca';
$Aplication = 'contracte_munca_LISTA';

sc_appmenu_add_item($app_menu,
        	$Item_cm_id,
        	$Id_Parent,
        	$Label,
        	$Aplication,
        	var_entitate_ramura_id = $Id_Real_Ramura,
        	'preferences_contact_list_16.png');

// ADAUGA SALARIAT # BUTON ---------------------------------------------------------
$Item_add_sal ='item_'.createRandomKey(5);
$Id_Parent = $Item_cm_id;
$Label = ' '.'Adauga Contract';
$Aplication = 'contracte_munca_ADD_EDIT';

sc_appmenu_add_item($app_menu,
        	$Item_add_sal,
        	$Id_Parent,
        	$Label,
        	$Aplication,
        	var_ID = $Id_Real_Ramura;var_entitate_ramura_ID = $Id_Real_Ramura,
        	'note_add_16.png');

// SALARIATI ------------------------------------------------------------------------
$sql_salariati = "
    SELECT 
      CONCAT('s_',oc_salarii_contracte_munca.ID) AS ID,
      CONCAT('r_',oc_salarii_contracte_munca.entitate_ramura_id) AS entitate_ramura_id,
      CONCAT(oc_view_lista_persoane_rezervor.Nume,' ',
      oc_view_lista_persoane_rezervor.Initiala,' ',
      oc_view_lista_persoane_rezervor.Prenume) AS Salariat,
      oc_salarii_contracte_munca.ID
    FROM
      oc_view_lista_persoane_rezervor
      LEFT OUTER JOIN oc_salarii_contracte_munca 
        ON (oc_view_lista_persoane_rezervor.entitati_ID = oc_salarii_contracte_munca.Salariat)
    WHERE
      oc_salarii_contracte_munca.entitate_ramura_id = $Id_Real_Ramura
    ORDER BY
      oc_view_lista_persoane_rezervor.Nume,
      oc_view_lista_persoane_rezervor.Initiala,
      oc_view_lista_persoane_rezervor.Prenume ASC;";
sc_select(oc_salariat_ds, $sql_salariati);

while( ! $oc_salariat_ds->EOF){

  $Item_sal_id = $oc_salariat_ds->fields[0];
  $Id_Parent = $Item_Ramura_Id;
  $Label = ' '.$oc_salariat_ds->fields[2];
  $Id_real_cm = $oc_salariat_ds->fields[3];
  $Aplication = 'contracte_munca_ADD_EDIT';

  sc_appmenu_add_item($app_menu,
        		$Item_sal_id,
        		$Id_Parent,
        		$Label,
        		$Aplication,
        		var_ID = $Id_real_cm;var_entitate_ramura_ID = $Id_Real_Ramura,
        		'contract_edit_lists_16.png');
  
  $oc_salariat_ds->MoveNext();
}
$oc_salariat_ds->Close();
// End SALARIATI ---------------------------------------------------------------------

// ARHIVA ----------------------------------------------------------------------------
$Item_Arhiva_Id ='item_'.createRandomKey(4);
$Id_Parent = $Item_Ramura_Id;
$Label = ' '."Arhiva";

sc_appmenu_add_item($app_menu,
        	$Item_Arhiva_Id,
        	$Id_Parent,
        	$Label,,,
        	'calendar_month_down_16.png');

	// ADAUGA ARHIVA # BUTON -------------------------------------------------------------
	$Id_Add_CM ='item_'.createRandomKey(4);
	$Id_Parent = $Item_Arhiva_Id;
	$Label = ' '."Adauga Arhiva";
	//$Label = ' '."Adauga Arhiva".' '.$Id_Real_Ramura;
	$Aplication = "entitati_arhiva_ADD_EDIT"; //Adauga o arhiva
	
		//E bine asa la parametri ca adaugam nu cautam ramuri ;)
  sc_appmenu_add_item($app_menu,
        		$Id_Add_CM,
        		$Id_Parent,
        		$Label,
        		$Aplication,
        		var_entitate_id = $Id_Real_Ramura;var_entitate_ramura_id = $Id_Real_Ramura,
        		'calendar_month_add_16.png');

	// LISTA LUNA/AN ----------------------------------------------------------------------
	$sql_arhiva = "
    SELECT
      Concat('A_',ID) As ID,
      entitate_ramura_id,
      DATE_FORMAT(Data,'%M %Y') AS Data,
      ID
    FROM
      oc_common_entitati_arhiva
    WHERE
      entitate_ramura_id = $Id_Real_Ramura
    Order By
      Month(Data),Year(Data);";
	sc_select(oc_arhiva_ds, $sql_arhiva);

	while( ! $oc_arhiva_ds->EOF){

  	$Item_LunaAn_id = $oc_arhiva_ds->fields[0];
  	$Id_Parent = $Item_Arhiva_Id;
  	$Label = ' '.$oc_arhiva_ds->fields[2];
  	$Id_real_Arhiva = $oc_arhiva_ds->fields[3];

  	sc_appmenu_add_item($app_menu,
        			$Item_LunaAn_id,
        			$Id_Parent,
        			$Label,,,
        			'calendar_month_edit_16.png');
  
   // STATE-PLATA-CATEGORIE ---------------------------------------------------------------
  $Item_Ctg_Id ='item_'.createRandomKey(6);
  $Id_Parent = $Item_LunaAn_id;
  $Label = ' '."State Plata";
  $Aplication = "grid_stat_plata_linii";
  
  sc_appmenu_add_item($app_menu,
        $Item_Ctg_Id,
        $Id_Parent,
        $Label,
        $Aplication,
        var_entitati_arhiva_id = $Id_real_Arhiva,
        'list_all_participants_22.png');

     // ADAUGA STAT PLATA # BUTON -------------------------------------------------------
    $Item_Btn_Id ='item_'.createRandomKey(6);
    $Id_Parent = $Item_Ctg_Id;
    $Label = ' '."Adauga Stat Plata";
    $Application = "adauga_stat_plata";

    sc_appmenu_add_item($app_menu,
          $Item_Btn_Id,
          $Id_Parent,
          $Label,
          $Application,
          var_arhiva_id = $Id_real_Arhiva; var_ramura_id = $Id_Real_Ramura,
          'list2_add_16.png');

			// END ADAUGA STAT PLATA # BUTON -------------------------------------------------------
  
   // END STATE-PLATA-CATEGORIE ---------------------------------------------------------------

  $oc_arhiva_ds->MoveNext();
}
$oc_arhiva_ds->Close();
 // End ARHIVA ----------------------------------------------------------------------------------

$oc_ramuri_ds->MoveNext();

}
$oc_ramuri_ds->Close();
// END RAMURI --------------------------------------------------------------------------------------
$oc_entitati_ds->MoveNext();
}
$oc_entitati_ds->Close();