Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

Row - Rendered Event

Download as pdf or txt
Download as pdf or txt
You are on page 1of 5

www.hkvforums.

com
Skip to content

Board index ‹ PHPMaker ‹ General Discussion (PHPMaker)


Change font size
Print view

FAQ
Register
Login

Row_Rendered event
Post a reply
15 posts • Page 1 of 1

Row_Rendered event

by andyrav » Wed May 06, 2015 11:04 pm

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.

how would i go about it?

cheers.... again
andy

andyrav

Posts: 411
Joined: Wed Feb 25, 2015 6:38 pm

Top

Re: Row_Rendered event

by mobhar » Thu May 07, 2015 3:22 pm

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

Re: Row_Rendered event

by andyrav » Thu May 07, 2015 4:38 pm

I have a table <bw_users> with the schema


id,sessionid,proposalid,enterpriseid,groupid,firstname,lastname,systemuserid,portednumber,newnumber,alternatenumber,extension,
department
what i want to do is within the LIST page is Highlight the Cell in red where there are duplicated <extension> withing the same
<groupid>

hope this makes sence


cheers
andy

andyrav

Posts: 411
Joined: Wed Feb 25, 2015 6:38 pm

Top

Re: Row_Rendered event


by mobhar » Thu May 07, 2015 5:04 pm

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

Re: Row_Rendered event

by andyrav » Thu May 07, 2015 8:05 pm

Hi
Each recored as groupid and extension, the extension has to be unquie withing that group.

i did this via insert and update


$value = ew_ExecuteRow("SELECT extension FROM bw_users WHERE groupid = '" . $rsnew["groupid"] . "'" . " and extension
= '" . $rsnew["extension"] . "'" . " and systemuserid <> '$userid' ");
if (count($value) > 1)
{
$this->CancelMessage = "Extension Number in use.";
return FALSE;
}

andyrav

Posts: 411
Joined: Wed Feb 25, 2015 6:38 pm

Top

Re: Row_Rendered event


by mobhar » Fri May 08, 2015 9:25 am

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

Re: Row_Rendered event

by andyrav » Fri May 08, 2015 7:43 pm


anything like

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

Re: Row_Rendered event


by mobhar » Sat May 09, 2015 9:51 am

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

Re: Row_Rendered event

by andyrav » Sat May 09, 2015 3:24 pm

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

Re: Row_Rendered event


by mobhar » Sat May 09, 2015 4:29 pm

In "Row_Rendered" server event, you can simply get the value from any field just like:

$this->extension->CurrentValue
or
$this->groupid->CurrentValue

and use it as the parameters in your SQL.

mobhar

Posts: 6313
Joined: Wed Jun 05, 2013 2:11 pm
Top

Re: Row_Rendered event


by andyrav » Sat May 09, 2015 4:56 pm

Any chance you could write this for me? :-)

andyrav

Posts: 411
Joined: Wed Feb 25, 2015 6:38 pm

Top

Re: Row_Rendered event

by mobhar » Sat May 09, 2015 10:32 pm

Always try it by your hand first, and post your code for discussion.

So here is the clue for your SQL:

"SELECT * FROM bw_users WHERE extension LIKE '".$this->extension->CurrentValue."'";

Adjust your SQL that suits your needs.

mobhar

Posts: 6313
Joined: Wed Jun 05, 2013 2:11 pm

Top

Re: Row_Rendered event


by andyrav » Sun May 10, 2015 1:15 am

thanks this code is making all cells Red


how do i just change it to records that are duplicated?

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";
}
}

this didnt work either :-(

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

by mobhar » Mon May 11, 2015 9:12 am

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

Re: Row_Rendered event

by andyrav » Mon May 11, 2015 4:41 pm

Hi, spot on many thanks.

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

Return to General Discussion (PHPMaker)

Board index
Delete all board cookies • All times are UTC + 8 hours

Powered by phpBB® Forum Software © phpBB Group

You might also like