Crosstab Report - custom view values for one row (v2023)

This public forum is for user-to-user discussions of PHPMaker. Note that this is not support forum.
Post Reply
elonmusk
User
Posts: 48

Crosstab Report - custom view values for one row (v2023)

Post by elonmusk »

In crosstab report there any possibility to give custom view values for one row, which contains the Quarterly cost for one product in demo project.

Thank you!


arbei
User
Posts: 9384

Post by arbei »

Again, you may use Cell_Rendered server event to set your own ViewValue. (You need to calculate the custom value yourself.)


elonmusk
User
Posts: 48

Post by elonmusk »

I don't know how to use Cell_rendered() for that.
i give one example in demo project of phpmaker ,

there have category, Product, Quarterly report Okay, Now i want to give custom value for that particular category and that particular product quarterly sales costs .
I don't know how to do that if give any example i can get some idea about that.

Thanks.


mobhar
User
Posts: 11727

Post by mobhar »

If you click that link that will refer to Cell_Rendered server event, then you will see an Example code there.

As you can see, that event has $ViewValue param, that you can use to change the view value of the cell.

Always try it by yourself first, and you may post your code for more discussion.


elonmusk
User
Posts: 48

Post by elonmusk »

My Code :

public function cellRendered(&$Field, $CurrentValue, &$ViewValue, &$ViewAttrs, &$CellAttrs, &$HrefValue, &$LinkAttrs)
    {
        if (isset($Field->Records[9])) {
              
                $desiredArray = $Field->Records[9];
       
                $projectId = $desiredArray["PROJECT_ID"];
                $pSort = $desiredArray["P_SORT"];
                echo $projectId;
               
            } else {
                
                echo "Key '9' does not exist in the array.";
            }
     }

OutPut :
Key '9' does not exist in the array. Key '9' does not exist in the array. Key '9' does not exist in the array. Key '9' does not exist in the array. Key '9' does not exist in the array. Key '9' does not exist in the array. Key '9' does not exist in the array. Key '9' does not exist in the array. Key '9' does not exist in the array. A-PEU0530 A-PEU0530 A-PEU0530

Then how to fetch that project id without these error's.


elonmusk
User
Posts: 48

Post by elonmusk »

My code:

if (isset($Field->Records[9])) {
                $prj_id_array = $Field->Records[9];
                $projectId = $prj_id_array["PROJECT_ID"];
                $pSort = $prj_id_array["P_SORT"];
                $len = count($this->Columns) - 1;
                for ($i = 1; $i <= $len; $i++) 
                {
                    if (isset($this->Columns[$i])) 
                    {
                        
                        $mon_array = $this->Columns[$i]->Value;
                        $query = ExecuteScalar("SELECT MAX(`Last in date`) AS 'Maximum Last in date' FROM (SELECT GREATEST(COALESCE(REVISED_ETA1, '1900-01-01'), COALESCE(REVISED_ETA2, '1900-01-01')) AS 'Last in date' FROM por_electronics_tracker  WHERE (por_electronics_tracker.PRQ_STATUS = 'A' OR por_electronics_tracker.PRQ_STATUS = 'C') AND por_electronics_tracker.STATUS IN (6,11) AND PROJECT_ID ='".$projectId."' AND YEAR(por_electronics_tracker.PRQ_APPROVED_DATE) = 2023 AND MONTH(por_electronics_tracker.PRQ_APPROVED_DATE) = '$mon_array') AS LID");
                        var_dump($query);    
                    }
                }
            } 

i want that query result should reflect in $Field->Records[9] row data.

Give me any suggestions. Please
Thanks!


arbei
User
Posts: 9384

Post by arbei »

If you do not know what you can use, you can view the arguments first, e.g. var_dump($Field, $CurrentValue, $ViewValue, $ViewAttrs, $CellAttrs, $HrefValue, $LinkAttrs).


elonmusk
User
Posts: 48

Post by elonmusk »

In crosstab report how to change dynamically a particular cell value which is summary values cell. And how to get that particular cell value's column name or value?
In my case i have created one crosstab report that have project_id, process, m_sort and count. m_sort is the dynamic column. ( project_id and process is row heading)
Now what i am trying to do is :

1.in that process field have 10 processes for each project. In the 10 th process i want show a estimation date for each dynamic columns instead of summary values.
2.To get thet estimation date i need that project_id and dynamic column values to fetch from database.

These are the requirement.

Please help me out on this.

Thank You!


arbei
User
Posts: 9384

Post by arbei »

You may get the row heading values by, e.g. if the field is named "process", then $this->process->GroupViewValue. If not sure, you may always view the field object first, e.g. var_dump($this->proces) first.


elonmusk
User
Posts: 48

Post by elonmusk »

yeah i got the row heading values. I want dynamic columns field values.


arbei
User
Posts: 9384

Post by arbei »

mobhar wrote:

If you click that link that will refer to Cell_Rendered server event, then you will see an Example code there.

As you can see, that event has $ViewValue param, that you can use to change the view value of the cell.

Always try it by yourself first, and you may post your code for more discussion.


elonmusk
User
Posts: 48

Post by elonmusk »

i tried but i cant archive my need .

thanks for your responses


Post Reply