Row - Rendered Event
Row - Rendered Event
Row - Rendered Event
com
Skip to content
FAQ
Register
Login
Row_Rendered event
Post a reply
15 posts • Page 1 of 1
Row_Rendered event
Hi
Within the LIST Page i am trying to get it to Highlight any duplicated vaules within a field and mark them as red.
i.e
if extension and groupid match another record within the same table it highlight both in red.
cheers.... again
andy
andyrav
Posts: 411
Joined: Wed Feb 25, 2015 6:38 pm
Top
Use your own words to explain us about the real case you are facing in more detail. Give us the real example.
mobhar
Posts: 6313
Joined: Wed Jun 05, 2013 2:11 pm
Top
andyrav
Posts: 411
Joined: Wed Feb 25, 2015 6:38 pm
Top
andyrav wrote:
> there are duplicated <extension> withing the same <groupid>
Now please give us the real example of this in more detail. How?
mobhar
Posts: 6313
Joined: Wed Jun 05, 2013 2:11 pm
Top
Hi
Each recored as groupid and extension, the extension has to be unquie withing that group.
andyrav
Posts: 411
Joined: Wed Feb 25, 2015 6:38 pm
Top
You may use the SQL to check the conditional record in "Row_Rendered" server event, and if it meets the criteria, implement the
code as shown in example "Row_Rendered" section of PHPMaker Help menu.
mobhar
Posts: 6313
Joined: Wed Jun 05, 2013 2:11 pm
Top
if ($this->PageID == "list"){
$rs = ew_Execute("select * from bw_users WHERE extension in (SELECT extension from bw_users GROUP BY extension
HAVING COUNT(id) >1 ) and groupid in (SELECT groupid from bw_users GROUP BY groupid HAVING COUNT(id) >1 ");
if ($rs && $rs->RecordCount() > 0) {
$this->extension->CellAttrs["style"] = "background-color: #ffcccc";
}}
getting
Failed to execute SQL: select * from bw_users WHERE extension in (SELECT extension from bw_users GROUP BY extension
HAVING COUNT(id) >1 ) and groupid in (SELECT groupid from bw_users GROUP BY groupid HAVING COUNT(id) >1 .
Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right
syntax to use near '' at line 1
andyrav
Posts: 411
Joined: Wed Feb 25, 2015 6:38 pm
Top
Wrong SQL implementation. You should include the CurrentValue of the field in the SQL to check.
mobhar
Posts: 6313
Joined: Wed Jun 05, 2013 2:11 pm
Top
Hi not sure how. The extension can be any value. Just need to find the ones that are duplicated and with the same groupid. I.e the
extension has to be unique within that groupid
Thanjd
andyrav
Posts: 411
Joined: Wed Feb 25, 2015 6:38 pm
Top
In "Row_Rendered" server event, you can simply get the value from any field just like:
$this->extension->CurrentValue
or
$this->groupid->CurrentValue
mobhar
Posts: 6313
Joined: Wed Jun 05, 2013 2:11 pm
Top
andyrav
Posts: 411
Joined: Wed Feb 25, 2015 6:38 pm
Top
Always try it by your hand first, and post your code for discussion.
mobhar
Posts: 6313
Joined: Wed Jun 05, 2013 2:11 pm
Top
if ($this->PageID == "list"){
$rs = ew_Execute("SELECT * FROM bw_users WHERE extension LIKE '".$this->extension->CurrentValue."' and groupid
LIKE '".$this->groupid->CurrentValue."'");
if ($rs && $rs->RecordCount() > 0) {
$this->extension->CellAttrs["style"] = "background-color: #ffcccc";
}
}
if ($this->PageID == "list"){
$rs = ew_Execute("SELECT * FROM bw_users WHERE extension = '".$this->extension->CurrentValue."' and groupid =
'".$this->groupid->CurrentValue."'");
while ($rs = $rs) {
$this->extension->CellAttrs["style"] = "background-color: #ffcccc";
$rs->MoveNext();
}
}
andyrav
Posts: 411
Joined: Wed Feb 25, 2015 6:38 pm
Top
Re: Row_Rendered event
Change this:
if ($rs && $rs->RecordCount() > 0) {
to:
if ($rs && $rs->RecordCount() > 1) {
mobhar
Posts: 6313
Joined: Wed Jun 05, 2013 2:11 pm
Top
andyrav
Posts: 411
Joined: Wed Feb 25, 2015 6:38 pm
Top
Display posts from previous: All posts Sort by Post time Ascending Go
Post a reply
15 posts • Page 1 of 1
Board index
Delete all board cookies • All times are UTC + 8 hours