CS_Events_Order
QuestionDescriptionResponseTypeFormatTextHelpPreLogicPostLogic
CS_Events_OrderingControl System Eventi OrderingNULL1global $TABLEBGCOLOUR; global $TABLEFGCOLOUR; global $TABLEBORDER; global $LINENUMBERS; $TABLEBGCOLOUR="#0080C0"; $TABLEFGCOLOUR="WHITE"; $TABLEBORDER=6; $LINENUMBERS=0; global $NOSORT; $NOSORT=1; if ($prm=='UP' or $prm=='DOWN') { $evt=abs($act); $inst=ShowQueryResultScalar("select rInstance from Responses where qID='CS_Event_Order' and CaseID='$evt'"); $ord=ShowQueryResultScalar("select rValue from Responses where qID='CS_Event_Order' and CaseID='$evt'"); if ($prm=='UP') $tord=$ord-1; else $tord=$ord+1; $tevt=ShowQueryResultScalar("select CaseID from Responses where qID='CS_Event_Order' and rInstance='$inst' and rValue='$tord'"); if ($tevt!="") { ExecuteSQL("update Responses set rValue=$tord where qID='CS_Event_Order' and CaseID='$evt'"); ExecuteSQL("update Responses set rValue=$ord where qID='CS_Event_Order' and CaseID='$tevt'"); } } echo "

Process: ", $_SESSION['CS_Proc_Desc'], "


"; $Instance=$_SESSION['CaseId']; $_SESSION['Instance']=$Instance; $lblEvent=$_REQUEST['lblEvent']; ExecuteSQL("CREATE TEMPORARY TABLE tmpk1 (EventId char(15), Event char(255))"); ExecuteSQL("CREATE TEMPORARY TABLE tmpk2 (EventId char(15), EvtOrder char(255))"); ExecuteSQL("insert into tmpk1 (EventId,Event) select CaseID as EventId, rValue as Event from Responses where rInstance=$Instance and qID='CS_Event_Desc'"); ExecuteSQL("insert into tmpk2 (EventId,EvtOrder) select CaseID as EventId, rValue as EvtOrder from Responses where rInstance=$Instance and qID='CS_Event_Order'"); $sql="select tmpk2.EvtOrder, tmpk1.EventId, tmpk1.Event, " . "concat('" . "') as Direction " . "from tmpk1,tmpk2 where tmpk1.EventId=tmpk2.EventId order by EvtOrder"; ShowQueryResult($sql);