This topic is locked

Hide record based on field value

11/18/2008 11:37:12 AM
PHPRunner General questions
buddy author

I am trying to hide a record in the list view based on a field value. I tried an event "List page:Before Process"
if ($data["Status"]=="Requires Protocol")

{$record["view_record"] = false;

}

else

{$record["view_record"] = true;}
but it does not work.
Thanks in advance for any help.

Sergey Kornilov admin 11/18/2008

Try the following:

return $data["Status"]!="Requires Protocol";
buddy author 11/18/2008

Try the following:


return $data["Status"]!="Requires Protocol";


Excuse my newbiness but here's what I tried and it did not work:
return $data["Status"]!="Requires Protocol"

{$record["view_record"] = false;

}

else

{$record["view_record"] = true;}
Did I miss it?

Sergey Kornilov admin 11/18/2008

You need to copy and paste my code as is. There is no need to edit it or add something else.

buddy author 11/18/2008


return $data["Status"]!="Requires Protocol";


Tried that only in List Page: Before Process and got:
Error type8

Error descriptionUndefined variable: data

URLwww.datapathoutsourcer.com/DataPath_Outsourcer_list.php?

Error file
/home/sourcer/public_html/include/DataPath_Outsourcer_events.php

Error line
119

SQL query
select TableName,AccessMask from `DataPath_Outsourcer_ugrights` where GroupID in (-1)

buddy author 11/18/2008

You need to copy and paste my code as is. There is no need to edit it or add something else.


Tried that only in List Page: Before Process and got:
Error type8

Error descriptionUndefined variable: data

URLwww.datapathoutsourcer.com/DataPath_Outsourcer_list.php?

Error file
/home/sourcer/public_html/include/DataPath_Outsourcer_events.php

Error line
119

SQL query
select TableName,AccessMask from `DataPath_Outsourcer_ugrights` where GroupID in (-1)

Sergey Kornilov admin 11/18/2008

BeforeProcess event is called once when page is loaded. It doesn't make sense to use this event to hide a record.
Put this code to Before record processed event.

buddy author 11/18/2008

BeforeProcess event is called once when page is loaded. It doesn't make sense to use this event to hide a record.

Put this code to Before record processed event.


That worked perfectly. One final question.
Can I exclude more results in the same string?
Requires Protocol (works)
Would like to add:
Require Driver Requirements Checklist

New Request

J
Jane 11/19/2008

Yes.

All values are in the $data array.

buddy author 11/19/2008

Yes.

All values are in the $data array.


Thanks Jane but I'm really not sure how to include the additional values in this string.
return $data["Status"]!="Requires Protocol";
These are the three that I need to exclude:
Requires Protocol

New Driver

Update Driver Requirements Checklist
Thanks for your help.

Sergey Kornilov admin 11/19/2008

Buddy,
try this:

return ($data["Status"]!="Requires Protocol" && $data["Status"]!="New Driver" && $data["Status"]!="Update Driver Requirements Checklist");


Make sure it appears as a single line in your code.