This topic is locked

What event to use

9/3/2008 7:25:02 PM
PHPRunner General questions
V
vytb author

What event and code form should I use to get values on list page based on qualifications of the values in (other) table fields? So far, my following code on 'list page: after record processed' event produces empty sells...
if ($data['(DATEDIFF(visit.Date_of_d,identification.BirthDate)/365)'] <='16')

$data['A']='A1';
if ($data['age at diagnosis'] >'40')

$data['A']='A3';
if ($data['age at diagnosis'] == null)

$data['A']=null;
else

$data['A']='A2';

J
Jane 9/4/2008

Hi,
use custom fornat for your field A on the "View as" settings dialog on theVisual Editor tab.

All field values are stored in teh global $data array.

Here is a sample:

global $data;

if ($data["age at diagnosis"]>'40')

$value="A3";

V
vytb author 9/5/2008

Hi,

use custom fornat for your field A on the "View as" settings dialog on theVisual Editor tab.

All field values are stored in teh global $data array.

Here is a sample:


Does not work.
I put the following code in the field 'A' formatted as custom in 'View as' settings.

-------------

global $data;

if ($data["age at diagnosis"]<'16')

$value="A1";
if ($data["age at diagnosis"]>='16')

$value="A2";

-------------

The result is always A2 maybe because 'age at diagnosis' in query is the datediff(visitdate, birthdate)/365 and birthdate is from joined table. Isn't it?
What's missing to display A1 and A2 right?
The exact query is following

---------------

SELECT

round(DATEDIFF(visit.Date_of_d,identification.BirthDate)/365, 0) AS `'age at diagnosis'`,

A

FROM visit

INNER JOIN identification ON visit.SubjectId = identification.id

WHERE visit.VisitNb = '1'

J
Jane 9/8/2008

It's difficult to tell you what's happening without seeing actual files.
Please publish your project on Demo Account and send to support@xlinesoft.com a URL to your pages along with instructions on reproducing this error.

I'll find what's wrong with your project inspecting it at Demo account site.

V
vytb author 9/8/2008

OK, it's at http://demo.asprunner.net/vytb_videotron_c.../visit_list.php, field A that should indicate A1, A2, A3 depending on the age_at_d.

J
Jane 9/9/2008

Here is the correct code:

global $data;

if ($data["age at diagnosis"]<16)

$value="A1";

if ($data["age at diagnosis"]>=40)

$value="A2";

if ($data["age at diagnosis"]<40 && $data["age at diagnosis"]>=16)

$value="A3";