Radicore Forum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » RADICORE development » Application Development » Problem with two list1 transactions on one table
Problem with two list1 transactions on one table [message #1538] Tue, 12 August 2008 17:15 Go to previous message
bonzo_bcn is currently offline  bonzo_bcn
Messages: 152
Registered: June 2008
Senior Member
I have the 'person' table, each person can be of two types (field called 'pers_type'): 'coach' or 'player'.

I'm trying to figure out how to implement this in radicore using two menus, one for persons and one for players.

I created a list1 transaction for table 'person' called 'player(list1)', this generated and assigned as a task button an add1 transaction named person(add1) amongst others.

I then created a second list1 transaction on table 'person' and called it 'coach(list1), this transaction is automatically assigned the task button person(add1).

My idea was to filter in _cm_pre_insertRecord and in _cm_initialise using the $GLOBALS['task_id'] to identify if we are in the 'coach' menu or 'player' menu, and assigning/filtering by the field 'pers_type'.
like this:
    function _cm_initialise ($where, $selection){

	if ($GLOBALS['task_id'] == 'coach(list1)'){
		$vl_tippart = 'E';
	}else{
		$vl_pers_type = 'P';
	}
	
	if (empty($where)){
    		$where = "pers_type='" .$vl_pers_type . "'";
	}else{
			$where .= "AND pers_type='" .$vl_pers_type . "'";
	}
	
	
	return $where;
}


and this:
	function _cm_pre_insertRecord($rowdata)
	{
	    if ($GLOBALS['task_id'] == 'coach(add1)'){
			$rowdata['tippart'] = 'E';
		}else{
			$rowdata['tippart'] = 'P';
		}
		return $rowdata;
	}


The problem is that I can't create a custom add1 transaction. Both coach(list1) and player(list1) use the same add1 transaction id, therefore I can't filter the records.

So how should I solve this? Easy way is to have two separate tables but I'd rather use the same table.
 
Read Message
Read Message
Read Message
Read Message
Previous Topic: Help/suggestions with record filtering by user
Next Topic: $where clause problem with list1 and read
Goto Forum:
  


Current Time: Wed Nov 27 05:38:17 EST 2024

Total time taken to generate the page: 0.01341 seconds