This topic is locked

Problem with Events

6/23/2009 5:37:08 AM
PHPRunner General questions
S
slappy01 author

Newbie question.
I have a database that lists some information about data requests and I can click on the edit function to open up and edit page to change the status of some of the processes of the data request.
I want to display 2 database fields for each status (a status description and the status code)

I can do this for the the status that have to be changed by using some custom code in a lookup table.
i.e. conCat(codeDesc, ' (' , code , ') ') will display the following description and code
Some of the status on the edit page have to be read only so I can't use the custom code above. However I have tried to write a custom event

to display the description and code but the body of the edit form only displays the codes. If I put in a print_r statement then the descriptions are printed at the top of the web page.
Do I have to return the readonlyfields ?
Here is a copy of the custom event code.
[font=Courier New]//** Custom code ****
// put all codes in an array - the status codes are unique so this works
global $conn, $data, $readonlyfield;
$sql = "SELECT code, codeDesc FROM tblcodelist WHERE type in

('statusconfig',

'statusprocess',

'statusverify',

'statusrequest',

'statusextract',

'statustransform',

'statusmetadata',

'statustransfer',

'statusoverall') ORDER BY type";
$result = db_query($sql, $conn);

$row = db_fetch_array($result);

$codes=array();
do {

$codes[$row["code"]] = $row["codeDesc"];

} while ($row = db_fetch_array($result));
// get request information

// you'll need to add a join to get the model name here
$sql = "SELECT requestName,

requestConfigStatus,

requestExtractionStatus,

requestTransformStatus,

requestTransferStatus,

metadataStatus,

requestOverallProcessingStatus

FROM tblrequest WHERE requestName='".$data["requestName"]."'";
$result = db_query($sql, $conn);

$row = db_fetch_array($result);
// put information into required readonly fields - decoding where necessary

$readonlyfields["requestName"] = $row["requestName"]; // this one is not coded

$readonlyfields["requestConfigStatus"] = $codes[ $row["requestConfigStatus"]]; // this one is coded

$readonlyfields["requestExtractionStatus"] = $codes[ $row["requestExtractionStatus"]];

$readonlyfields["requestTransformStatus"] = $codes[ $row["requestTransformStatus"]];

$readonlyfields["requestTransferStatus"] = $codes[ $row["requestTransferStatus"]];

$readonlyfields["metadataStatus"] = $codes[ $row["metadataStatus"]];

$readonlyfields["requestOverallProcessingStatus"] = $codes[ $row["requestOverallProcessingStatus"]];
print_r ($readonlyfields);
Thanks for any help or suggestions

S
slappy01 author 6/23/2009

problem solved.
Newbie mistake.
change
to
[font=Courier New]global $conn, $data, $readonlyfields;