Page 1 of 1

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

Posted: Wed Feb 28, 2024 1:44 pm
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!


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

Posted: Wed Feb 28, 2024 6:07 pm
by arbei

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


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

Posted: Wed Feb 28, 2024 7:05 pm
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.


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

Posted: Wed Feb 28, 2024 7:29 pm
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.


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

Posted: Thu Feb 29, 2024 1:51 pm
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.


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

Posted: Thu Feb 29, 2024 2:50 pm
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!


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

Posted: Thu Feb 29, 2024 4:55 pm
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).


Crosstab - SummaryValues cell value change

Posted: Thu Feb 29, 2024 9:42 pm
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!


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

Posted: Fri Mar 01, 2024 9:33 am
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.


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

Posted: Fri Mar 01, 2024 12:12 pm
by elonmusk

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


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

Posted: Fri Mar 01, 2024 1:02 pm
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.


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

Posted: Fri Mar 01, 2024 7:23 pm
by elonmusk

i tried but i cant archive my need .

thanks for your responses